-
Notifications
You must be signed in to change notification settings - Fork 0
/
timing_tests.js
51 lines (45 loc) · 1.53 KB
/
timing_tests.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// These are the different permutations of ARIA attributes to try.
var attrs = [
'aria-live="polite" aria-relevant="text additions" (default)'];
build();
var live_region_counter = 0;
addTests(
'text',
'set focus to link 1, then modify live region.',
'<div ARIA-ATTRS></div>' +
'<div><a id="f1" href="#" tabindex="-1">Link 1</a></div>',
function(region) {
document.getElementById('f1').focus();
region.innerHTML = 'Live region succeeded ' + (++live_region_counter);
});
addTests(
'text',
'modify live region, then set focus to link 2.',
'<div ARIA-ATTRS></div>' +
'<div><a id="f2" href="#" tabindex="-1ZZ">Link 2</a></div>',
function(region) {
region.innerHTML = 'Live region succeeded ' + (++live_region_counter);
document.getElementById('f2').focus();
});
addTests(
'text',
'set focus to link 3, then modify live region after delay.',
'<div ARIA-ATTRS></div>' +
'<div><a id="f3" href="#">Link 3</a></div>',
function(region) {
document.getElementById('f3').focus();
setTimeout(function() {
region.innerHTML = 'Live region succeeded ' + (++live_region_counter);
}, 150);
});
addTests(
'text',
'modify live region, then set focus to link 4 after delay.',
'<div ARIA-ATTRS></div>' +
'<div><a id="f4" href="#">Link 4</a></div>',
function(region) {
region.innerHTML = 'Live region succeeded ' + (++live_region_counter);
setTimeout(function() {
document.getElementById('f4').focus();
}, 150);
});