browser_atspi_interfaces.js (1865B)
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 addAccessibleTask( 8 ` 9 <p id="p">p</p> 10 <a href="https://example.com" id="link">a</a> 11 <input id="range_input" type="range" min="0" max="10" value="8"> 12 <input id="text_input" type="text" value="hello"> 13 <button id="button">hello</button>`, 14 async function testInterfaces() { 15 await runPython(` 16 global doc 17 doc = getDoc() 18 `); 19 20 async function checkInterfaces(id, expectedInterfaces) { 21 let interfaces = await runPython(` 22 return findByDomId(doc, "${id}").get_interfaces() 23 `); 24 25 Assert.deepEqual( 26 expectedInterfaces.slice().sort(), 27 interfaces.sort(), 28 `Correct interfaces for "${id}"` 29 ); 30 } 31 32 await checkInterfaces("p", [ 33 "Accessible", 34 "Action", 35 "Collection", 36 "Component", 37 "EditableText", 38 "Hyperlink", 39 "Hypertext", 40 "Text", 41 ]); 42 await checkInterfaces("link", [ 43 "Accessible", 44 "Action", 45 "Collection", 46 "Component", 47 "EditableText", 48 "Hyperlink", 49 "Hypertext", 50 "Text", 51 ]); 52 await checkInterfaces("range_input", [ 53 "Accessible", 54 "Action", 55 "Collection", 56 "Component", 57 "Hyperlink", 58 "Value", 59 ]); 60 await checkInterfaces("text_input", [ 61 "Accessible", 62 "Action", 63 "Collection", 64 "Component", 65 "EditableText", 66 "Hyperlink", 67 "Hypertext", 68 "Text", 69 ]); 70 await checkInterfaces("button", [ 71 "Accessible", 72 "Action", 73 "Collection", 74 "Component", 75 "EditableText", 76 "Hyperlink", 77 "Hypertext", 78 "Text", 79 ]); 80 }, 81 { chrome: true, topLevel: true } 82 );