browser_inspector_infobar_04.js (1571B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 // Check the position and text content of the highlighter nodeinfo bar under page zoom. 8 9 const TEST_URI = URL_ROOT + "doc_inspector_infobar_01.html"; 10 11 add_task(async function () { 12 const { inspector, highlighterTestFront } = 13 await openInspectorForURL(TEST_URI); 14 const testData = { 15 selector: "#top", 16 dims: "500" + " \u00D7 " + "100", 17 }; 18 19 await testInfobar(testData, inspector, highlighterTestFront); 20 info("Change zoom page to level 2."); 21 setContentPageZoomLevel(2); 22 info("Testing again the infobar after zoom."); 23 await testInfobar(testData, inspector, highlighterTestFront); 24 }); 25 26 async function testInfobar(test, inspector, highlighterTestFront) { 27 info(`Testing ${test.selector}`); 28 // First, hide any existing box model highlighter. Duplicate calls to show are ignored. 29 await inspector.highlighters.hideHighlighterType( 30 inspector.highlighters.TYPES.BOXMODEL 31 ); 32 await selectAndHighlightNode(test.selector, inspector); 33 34 // Ensure the node is the correct one. 35 const id = await highlighterTestFront.getHighlighterNodeTextContent( 36 "box-model-infobar-id" 37 ); 38 is(id, test.selector, `Node ${test.selector} selected.`); 39 40 const dims = await highlighterTestFront.getHighlighterNodeTextContent( 41 "box-model-infobar-dimensions" 42 ); 43 is(dims, test.dims, "Node's infobar displays the right dimensions."); 44 }