browser_accessibility_panel_audit_oop.js (2543B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 /* global toggleMenuItem, TREE_FILTERS_MENU_ID */ 7 8 const TEST_URI = `<html> 9 <head> 10 <meta charset="utf-8"/> 11 <title>Accessibility Panel Test</title> 12 </head> 13 <body> 14 <h1 style="color:rgba(255,0,0,0.1); background-color:rgba(255,255,255,1);"> 15 Top level header 16 </h1> 17 </body> 18 </html>`; 19 20 /** 21 * Test data has the format of: 22 * { 23 * desc {String} description for better logging 24 * setup {Function} An optional setup that needs to be performed before 25 * the state of the tree and the sidebar can be checked. 26 * expected {JSON} An expected states for the tree and the sidebar. 27 * } 28 */ 29 const tests = [ 30 { 31 desc: "Initial state.", 32 expected: { 33 tree: [ 34 { 35 role: "document", 36 name: `""text label`, 37 badges: ["text label"], 38 level: 1, 39 }, 40 ], 41 }, 42 }, 43 { 44 desc: "Click on the Check for issues - all.", 45 setup: async ({ doc, toolbox }) => { 46 await toggleMenuItem(doc, toolbox.doc, TREE_FILTERS_MENU_ID, 1); 47 }, 48 expected: { 49 tree: [ 50 { 51 role: "document", 52 name: `""text label`, 53 badges: ["text label"], 54 level: 1, 55 }, 56 { 57 role: "text leaf", 58 name: `"Top level header "contrast`, 59 badges: ["contrast"], 60 level: 1, 61 }, 62 ], 63 }, 64 }, 65 { 66 desc: "Click on the Check for issues - all again.", 67 setup: async ({ doc, toolbox }) => { 68 await toggleMenuItem(doc, toolbox.doc, TREE_FILTERS_MENU_ID, 1); 69 }, 70 expected: { 71 tree: [ 72 { 73 role: "document", 74 name: `""text label`, 75 badges: ["text label"], 76 level: 1, 77 }, 78 { 79 role: "internal frame", 80 name: `"Accessibility Panel Test (OOP)"`, 81 level: 2, 82 }, 83 { 84 role: "document", 85 name: `"Accessibility Panel Test (OOP)"`, 86 level: 3, 87 }, 88 { 89 role: "heading", 90 name: `"Top level header"`, 91 level: 4, 92 }, 93 { 94 role: "text leaf", 95 name: `"Top level header "contrast`, 96 badges: ["contrast"], 97 level: 5, 98 }, 99 ], 100 }, 101 }, 102 ]; 103 104 addA11yPanelTestsTask( 105 tests, 106 TEST_URI, 107 "Test Accessibility panel tree audit on a page with an OOP document.", 108 { remoteIframe: true } 109 );