browser_groupPosition.js (1779B)
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 /** 8 * Test exposure of group position information. 9 */ 10 addAccessibleTask( 11 ` 12 <ul> 13 <li id="li1">li1<ul> 14 <li id="li1a">li1a</li> 15 </ul></li> 16 <li id="li2">li2</li> 17 </ul> 18 <h2 id="h2">h2</h2> 19 <button id="button">button</button> 20 `, 21 async function testGroupPosition() { 22 let attrs = await runPython(` 23 global doc 24 doc = getDoc() 25 return findByDomId(doc, "li1").get_attributes() 26 `); 27 is(attrs.posinset, "1", "li1 has correct posinset"); 28 is(attrs.setsize, "2", "li1 has correct setsize"); 29 is(attrs.level, "1", "li1 has correct level"); 30 31 attrs = await runPython(`findByDomId(doc, "li1a").get_attributes()`); 32 is(attrs.posinset, "1", "li1a has correct posinset"); 33 is(attrs.setsize, "1", "li1a has correct setsize"); 34 is(attrs.level, "2", "li1a has correct level"); 35 36 attrs = await runPython(`findByDomId(doc, "li2").get_attributes()`); 37 is(attrs.posinset, "2", "li2 has correct posinset"); 38 is(attrs.setsize, "2", "li2 has correct setsize"); 39 is(attrs.level, "1", "li2 has correct level"); 40 41 attrs = await runPython(`findByDomId(doc, "h2").get_attributes()`); 42 ok(!("posinset" in attrs), "h2 doesn't have posinset"); 43 ok(!("setsize" in attrs), "h2 doesn't have setsize"); 44 is(attrs.level, "2", "h2 has correct level"); 45 46 attrs = await runPython(`findByDomId(doc, "button").get_attributes()`); 47 ok(!("posinset" in attrs), "button doesn't have posinset"); 48 ok(!("setsize" in attrs), "button doesn't have setsize"); 49 ok(!("level" in attrs), "h2 doesn't have level"); 50 } 51 );