Bug 1331795: pdfjs test, switch selector to use page number attribute
MozReview-Commit-ID: OcTp2EOMc5
--- a/browser/extensions/pdfjs/test/browser_pdfjs_zoom.js
+++ b/browser/extensions/pdfjs/test/browser_pdfjs_zoom.js
@@ -93,17 +93,17 @@ add_task(function* test() {
}
// check that PDF is opened with internal viewer
Assert.ok(content.document.querySelector("div#viewer"), "document content has viewer UI");
Assert.ok("PDFJS" in content.wrappedJSObject, "window content has PDFJS object");
let initialWidth, previousWidth;
initialWidth = previousWidth =
- parseInt(content.document.querySelector("div#pageContainer1").style.width);
+ parseInt(content.document.querySelector('div.page[data-page-number="1"]').style.width);
for (let test of TESTS) {
// We zoom using an UI element
var ev;
if (test.action.selector) {
// Get the element and trigger the action for changing the zoom
var el = document.querySelector(test.action.selector);
Assert.ok(el, "Element '" + test.action.selector + "' has been found");
@@ -128,17 +128,17 @@ add_task(function* test() {
el.dispatchEvent(ev);
yield waitForRender();
var pageZoomScale = content.document.querySelector('select#scaleSelect');
// The zoom value displayed in the zoom select
var zoomValue = pageZoomScale.options[pageZoomScale.selectedIndex].innerHTML;
- let pageContainer = content.document.querySelector('div#pageContainer1');
+ let pageContainer = content.document.querySelector('div.page[data-page-number="1"]');
let actualWidth = parseInt(pageContainer.style.width);
// the actual zoom of the PDF document
let computedZoomValue = parseInt(((actualWidth/initialWidth).toFixed(2))*100) + "%";
Assert.equal(computedZoomValue, zoomValue, "Content has correct zoom");
// Check that document zooms in the expected way (in/out)
let zoom = (actualWidth - previousWidth) * test.expectedZoom;