browser_inspector_infobar_03.js (1584B)
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 // Bug 1102269 - Make sure info-bar never gets outside of visible area after scrolling 8 9 const TEST_URI = URL_ROOT + "doc_inspector_infobar_03.html"; 10 11 add_task(async function () { 12 const { inspector, highlighterTestFront } = 13 await openInspectorForURL(TEST_URI); 14 15 const testData = { 16 selector: "body", 17 position: "overlap", 18 style: "position:fixed", 19 }; 20 21 await testPositionAndStyle(testData, inspector, highlighterTestFront); 22 }); 23 24 async function testPositionAndStyle(test, inspector, highlighterTestFront) { 25 info("Testing " + test.selector); 26 27 await selectAndHighlightNode(test.selector, inspector); 28 29 let style = await highlighterTestFront.getHighlighterNodeAttribute( 30 "box-model-infobar-container", 31 "style" 32 ); 33 34 is( 35 style.split(";")[0].trim(), 36 test.style, 37 "Infobar shows on top of the page when page isn't scrolled" 38 ); 39 40 info("Scroll down"); 41 SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => { 42 return new Promise(resolve => { 43 content.addEventListener("scroll", () => resolve(), { once: true }); 44 content.scrollTo({ top: 500 }); 45 }); 46 }); 47 48 style = await highlighterTestFront.getHighlighterNodeAttribute( 49 "box-model-infobar-container", 50 "style" 51 ); 52 53 is( 54 style.split(";")[0].trim(), 55 test.style, 56 "Infobar shows on top of the page even if the page is scrolled" 57 ); 58 }