Remove embedded-image attachment under annotation in test
This commit is contained in:
parent
651aabc4dc
commit
77ea19277d
2 changed files with 15 additions and 16 deletions
|
@ -366,7 +366,7 @@ Zotero.Attachments = new function(){
|
||||||
* @return {Promise<Zotero.Item>}
|
* @return {Promise<Zotero.Item>}
|
||||||
*/
|
*/
|
||||||
this.importEmbeddedImage = async function ({ blob, parentItemID, saveOptions }) {
|
this.importEmbeddedImage = async function ({ blob, parentItemID, saveOptions }) {
|
||||||
Zotero.debug('Importing note or annotation image');
|
Zotero.debug('Importing embedded image');
|
||||||
|
|
||||||
if (!parentItemID) {
|
if (!parentItemID) {
|
||||||
throw new Error("parentItemID must be provided");
|
throw new Error("parentItemID must be provided");
|
||||||
|
|
|
@ -137,17 +137,17 @@ describe("Zotero.DataObjects", function () {
|
||||||
function check(arr) {
|
function check(arr) {
|
||||||
var str = arr.map(o => title(o)).join('');
|
var str = arr.map(o => title(o)).join('');
|
||||||
var possibilities = [
|
var possibilities = [
|
||||||
'ACDEFHI',
|
'ACDEFH',
|
||||||
'ACDEFIH',
|
'ACDEFH',
|
||||||
|
|
||||||
'ADCEFHI',
|
'ADCEFH',
|
||||||
'ADCEFIH',
|
'ADCEFH',
|
||||||
|
|
||||||
'EFHIACD',
|
'EFHACD',
|
||||||
'EFHIADC',
|
'EFHADC',
|
||||||
|
|
||||||
'EFIHACD',
|
'EFHACD',
|
||||||
'EFIHADC',
|
'EFHADC',
|
||||||
];
|
];
|
||||||
assert.oneOf(str, possibilities);
|
assert.oneOf(str, possibilities);
|
||||||
}
|
}
|
||||||
|
@ -163,30 +163,29 @@ describe("Zotero.DataObjects", function () {
|
||||||
var e = await createDataObject('item', { title: "E" });
|
var e = await createDataObject('item', { title: "E" });
|
||||||
var f = await importPDFAttachment(e, { title: 'F' });
|
var f = await importPDFAttachment(e, { title: 'F' });
|
||||||
var g = await createAnnotation('image', f, { tags: [{ tag: 'G' }] });
|
var g = await createAnnotation('image', f, { tags: [{ tag: 'G' }] });
|
||||||
var h = await createEmbeddedImage(g, { tags: [{ tag: 'H' }] });
|
var h = await createAnnotation('highlight', f, { tags: [{ tag: 'H' }] });
|
||||||
var i = await createAnnotation('highlight', f, { tags: [{ tag: 'I' }] });
|
|
||||||
|
|
||||||
var arr = Zotero.Items.sortByParent([a, c, d, e, f, h, i]);
|
var arr = Zotero.Items.sortByParent([a, c, d, e, f, h]);
|
||||||
Zotero.debug(arr.map(o => title(o)));
|
Zotero.debug(arr.map(o => title(o)));
|
||||||
check(arr);
|
check(arr);
|
||||||
|
|
||||||
// Reverse order
|
// Reverse order
|
||||||
arr = Zotero.Items.sortByParent([a, c, d, e, f, h, i].reverse());
|
arr = Zotero.Items.sortByParent([a, c, d, e, f, h].reverse());
|
||||||
Zotero.debug(arr.map(o => title(o)));
|
Zotero.debug(arr.map(o => title(o)));
|
||||||
check(arr);
|
check(arr);
|
||||||
|
|
||||||
// Top-level first
|
// Top-level first
|
||||||
arr = Zotero.Items.sortByParent([a, e, c, d, f, h, i]);
|
arr = Zotero.Items.sortByParent([a, e, c, d, f, h]);
|
||||||
Zotero.debug(arr.map(o => title(o)));
|
Zotero.debug(arr.map(o => title(o)));
|
||||||
check(arr);
|
check(arr);
|
||||||
|
|
||||||
// Child first
|
// Child first
|
||||||
arr = Zotero.Items.sortByParent([c, h, d, i, f, a, e]);
|
arr = Zotero.Items.sortByParent([c, h, d, f, a, e]);
|
||||||
Zotero.debug(arr.map(o => title(o)));
|
Zotero.debug(arr.map(o => title(o)));
|
||||||
check(arr);
|
check(arr);
|
||||||
|
|
||||||
// Random
|
// Random
|
||||||
arr = Zotero.Items.sortByParent([i, e, d, h, c, a, f]);
|
arr = Zotero.Items.sortByParent([e, d, h, c, a, f]);
|
||||||
Zotero.debug(arr.map(o => title(o)));
|
Zotero.debug(arr.map(o => title(o)));
|
||||||
check(arr);
|
check(arr);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue