browser_boxmodel_edit-position-visible-position-change.js (1560B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Tests that the 'Edit Position' button is still visible after 7 // layout is changed. 8 // see bug 1398722 9 10 const TEST_URI = ` 11 <div id="mydiv" style="background:tomato; 12 position:absolute; 13 top:10px; 14 left:10px; 15 width:100px; 16 height:100px"> 17 `; 18 19 add_task(async function () { 20 await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); 21 const { inspector, boxmodel } = await openLayoutView(); 22 23 await selectNode("#mydiv", inspector); 24 let editPositionButton = boxmodel.document.querySelector( 25 ".layout-geometry-editor" 26 ); 27 28 ok( 29 isNodeVisible(editPositionButton), 30 "Edit Position button is visible initially" 31 ); 32 33 const positionLeftTextbox = boxmodel.document.querySelector( 34 ".boxmodel-editable[title=position-left]" 35 ); 36 ok(isNodeVisible(positionLeftTextbox), "Position-left edit box exists"); 37 38 info("Change the value of position-left and submit"); 39 const onUpdate = waitForUpdate(inspector); 40 EventUtils.synthesizeMouseAtCenter( 41 positionLeftTextbox, 42 {}, 43 boxmodel.document.defaultView 44 ); 45 EventUtils.synthesizeKey("8", {}, boxmodel.document.defaultView); 46 EventUtils.synthesizeKey("VK_RETURN", {}, boxmodel.document.defaultView); 47 48 await onUpdate; 49 editPositionButton = boxmodel.document.querySelector( 50 ".layout-geometry-editor" 51 ); 52 ok( 53 isNodeVisible(editPositionButton), 54 "Edit Position button is still visible after layout change" 55 ); 56 });