browser_inspector_search-label.js (1302B)
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 that search label updated correctly based on the search result. 8 9 const TEST_URL = URL_ROOT + "doc_inspector_search.html"; 10 11 add_task(async function () { 12 const { inspector } = await openInspectorForURL(TEST_URL); 13 const { searchResultsLabel } = inspector; 14 15 info("Searching for test node #d1"); 16 await searchInMarkupView(inspector, "#d1"); 17 is(searchResultsLabel.textContent, "1 of 1"); 18 19 info(`Searching for word visible in element attribute and in text node`); 20 await searchInMarkupView(inspector, "blah"); 21 is(searchResultsLabel.textContent, "1 of 2"); 22 23 info( 24 `Searching for word visible in element attribute and its inlined text node` 25 ); 26 await searchInMarkupView(inspector, "yo"); 27 is(searchResultsLabel.textContent, "1 of 1"); 28 29 info("Click the clear button"); 30 // Expect the label is cleared after clicking the clear button. 31 32 inspector.searchClearButton.click(); 33 is(searchResultsLabel.textContent, ""); 34 35 // Catch-all event for remaining server requests when searching for the new 36 // node. 37 await inspector.once("inspector-updated"); 38 });