browser_notification_box_basic.js (982B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 Services.scriptloader.loadSubScript( 7 "chrome://mochitests/content/browser/devtools/client/shared/test/shared-head.js", 8 this 9 ); 10 11 const TEST_URI = "data:text/html;charset=utf-8,Test page"; 12 13 /** 14 * Basic test that checks existence of the Notification box. 15 */ 16 add_task(async function () { 17 info("Test Notification box basic started"); 18 19 const toolbox = await openNewTabAndToolbox(TEST_URI, "webconsole"); 20 21 // Append a notification 22 const notificationBox = toolbox.getNotificationBox(); 23 notificationBox.appendNotification( 24 "Info message", 25 "id1", 26 null, 27 notificationBox.PRIORITY_INFO_HIGH 28 ); 29 30 // Verify existence of one notification. 31 const parentNode = toolbox.doc.getElementById("toolbox-notificationbox"); 32 const nodes = parentNode.querySelectorAll(".notification"); 33 is(nodes.length, 1, "There must be one notification"); 34 });