browser_inspector_picker-stop-on-eyedropper.js (1416B)
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 "use strict"; 5 6 // Test that the highlighter's picker is stopped when the eyedropper tool is 7 // selected 8 9 const TEST_URI = 10 "data:text/html;charset=UTF-8," + 11 "testing the highlighter goes away on eyedropper selection"; 12 13 add_task(async function () { 14 const { toolbox } = await openInspectorForURL(TEST_URI); 15 const pickerStopped = toolbox.nodePicker.once("picker-stopped"); 16 const eyeDropperButtonClasses = 17 toolbox.getPanel("inspector").eyeDropperButton.classList; 18 19 const eyeDropperStopped = waitFor( 20 () => !eyeDropperButtonClasses.contains("checked") 21 ); 22 23 info("Starting the inspector picker"); 24 await startPicker(toolbox); 25 26 info("Starting the eyedropper tool"); 27 await startEyeDropper(toolbox); 28 29 ok(eyeDropperButtonClasses.contains("checked"), "eyedropper is started"); 30 31 info("Waiting for the picker-stopped event to be fired"); 32 await pickerStopped; 33 34 ok( 35 true, 36 "picker-stopped event fired after eyedropper is selected; picker is closed" 37 ); 38 39 info("Starting the inspector picker again"); 40 await startPicker(toolbox); 41 42 info("Checking if eyedropper is stopped"); 43 await eyeDropperStopped; 44 45 ok(true, "eyedropper stopped after node picker; eyedropper is closed"); 46 });