browser_styleeditor_missing_stylesheet.js (1418B)
1 "use strict"; 2 /* Any copyright is dedicated to the Public Domain. 3 http://creativecommons.org/publicdomain/zero/1.0/ */ 4 5 // Checks that the style editor manages to finalize its stylesheet loading phase 6 // even if one stylesheet is missing, and that an error message is displayed. 7 8 const TESTCASE_URI = TEST_BASE + "missing.html"; 9 10 add_task(async function () { 11 const { ui, toolbox, panel } = await openStyleEditorForURL(TESTCASE_URI); 12 13 // Note that we're not testing for a specific number of stylesheet editors 14 // below because the test-page is loaded with chrome:// URL and, right now, 15 // that means UA stylesheets are shown. So we avoid hardcoding the number of 16 // stylesheets here. 17 await waitUntil(() => ui.editors.length); 18 ok(true, "The UI contains style sheets."); 19 20 const rootEl = panel.panelWindow.document.getElementById( 21 "style-editor-chrome" 22 ); 23 ok(!rootEl.classList.contains("loading"), "The loading indicator is hidden"); 24 25 const notifBox = toolbox.getNotificationBox(); 26 await waitUntil(() => notifBox.getCurrentNotification()); 27 const notif = notifBox.getCurrentNotification(); 28 ok(notif, "The notification box contains a message"); 29 ok( 30 notif.label.includes("Style sheet could not be loaded"), 31 "The error message is the correct one" 32 ); 33 ok( 34 notif.label.includes("missing-stylesheet.css"), 35 "The error message contains the missing stylesheet's URL" 36 ); 37 });