browser_rules_completion-popup-hidden-after-navigation.js (1278B)
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 ruleview autocomplete popup is hidden after page navigation. 7 8 const TEST_URI = "<h1 style='font: 24px serif'></h1>"; 9 10 add_task(async function () { 11 await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); 12 const { inspector, view } = await openRuleView(); 13 14 info("Test autocompletion popup is hidden after page navigation"); 15 16 info("Selecting the test node"); 17 await selectNode("h1", inspector); 18 19 info("Focusing the css property editable field"); 20 const propertyName = view.styleDocument.querySelectorAll( 21 ".ruleview-propertyname" 22 )[0]; 23 const editor = await focusEditableField(view, propertyName); 24 25 info("Pressing key VK_DOWN"); 26 const onSuggest = once(editor.input, "keypress"); 27 const onPopupOpened = once(editor.popup, "popup-opened"); 28 29 EventUtils.synthesizeKey("VK_DOWN", {}, view.styleWindow); 30 31 info("Waiting for autocomplete popup to be displayed"); 32 await onSuggest; 33 await onPopupOpened; 34 35 ok(view.popup && view.popup.isOpen, "Popup should be opened"); 36 37 info("Reloading the page"); 38 await reloadBrowser(); 39 40 ok(!(view.popup && view.popup.isOpen), "Popup should be closed"); 41 });