Tests: Use select() instead of selectCollection()/selectSearch()

This commit is contained in:
Dan Stillman 2024-06-24 04:40:12 -04:00
parent ca5ea08e2b
commit 4ca92adb89
2 changed files with 11 additions and 11 deletions

View file

@ -46,7 +46,7 @@ describe("Zotero_File_Interface", function() {
it("should import RIS into selected collection", async function () {
var collection = await createDataObject('collection');
await selectCollection(win, collection);
await select(win, collection);
var testFile = OS.Path.join(getTestDataDirectory().path, 'book_and_child_note.ris');
await win.Zotero_File_Interface.importFile({

View file

@ -71,7 +71,7 @@ describe("ZoteroPane", function() {
it("should create a standalone note within a collection and select it", function* () {
var collection = yield createDataObject('collection');
yield selectCollection(win, collection);
yield select(win, collection);
var noteID = yield zp.newNote(false, false, "Test");
assert.equal(zp.collectionsView.getSelectedCollection(), collection);
var selected = zp.itemsView.getSelectedItems(true);
@ -461,7 +461,7 @@ describe("ZoteroPane", function() {
describe("#createStandaloneNoteFromAnnotationsFromSelected()", function () {
it("should create a single standalone note for all child attachments of selected regular items", async function () {
var collection = await createDataObject('collection');
await selectCollection(win, collection);
await select(win, collection);
var item1 = await createDataObject('item', { setTitle: true, collections: [collection.id] });
var item2 = await createDataObject('item', { setTitle: true, collections: [collection.id] });
var attachment1 = await importPDFAttachment(item1);
@ -505,7 +505,7 @@ describe("ZoteroPane", function() {
it("should create a single standalone note for all selected attachments", async function () {
var collection = await createDataObject('collection');
await selectCollection(win, collection);
await select(win, collection);
var item1 = await createDataObject('item', { setTitle: true, collections: [collection.id] });
var item2 = await createDataObject('item', { setTitle: true, collections: [collection.id] });
var attachment1 = await importPDFAttachment(item1);
@ -849,7 +849,7 @@ describe("ZoteroPane", function() {
.filter(x => x.condition == 'title' && x.operator == 'contains')[0].value;
var item = await createDataObject('item', { title });
await selectSearch(win, search);
await select(win, search);
var iv = zp.itemsView;
var selected = iv.selectItem(item.id);
@ -886,7 +886,7 @@ describe("ZoteroPane", function() {
.filter(x => x.condition == 'title' && x.operator == 'contains')[0].value;
var item = await createDataObject('item', { title });
await selectSearch(win, search);
await select(win, search);
var iv = zp.itemsView;
var selected = iv.selectItem(item.id);
@ -924,7 +924,7 @@ describe("ZoteroPane", function() {
let collection2 = await createDataObject('collection', { parentID: collection1.id });
let item = await createDataObject('item', { collections: [collection2.id] });
await selectCollection(win, collection1);
await select(win, collection1);
let iv = zp.itemsView;
assert.ok(await iv.selectItem(item.id));
@ -948,7 +948,7 @@ describe("ZoteroPane", function() {
describe("#deleteSelectedCollection()", function () {
it("should move collection to trash but not descendant items by default", function* () {
var collection = yield createDataObject('collection');
yield selectCollection(win, collection);
yield select(win, collection);
var item = yield createDataObject('item', { collections: [collection.id] });
var promise = waitForDialog();
yield zp.deleteSelectedCollection();
@ -959,7 +959,7 @@ describe("ZoteroPane", function() {
it("should move to trash collection and descendant items when deleteItems=true", function* () {
var collection = yield createDataObject('collection');
yield selectCollection(win, collection);
yield select(win, collection);
var item = yield createDataObject('item', { collections: [collection.id] });
var promise = waitForDialog();
yield zp.deleteSelectedCollection(true);
@ -1115,7 +1115,7 @@ describe("ZoteroPane", function() {
describe("#editSelectedCollection()", function () {
it("should edit a saved search", function* () {
var search = yield createDataObject('search');
yield selectSearch(win, search);
yield select(win, search);
var promise = waitForWindow('chrome://zotero/content/searchDialog.xhtml', function (win) {
let searchBox = win.document.getElementById('search-box');
var c = searchBox.search.getCondition(
@ -1133,7 +1133,7 @@ describe("ZoteroPane", function() {
it("should edit a saved search in a group", function* () {
var group = yield getGroup();
var search = yield createDataObject('search', { libraryID: group.libraryID });
yield selectSearch(win, search);
yield select(win, search);
var promise = waitForWindow('chrome://zotero/content/searchDialog.xhtml', function (win) {
let searchBox = win.document.getElementById('search-box');
var c = searchBox.search.getCondition(