Fix some breakage from 013dc958b3

This commit is contained in:
Dan Stillman 2017-06-01 15:33:00 -04:00
parent ede03f4366
commit 05ff16c17f
3 changed files with 146 additions and 100 deletions

View file

@ -1033,6 +1033,53 @@ describe("Zotero.Sync.Runner", function () {
});
it("should show a button in error panel to select a too-long note", function* () {
win = yield loadZoteroPane();
var doc = win.document;
var text = "".padStart(256, "a");
var item = yield createDataObject('item', { itemType: 'note', note: text });
setResponse('keyInfo.fullAccess');
setResponse('userGroups.groupVersions');
setResponse('groups.ownerGroup');
setResponse('groups.memberGroup');
server.respond(function (req) {
if (req.method == "POST" && req.url == baseURL + "users/1/items") {
req.respond(
200,
{
"Last-Modified-Version": 5
},
JSON.stringify({
successful: {},
success: {},
unchanged: {},
failed: {
"0": {
code: 413,
message: `Note ${Zotero.Utilities.ellipsize(text, 100)} too long`
}
}
})
);
}
});
yield runner.sync({ libraries: [Zotero.Libraries.userLibraryID] });
var errorIcon = doc.getElementById('zotero-tb-sync-error');
assert.isFalse(errorIcon.hidden);
errorIcon.click();
var panel = win.document.getElementById('zotero-sync-error-panel');
assert.include(panel.innerHTML, text.substr(0, 10));
var buttons = panel.getElementsByTagName('button');
assert.lengthOf(buttons, 1);
assert.include(buttons[0].label, Zotero.getString('pane.items.showItemInLibrary'));
});
// TODO: Test multiple long tags and tags across libraries
describe("Long Tag Fixer", function () {
it("should split a tag", function* () {