Skip to content

Commit

Permalink
Merge pull request #18757 from calixteman/rename_toolbar_buttons
Browse files Browse the repository at this point in the history
Rename the toolbar buttons in order to free their current names
  • Loading branch information
calixteman authored Sep 17, 2024
2 parents a58cd68 + ee89bd1 commit 19151fe
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 49 deletions.
2 changes: 1 addition & 1 deletion test/integration/accessibility_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ describe("accessibility", () => {
.toBeTrue();

const handle = await waitForPageRendered(page);
await page.click(`#zoom${i < 4 ? "In" : "Out"}`);
await page.click(`#zoom${i < 4 ? "In" : "Out"}Button`);
await awaitPromise(handle);
}
})
Expand Down
8 changes: 4 additions & 4 deletions test/integration/find_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ describe("find bar", () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
// Highlight all occurrences of the letter A (case insensitive).
await page.click("#viewFind");
await page.waitForSelector("#viewFind", { hidden: false });
await page.click("#viewFindButton");
await page.waitForSelector("#viewFindButton", { hidden: false });
await page.type("#findInput", "a");
await page.click("#findHighlightAll");
await page.waitForSelector(".textLayer .highlight");
Expand Down Expand Up @@ -100,8 +100,8 @@ describe("find bar", () => {
it("must search xfa correctly", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await page.click("#viewFind");
await page.waitForSelector("#viewFind", { hidden: false });
await page.click("#viewFindButton");
await page.waitForSelector("#viewFindButton", { hidden: false });
await page.type("#findInput", "preferences");
await page.waitForSelector("#findInput[data-status='']");
await page.waitForSelector(".xfaLayer .highlight");
Expand Down
4 changes: 2 additions & 2 deletions test/integration/freetext_editor_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2741,7 +2741,7 @@ describe("FreeText Editor", () => {
it("must create an editor from the toolbar", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await page.focus("#editorFreeText");
await page.focus("#editorFreeTextButton");
await page.keyboard.press("Enter");

let selectorEditor = getEditorSelector(0);
Expand Down Expand Up @@ -2772,7 +2772,7 @@ describe("FreeText Editor", () => {
// Disable editing mode.
await switchToFreeText(page, /* disable = */ true);

await page.focus("#editorFreeText");
await page.focus("#editorFreeTextButton");
await page.keyboard.press(" ");
selectorEditor = getEditorSelector(1);
await page.waitForSelector(selectorEditor, {
Expand Down
4 changes: 2 additions & 2 deletions test/integration/scripting_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ describe("Interaction", () => {
page,
getSelector("47R"),
async () => {
await page.click("#print");
await page.click("#printButton");
}
);
expect(text).withContext(`In ${browserName}`).toEqual("WillPrint");
Expand Down Expand Up @@ -509,7 +509,7 @@ describe("Interaction", () => {
page,
getSelector("47R"),
async () => {
await page.click("#download");
await page.click("#downloadButton");
}
);
expect(text).withContext(`In ${browserName}`).toEqual("WillSave");
Expand Down
2 changes: 1 addition & 1 deletion test/integration/test_utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ async function switchToEditor(name, page, disable = false) {
{ once: true }
);
});
await page.click(`#editor${name}`);
await page.click(`#editor${name}Button`);
name = name.toLowerCase();
await page.waitForSelector(
".annotationEditorLayer" +
Expand Down
26 changes: 13 additions & 13 deletions web/viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -778,12 +778,12 @@ body {
background-color: var(--toolbar-icon-hover-bg-color);
}

#sidebarToggle::before {
#sidebarToggleButton::before {
mask-image: var(--toolbarButton-sidebarToggle-icon);
transform: scaleX(var(--dir-factor));
}

#secondaryToolbarToggle::before {
#secondaryToolbarToggleButton::before {
mask-image: var(--toolbarButton-secondaryToolbarToggle-icon);
transform: scaleX(var(--dir-factor));
}
Expand All @@ -796,35 +796,35 @@ body {
mask-image: var(--toolbarButton-pageDown-icon);
}

#zoomOut::before {
#zoomOutButton::before {
mask-image: var(--toolbarButton-zoomOut-icon);
}

#zoomIn::before {
#zoomInButton::before {
mask-image: var(--toolbarButton-zoomIn-icon);
}

#editorFreeText::before {
#editorFreeTextButton::before {
mask-image: var(--toolbarButton-editorFreeText-icon);
}

#editorHighlight::before {
#editorHighlightButton::before {
mask-image: var(--toolbarButton-editorHighlight-icon);
}

#editorInk::before {
#editorInkButton::before {
mask-image: var(--toolbarButton-editorInk-icon);
}

#editorStamp::before {
#editorStampButton::before {
mask-image: var(--toolbarButton-editorStamp-icon);
}

#print::before {
#printButton::before {
mask-image: var(--toolbarButton-print-icon);
}

#download::before {
#downloadButton::before {
mask-image: var(--toolbarButton-download-icon);
}

Expand All @@ -850,7 +850,7 @@ body {
transform: scaleX(var(--dir-factor));
}

#viewFind::before {
#viewFindButton::before {
mask-image: var(--toolbarButton-search-icon);
}

Expand Down Expand Up @@ -1443,11 +1443,11 @@ dialog :link {
}
}

