Fix Zotero.Date methods within translator sandbox

Only a few methods are imported, so some of the changes in 7bdcc17ed
have to be reverted.
This commit is contained in:
Dan Stillman 2017-01-17 02:23:15 -05:00
parent b00d1366b0
commit a017fe6666
2 changed files with 26 additions and 6 deletions

View file

@ -156,6 +156,26 @@ describe("Zotero.Date", function() {
})
})
describe("#strToDate()", function () {
it("should work in translator sandbox", function* () {
var item = createUnsavedDataObject('item');
item.libraryID = Zotero.Libraries.userLibraryID;
item.setField('date', '2017-01-17');
var called = false;
var translation = new Zotero.Translate.Export();
translation.setItems([item]);
translation.setTranslator("9cb70025-a888-4a29-a210-93ec52da40d4"); // BibTeX
translation.setHandler("done", function (obj, worked) {
called = true;
assert.isTrue(worked);
assert.include(obj.string, "{2017}");
});
yield translation.translate();
assert.ok(called);
});
});
describe("#isHTTPDate()", function() {
it("should determine whether a date is an RFC 2822 compliant date", function() {
assert.ok(Zotero.Date.isHTTPDate("Mon, 13 Jun 2016 02:09:08 +4000"));