browser_name_and_description_domain.js (2062B)
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 // NOTE: These aren't testable easily because the NameAndDescription domain is 8 // required in order to instantiate an accessible task. So, we test only that 9 // the attributes are present in the cache as expected. 10 11 // CacheKey::Description, CacheDomain::NameAndDescription 12 addAccessibleTask( 13 `<div id="test" aria-description="test">test</div>`, 14 async function (browser, docAcc) { 15 let acc = findAccessibleChildByID(docAcc, "test"); 16 verifyAttributeCachedNoRetry(acc, "description"); 17 }, 18 { 19 topLevel: true, 20 iframe: true, 21 remoteIframe: true, 22 cacheDomains: CacheDomain.NameAndDescription, 23 } 24 ); 25 26 // CacheKey::HTMLPlaceholder, CacheDomain::NameAndDescription 27 addAccessibleTask( 28 `<input type="text" aria-label="label" id="test" placeholder="test"/>`, 29 async function (browser, docAcc) { 30 let acc = findAccessibleChildByID(docAcc, "test"); 31 verifyAttributeCachedNoRetry(acc, "placeholder"); 32 }, 33 { 34 topLevel: true, 35 iframe: true, 36 remoteIframe: true, 37 cacheDomains: CacheDomain.NameAndDescription, 38 } 39 ); 40 41 // CacheKey::Name, CacheDomain::NameAndDescription 42 addAccessibleTask( 43 `<div id="test" aria-label="name">test</div>`, 44 async function (browser, docAcc) { 45 let acc = findAccessibleChildByID(docAcc, "test"); 46 verifyAttributeCachedNoRetry(acc, "name"); 47 }, 48 { 49 topLevel: true, 50 iframe: true, 51 remoteIframe: true, 52 cacheDomains: CacheDomain.NameAndDescription, 53 } 54 ); 55 56 // CacheKey::NameValueFlag, CacheDomain::NameAndDescription 57 addAccessibleTask( 58 `<h3 id="test" aria-label="test me"><p>test</p></h3>`, 59 async function (browser, docAcc) { 60 let acc = findAccessibleChildByID(docAcc, "test"); 61 verifyAttributeCachedNoRetry(acc, "name"); 62 }, 63 { 64 topLevel: true, 65 iframe: true, 66 remoteIframe: true, 67 cacheDomains: CacheDomain.NameAndDescription, 68 } 69 );