#findPrevious::before {
#findPreviousButton::before {
mask-image: var(--findbarButton-previous-icon);
}

#findNext::before {
#findNextButton::before {
mask-image: var(--findbarButton-next-icon);
}
}
Expand Down
26 changes: 13 additions & 13 deletions web/viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@
<input id="findInput" class="toolbarField" title="Find" placeholder="Find in document…" tabindex="91" data-l10n-id="pdfjs-find-input" aria-invalid="false">
</span>
<div class="splitToolbarButton">
<button id="findPrevious" class="toolbarButton" type="button" title="Find the previous occurrence of the phrase" tabindex="92" data-l10n-id="pdfjs-find-previous-button">
<button id="findPreviousButton" class="toolbarButton" type="button" title="Find the previous occurrence of the phrase" tabindex="92" data-l10n-id="pdfjs-find-previous-button">
<span data-l10n-id="pdfjs-find-previous-button-label">Previous</span>
</button>
<div class="splitToolbarButtonSeparator"></div>
<button id="findNext" class="toolbarButton" type="button" title="Find the next occurrence of the phrase" tabindex="93" data-l10n-id="pdfjs-find-next-button">
<button id="findNextButton" class="toolbarButton" type="button" title="Find the next occurrence of the phrase" tabindex="93" data-l10n-id="pdfjs-find-next-button">
<span data-l10n-id="pdfjs-find-next-button-label">Next</span>
</button>
</div>
Expand Down Expand Up @@ -340,11 +340,11 @@
<div id="toolbarContainer">
<div id="toolbarViewer">
<div id="toolbarViewerLeft">
<button id="sidebarToggle" class="toolbarButton" type="button" title="Toggle Sidebar" tabindex="11" data-l10n-id="pdfjs-toggle-sidebar-button" aria-expanded="false" aria-controls="sidebarContainer">
<button id="sidebarToggleButton" class="toolbarButton" type="button" title="Toggle Sidebar" tabindex="11" data-l10n-id="pdfjs-toggle-sidebar-button" aria-expanded="false" aria-controls="sidebarContainer">
<span data-l10n-id="pdfjs-toggle-sidebar-button-label">Toggle Sidebar</span>
</button>
<div class="toolbarButtonSpacer"></div>
<button id="viewFind" class="toolbarButton" type="button" title="Find in Document" tabindex="12" data-l10n-id="pdfjs-findbar-button" aria-expanded="false" aria-controls="findbar">
<button id="viewFindButton" class="toolbarButton" type="button" title="Find in Document" tabindex="12" data-l10n-id="pdfjs-findbar-button" aria-expanded="false" aria-controls="findbar">
<span data-l10n-id="pdfjs-findbar-button-label">Find</span>
</button>
<div class="splitToolbarButton hiddenSmallView">
Expand All @@ -363,43 +363,43 @@
</div>
<div id="toolbarViewerRight">
<div id="editorModeButtons" class="splitToolbarButton toggled" role="radiogroup">
<button id="editorHighlight" class="toolbarButton" type="button" disabled="disabled" title="Highlight" role="radio" aria-checked="false" aria-controls="editorHighlightParamsToolbar" tabindex="31" data-l10n-id="pdfjs-editor-highlight-button">
<button id="editorHighlightButton" class="toolbarButton" type="button" disabled="disabled" title="Highlight" role="radio" aria-checked="false" aria-controls="editorHighlightParamsToolbar" tabindex="31" data-l10n-id="pdfjs-editor-highlight-button">
<span data-l10n-id="pdfjs-editor-highlight-button-label">Highlight</span>
</button>
<button id="editorFreeText" class="toolbarButton" type="button" disabled="disabled" title="Text" role="radio" aria-checked="false" aria-controls="editorFreeTextParamsToolbar" tabindex="32" data-l10n-id="pdfjs-editor-free-text-button">
<button id="editorFreeTextButton" class="toolbarButton" type="button" disabled="disabled" title="Text" role="radio" aria-checked="false" aria-controls="editorFreeTextParamsToolbar" tabindex="32" data-l10n-id="pdfjs-editor-free-text-button">
<span data-l10n-id="pdfjs-editor-free-text-button-label">Text</span>
</button>
<button id="editorInk" class="toolbarButton" type="button" disabled="disabled" title="Draw" role="radio" aria-checked="false" aria-controls="editorInkParamsToolbar" tabindex="33" data-l10n-id="pdfjs-editor-ink-button">
<button id="editorInkButton" class="toolbarButton" type="button" disabled="disabled" title="Draw" role="radio" aria-checked="false" aria-controls="editorInkParamsToolbar" tabindex="33" data-l10n-id="pdfjs-editor-ink-button">
<span data-l10n-id="pdfjs-editor-ink-button-label">Draw</span>
</button>
<button id="editorStamp" class="toolbarButton" type="button" disabled="disabled" title="Add or edit images" role="radio" aria-checked="false" aria-controls="editorStampParamsToolbar" tabindex="34" data-l10n-id="pdfjs-editor-stamp-button">
<button id="editorStampButton" class="toolbarButton" type="button" disabled="disabled" title="Add or edit images" role="radio" aria-checked="false" aria-controls="editorStampParamsToolbar" tabindex="34" data-l10n-id="pdfjs-editor-stamp-button">
<span data-l10n-id="pdfjs-editor-stamp-button-label">Add or edit images</span>
</button>
</div>

