fx-compat: Run translation and SingleFile in [hidden] browser
And replace loadDocuments().
This commit is contained in:
parent
b2947aede0
commit
0612a9e6f5
19 changed files with 1652 additions and 649 deletions
|
@ -349,50 +349,7 @@ describe("Zotero.HTTP", function () {
|
|||
assert.isTrue(called);
|
||||
});
|
||||
});
|
||||
|
||||
describe("#loadDocuments()", function () {
|
||||
var win;
|
||||
|
||||
before(function* () {
|
||||
// TEMP: createHiddenBrowser currently needs a parent window
|
||||
win = yield loadBrowserWindow();
|
||||
});
|
||||
|
||||
after(function* () {
|
||||
win.close();
|
||||
});
|
||||
|
||||
it("should provide a document object", function* () {
|
||||
var called = false;
|
||||
yield new Zotero.Promise((resolve) => {
|
||||
Zotero.HTTP.loadDocuments(
|
||||
testURL,
|
||||
function (doc) {
|
||||
assert.equal(doc.location.href, testURL);
|
||||
assert.equal(doc.querySelector('p').textContent, 'Test');
|
||||
var p = doc.evaluate('//p', doc, null, XPathResult.ANY_TYPE, null).iterateNext();
|
||||
assert.equal(p.textContent, 'Test');
|
||||
called = true;
|
||||
},
|
||||
resolve
|
||||
);
|
||||
});
|
||||
assert.isTrue(called);
|
||||
});
|
||||
|
||||
it("should fail on non-2xx response", async function () {
|
||||
var e = await getPromiseError(new Zotero.Promise((resolve, reject) => {
|
||||
Zotero.HTTP.loadDocuments(
|
||||
baseURL + "nonexistent",
|
||||
() => {},
|
||||
resolve,
|
||||
reject
|
||||
);
|
||||
}));
|
||||
assert.instanceOf(e, Zotero.HTTP.UnexpectedStatusException);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("CasePreservingHeaders", function () {
|
||||
describe("#constructor()", function () {
|
||||
it("should initialize from an iterable or object", function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue