browser_relations_domain_1.js (2429B)
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 // CacheKey::DOMName, CacheDomain::Relations 8 addAccessibleTask( 9 `<input id="test" type="radio" name="test"/>`, 10 async function (browser, docAcc) { 11 let acc = findAccessibleChildByID(docAcc, "test"); 12 await testAttributeCachePresence(acc, "attributeName", () => { 13 acc.getRelationByType(0); 14 }); 15 }, 16 { 17 topLevel: true, 18 iframe: true, 19 remoteIframe: true, 20 cacheDomains: CacheDomain.None, 21 } 22 ); 23 24 // The following tests are for cache keys that are actually relation keys. 25 // They don't have a CacheKey:: prefix but are cached nonetheless. We don't 26 // test reverse relations here since they're not stored in the cache. 27 28 // RelationType::LABELLEDBY, CacheDomain::Relations 29 addAccessibleTask( 30 ` 31 <button aria-labelledby="label" id="labelled">test</button> 32 <label id="label">button label</label> 33 `, 34 async function (browser, docAcc) { 35 let acc = findAccessibleChildByID(docAcc, "labelled"); 36 await testAttributeCachePresence(acc, "labelledby", () => { 37 acc.getRelationByType(0); 38 }); 39 }, 40 { 41 topLevel: true, 42 iframe: true, 43 remoteIframe: true, 44 cacheDomains: CacheDomain.None, 45 } 46 ); 47 48 // RelationType::LABEL_FOR, CacheDomain::Relations 49 addAccessibleTask( 50 ` 51 <button id="button">test</button> 52 <label for="button" id="label">button label</label> 53 `, 54 async function (browser, docAcc) { 55 let acc = findAccessibleChildByID(docAcc, "label"); 56 await testAttributeCachePresence(acc, "for", () => { 57 acc.getRelationByType(0); 58 }); 59 }, 60 { 61 topLevel: true, 62 iframe: true, 63 remoteIframe: true, 64 cacheDomains: CacheDomain.None, 65 } 66 ); 67 68 // RelationType::CONTROLLER_FOR, CacheDomain::Relations 69 addAccessibleTask( 70 ` 71 <button aria-controls="controlled" id="controller">test</button> 72 <div id="controlled">test</div> 73 `, 74 async function (browser, docAcc) { 75 let acc = findAccessibleChildByID(docAcc, "controller"); 76 await testAttributeCachePresence(acc, "controls", () => { 77 acc.getRelationByType(0); 78 }); 79 }, 80 { 81 topLevel: true, 82 iframe: true, 83 remoteIframe: true, 84 cacheDomains: CacheDomain.None, 85 } 86 ); 87 88 // Continued in browser_relations_domain_2.js. 89 // Split up to avoid timeouts in test-verify.