<div id="editorModeSeparator" class="verticalToolbarSeparator"></div>

<button id="print" class="toolbarButton hiddenMediumView" type="button" title="Print" tabindex="41" data-l10n-id="pdfjs-print-button">
<button id="printButton" class="toolbarButton hiddenMediumView" type="button" title="Print" tabindex="41" data-l10n-id="pdfjs-print-button">
<span data-l10n-id="pdfjs-print-button-label">Print</span>
</button>

<button id="download" class="toolbarButton hiddenMediumView" type="button" title="Save" tabindex="42" data-l10n-id="pdfjs-save-button">
<button id="downloadButton" class="toolbarButton hiddenMediumView" type="button" title="Save" tabindex="42" data-l10n-id="pdfjs-save-button">
<span data-l10n-id="pdfjs-save-button-label">Save</span>
</button>

<div class="verticalToolbarSeparator hiddenMediumView"></div>

<button id="secondaryToolbarToggle" class="toolbarButton" type="button" title="Tools" tabindex="43" data-l10n-id="pdfjs-tools-button" aria-expanded="false" aria-controls="secondaryToolbar">
<button id="secondaryToolbarToggleButton" class="toolbarButton" type="button" title="Tools" tabindex="43" data-l10n-id="pdfjs-tools-button" aria-expanded="false" aria-controls="secondaryToolbar">
<span data-l10n-id="pdfjs-tools-button-label">Tools</span>
</button>
</div>
<div id="toolbarViewerMiddle">
<div class="splitToolbarButton">
<button id="zoomOut" class="toolbarButton" type="button" title="Zoom Out" tabindex="21" data-l10n-id="pdfjs-zoom-out-button">
<button id="zoomOutButton" class="toolbarButton" type="button" title="Zoom Out" tabindex="21" data-l10n-id="pdfjs-zoom-out-button">
<span data-l10n-id="pdfjs-zoom-out-button-label">Zoom Out</span>
</button>
<div class="splitToolbarButtonSeparator"></div>
<button id="zoomIn" class="toolbarButton" type="button" title="Zoom In" tabindex="22" data-l10n-id="pdfjs-zoom-in-button">
<button id="zoomInButton" class="toolbarButton" type="button" title="Zoom In" tabindex="22" data-l10n-id="pdfjs-zoom-in-button">
<span data-l10n-id="pdfjs-zoom-in-button-label">Zoom In</span>
</button>
</div>
Expand Down
26 changes: 13 additions & 13 deletions web/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,31 +47,31 @@ function getViewerConfiguration() {
customScaleOption: document.getElementById("customScaleOption"),
previous: document.getElementById("previous"),
next: document.getElementById("next"),
zoomIn: document.getElementById("zoomIn"),
zoomOut: document.getElementById("zoomOut"),
print: document.getElementById("print"),
editorFreeTextButton: document.getElementById("editorFreeText"),
zoomIn: document.getElementById("zoomInButton"),
zoomOut: document.getElementById("zoomOutButton"),
print: document.getElementById("printButton"),
editorFreeTextButton: document.getElementById("editorFreeTextButton"),
editorFreeTextParamsToolbar: document.getElementById(
"editorFreeTextParamsToolbar"
),
editorHighlightButton: document.getElementById("editorHighlight"),
editorHighlightButton: document.getElementById("editorHighlightButton"),
editorHighlightParamsToolbar: document.getElementById(
"editorHighlightParamsToolbar"
),
editorHighlightColorPicker: document.getElementById(
"editorHighlightColorPicker"
),
editorInkButton: document.getElementById("editorInk"),
editorInkButton: document.getElementById("editorInkButton"),
editorInkParamsToolbar: document.getElementById("editorInkParamsToolbar"),
editorStampButton: document.getElementById("editorStamp"),
editorStampButton: document.getElementById("editorStampButton"),
editorStampParamsToolbar: document.getElementById(
"editorStampParamsToolbar"
),
download: document.getElementById("download"),
download: document.getElementById("downloadButton"),
},
secondaryToolbar: {
toolbar: document.getElementById("secondaryToolbar"),
toggleButton: document.getElementById("secondaryToolbarToggle"),
toggleButton: document.getElementById("secondaryToolbarToggleButton"),
presentationModeButton: document.getElementById("presentationMode"),
openFileButton:
typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")
Expand Down Expand Up @@ -105,7 +105,7 @@ function getViewerConfiguration() {
// Divs (and sidebar button)
outerContainer: document.getElementById("outerContainer"),
sidebarContainer: document.getElementById("sidebarContainer"),
toggleButton: document.getElementById("sidebarToggle"),
toggleButton: document.getElementById("sidebarToggleButton"),
resizer: document.getElementById("sidebarResizer"),
// Buttons
thumbnailButton: document.getElementById("viewThumbnail"),
Expand All @@ -122,16 +122,16 @@ function getViewerConfiguration() {
},
findBar: {
bar: document.getElementById("findbar"),
toggleButton: document.getElementById("viewFind"),
toggleButton: document.getElementById("viewFindButton"),
findField: document.getElementById("findInput"),
highlightAllCheckbox: document.getElementById("findHighlightAll"),
caseSensitiveCheckbox: document.getElementById("findMatchCase"),
matchDiacriticsCheckbox: document.getElementById("findMatchDiacritics"),
entireWordCheckbox: document.getElementById("findEntireWord"),
findMsg: document.getElementById("findMsg"),
findResultsCount: document.getElementById("findResultsCount"),
findPreviousButton: document.getElementById("findPrevious"),
findNextButton: document.getElementById("findNext"),
findPreviousButton: document.getElementById("findPreviousButton"),
findNextButton: document.getElementById("findNextButton"),
},
passwordOverlay: {
dialog: document.getElementById("passwordDialog"),
Expand Down

0 comments on commit 19151fe

Please sign in to comment.