diff --git a/chrome/content/zotero/customElements.js b/chrome/content/zotero/customElements.js index 8ece74089c..329578a60e 100644 --- a/chrome/content/zotero/customElements.js +++ b/chrome/content/zotero/customElements.js @@ -60,7 +60,7 @@ Services.scriptloader.loadSubScript('chrome://zotero/content/elements/itemPaneSe ['zoterosearchcondition', 'chrome://zotero/content/elements/zoteroSearch.js'], ['zoterosearchtextbox', 'chrome://zotero/content/elements/zoteroSearch.js'], ['zoterosearchagefield', 'chrome://zotero/content/elements/zoteroSearch.js'], - ['pane-header', 'chrome://zotero/content/elements/itemPaneHeader.js'], + ['item-pane-header', 'chrome://zotero/content/elements/itemPaneHeader.js'], ['editable-text', 'chrome://zotero/content/elements/editableText.js'], ['item-pane-sidenav', 'chrome://zotero/content/elements/itemPaneSidenav.js'], ['abstract-box', 'chrome://zotero/content/elements/abstractBox.js'], diff --git a/chrome/content/zotero/elements/contextPane.js b/chrome/content/zotero/elements/contextPane.js index 23c67ca956..235f6a498d 100644 --- a/chrome/content/zotero/elements/contextPane.js +++ b/chrome/content/zotero/elements/contextPane.js @@ -317,7 +317,7 @@ if (splitter.getAttribute('state') != 'collapsed') { if (this.mode == "item") { - let header = this._itemPaneDeck.selectedPanel.querySelector("pane-header editable-text"); + let header = this._itemPaneDeck.selectedPanel.querySelector("item-pane-header editable-text"); header.focus(); return true; } diff --git a/chrome/content/zotero/elements/itemDetails.js b/chrome/content/zotero/elements/itemDetails.js index 5f178e3a61..e9d9030ebc 100644 --- a/chrome/content/zotero/elements/itemDetails.js +++ b/chrome/content/zotero/elements/itemDetails.js @@ -47,7 +47,7 @@ content = MozXULElement.parseXULToFragment(` - + diff --git a/chrome/content/zotero/elements/itemPaneHeader.js b/chrome/content/zotero/elements/itemPaneHeader.js index c4c28a150f..69e2d61950 100644 --- a/chrome/content/zotero/elements/itemPaneHeader.js +++ b/chrome/content/zotero/elements/itemPaneHeader.js @@ -381,7 +381,7 @@ }); } } - customElements.define("pane-header", ItemPaneHeader); + customElements.define("item-pane-header", ItemPaneHeader); /** * Simple LRU cache that stores bibliography entries for the 100 most recently viewed items. diff --git a/scss/elements/_paneHeader.scss b/scss/elements/_paneHeader.scss index b823b11dd4..eb9865c4e2 100644 --- a/scss/elements/_paneHeader.scss +++ b/scss/elements/_paneHeader.scss @@ -1,4 +1,4 @@ -pane-header { +item-pane-header { &:not([hidden]) { display: flex; } diff --git a/test/tests/itemPaneTest.js b/test/tests/itemPaneTest.js index 2595db9bd6..834d7cbfba 100644 --- a/test/tests/itemPaneTest.js +++ b/test/tests/itemPaneTest.js @@ -63,18 +63,18 @@ describe("Item pane", function () { it("should be hidden when set to None mode", async function () { Zotero.Prefs.set('itemPaneHeader', 'none'); await createDataObject('item', itemData); - assert.isTrue(doc.querySelector('pane-header').hidden); + assert.isTrue(doc.querySelector('item-pane-header').hidden); }); it("should show title when set to Title mode", async function () { Zotero.Prefs.set('itemPaneHeader', 'title'); let item = await createDataObject('item', itemData); - assert.isFalse(doc.querySelector('pane-header .title').hidden); - assert.isTrue(doc.querySelector('pane-header .creator-year').hidden); - assert.isTrue(doc.querySelector('pane-header .bib-entry').hidden); + assert.isFalse(doc.querySelector('item-pane-header .title').hidden); + assert.isTrue(doc.querySelector('item-pane-header .creator-year').hidden); + assert.isTrue(doc.querySelector('item-pane-header .bib-entry').hidden); - assert.equal(doc.querySelector('pane-header .title editable-text').value, item.getField('title')); + assert.equal(doc.querySelector('item-pane-header .title editable-text').value, item.getField('title')); }); it("should show title/creator/year when set to Title/Creator/Year mode", async function () { @@ -83,12 +83,12 @@ describe("Item pane", function () { item.setField('date', '1962-05-01'); await item.saveTx(); - assert.isTrue(doc.querySelector('pane-header .bib-entry').hidden); - assert.isFalse(doc.querySelector('pane-header .title').hidden); - assert.isFalse(doc.querySelector('pane-header .creator-year').hidden); + assert.isTrue(doc.querySelector('item-pane-header .bib-entry').hidden); + assert.isFalse(doc.querySelector('item-pane-header .title').hidden); + assert.isFalse(doc.querySelector('item-pane-header .creator-year').hidden); - assert.equal(doc.querySelector('pane-header .title editable-text').value, item.getField('title')); - let creatorYearText = doc.querySelector('pane-header .creator-year').textContent; + assert.equal(doc.querySelector('item-pane-header .title editable-text').value, item.getField('title')); + let creatorYearText = doc.querySelector('item-pane-header .creator-year').textContent; assert.include(creatorYearText, 'Hyde'); assert.include(creatorYearText, '1962'); }); @@ -98,11 +98,11 @@ describe("Item pane", function () { Zotero.Prefs.set('itemPaneHeader.bibEntry.style', 'http://www.zotero.org/styles/apa'); await createDataObject('item', itemData); - assert.isFalse(doc.querySelector('pane-header .bib-entry').hidden); - assert.isTrue(doc.querySelector('pane-header .title').hidden); - assert.isTrue(doc.querySelector('pane-header .creator-year').hidden); + assert.isFalse(doc.querySelector('item-pane-header .bib-entry').hidden); + assert.isTrue(doc.querySelector('item-pane-header .title').hidden); + assert.isTrue(doc.querySelector('item-pane-header .creator-year').hidden); - let bibEntry = doc.querySelector('pane-header .bib-entry').shadowRoot.firstElementChild.textContent; + let bibEntry = doc.querySelector('item-pane-header .bib-entry').shadowRoot.firstElementChild.textContent; assert.equal(bibEntry.trim(), 'Hyde, G. E. (n.d.). Birds—A Primer of Ornithology (Teach Yourself Books).'); }); @@ -111,7 +111,7 @@ describe("Item pane", function () { Zotero.Prefs.set('itemPaneHeader.bibEntry.style', 'http://www.zotero.org/styles/apa'); let item = await createDataObject('item', itemData); - let bibEntryElem = doc.querySelector('pane-header .bib-entry').shadowRoot.firstElementChild; + let bibEntryElem = doc.querySelector('item-pane-header .bib-entry').shadowRoot.firstElementChild; assert.equal(bibEntryElem.textContent.trim(), 'Hyde, G. E. (n.d.). Birds—A Primer of Ornithology (Teach Yourself Books).'); @@ -139,7 +139,7 @@ describe("Item pane", function () { Zotero.Prefs.set('itemPaneHeader.bibEntry.style', 'http://www.zotero.org/styles/apa'); await createDataObject('item', itemData); - let bibEntryElem = doc.querySelector('pane-header .bib-entry').shadowRoot.firstElementChild; + let bibEntryElem = doc.querySelector('item-pane-header .bib-entry').shadowRoot.firstElementChild; assert.equal(bibEntryElem.textContent.trim(), 'Hyde, G. E. (n.d.). Birds—A Primer of Ornithology (Teach Yourself Books).'); @@ -152,7 +152,7 @@ describe("Item pane", function () { Zotero.Prefs.set('itemPaneHeader.bibEntry.style', 'http://www.zotero.org/styles/apa'); await createDataObject('item', itemData); - let bibEntryElem = doc.querySelector('pane-header .bib-entry').shadowRoot.firstElementChild; + let bibEntryElem = doc.querySelector('item-pane-header .bib-entry').shadowRoot.firstElementChild; assert.equal(bibEntryElem.textContent.trim(), 'Hyde, G. E. (n.d.). Birds—A Primer of Ornithology (Teach Yourself Books).'); @@ -165,9 +165,9 @@ describe("Item pane", function () { Zotero.Prefs.set('itemPaneHeader.bibEntry.style', 'http://www.zotero.org/styles/an-id-that-does-not-match-any-citation-style'); await createDataObject('item', itemData); - assert.isTrue(doc.querySelector('pane-header .bib-entry').hidden); - assert.isFalse(doc.querySelector('pane-header .title').hidden); - assert.isFalse(doc.querySelector('pane-header .creator-year').hidden); + assert.isTrue(doc.querySelector('item-pane-header .bib-entry').hidden); + assert.isFalse(doc.querySelector('item-pane-header .title').hidden); + assert.isFalse(doc.querySelector('item-pane-header .creator-year').hidden); }); });