browser_panelUINotifications_fullscreen.js (2230B)
1 "use strict"; 2 3 const { AppMenuNotifications } = ChromeUtils.importESModule( 4 "resource://gre/modules/AppMenuNotifications.sys.mjs" 5 ); 6 7 add_task(async function testFullscreen() { 8 is( 9 PanelUI.notificationPanel.state, 10 "closed", 11 "update-manual doorhanger is closed." 12 ); 13 let mainActionCalled = false; 14 let mainAction = { 15 callback: () => { 16 mainActionCalled = true; 17 }, 18 }; 19 AppMenuNotifications.showNotification("update-manual", mainAction); 20 21 isnot( 22 PanelUI.notificationPanel.state, 23 "closed", 24 "update-manual doorhanger is showing." 25 ); 26 let notifications = [...PanelUI.notificationPanel.children].filter( 27 n => !n.hidden 28 ); 29 is( 30 notifications.length, 31 1, 32 "PanelUI doorhanger is only displaying one notification." 33 ); 34 let doorhanger = notifications[0]; 35 is( 36 doorhanger.id, 37 "appMenu-update-manual-notification", 38 "PanelUI is displaying the update-manual notification." 39 ); 40 41 let popuphiddenPromise = BrowserTestUtils.waitForEvent( 42 PanelUI.notificationPanel, 43 "popuphidden" 44 ); 45 document.documentElement.focus(); 46 EventUtils.synthesizeKey("KEY_F11"); 47 await popuphiddenPromise; 48 await new Promise(executeSoon); 49 is( 50 PanelUI.notificationPanel.state, 51 "closed", 52 "update-manual doorhanger is closed." 53 ); 54 55 FullScreen.showNavToolbox(); 56 is( 57 PanelUI.menuButton.getAttribute("badge-status"), 58 "update-manual", 59 "Badge is displaying on PanelUI button." 60 ); 61 62 let popupshownPromise = BrowserTestUtils.waitForEvent( 63 PanelUI.notificationPanel, 64 "popupshown" 65 ); 66 EventUtils.synthesizeKey("KEY_F11"); 67 await popupshownPromise; 68 await new Promise(executeSoon); 69 isnot( 70 PanelUI.notificationPanel.state, 71 "closed", 72 "update-manual doorhanger is showing." 73 ); 74 isnot( 75 PanelUI.menuButton.getAttribute("badge-status"), 76 "update-manual", 77 "Badge is not displaying on PanelUI button." 78 ); 79 80 doorhanger.button.click(); 81 ok(mainActionCalled, "Main action callback was called"); 82 is( 83 PanelUI.notificationPanel.state, 84 "closed", 85 "update-manual doorhanger is closed." 86 ); 87 is( 88 PanelUI.menuButton.hasAttribute("badge-status"), 89 false, 90 "Should not have a badge status" 91 ); 92 });