@@ -21,27 +21,47 @@ test( "markup structure", function() {
21
21
} ) ;
22
22
23
23
test ( "accessibility" , function ( ) {
24
- expect ( 5 ) ;
24
+ expect ( 15 ) ;
25
25
26
- var tooltipId ,
27
- tooltip ,
28
- element = $ ( "#multiple-describedby " ) . tooltip ( ) ;
26
+ var tooltipId , tooltip ,
27
+ element = $ ( "#multiple-describedby" ) . tooltip ( ) ,
28
+ liveRegion = element . tooltip ( "instance " ) . liveRegion ;
29
29
30
+ equal ( liveRegion . find ( ">div" ) . length , 0 ) ;
31
+ equal ( liveRegion . attr ( "role" ) , "log" ) ;
32
+ equal ( liveRegion . attr ( "aria-live" ) , "assertive" ) ;
33
+ equal ( liveRegion . attr ( "aria-relevant" ) , "additions" ) ;
30
34
element . tooltip ( "open" ) ;
31
35
tooltipId = element . data ( "ui-tooltip-id" ) ;
32
36
tooltip = $ ( "#" + tooltipId ) ;
33
37
equal ( tooltip . attr ( "role" ) , "tooltip" , "role" ) ;
34
38
equal ( element . attr ( "aria-describedby" ) , "fixture-span " + tooltipId ,
35
39
"multiple describedby when open" ) ;
40
+
36
41
// strictEqual to distinguish between .removeAttr( "title" ) and .attr( "title", "" )
37
42
// support: jQuery <1.6.2
38
43
// support: IE <8
39
44
// We should use strictEqual( ..., undefined ) when dropping jQuery 1.6.1 support (or IE6/7)
40
45
ok ( ! element . attr ( "title" ) , "no title when open" ) ;
46
+ equal ( liveRegion . children ( ) . length , 1 ) ;
47
+ equal ( liveRegion . children ( ) . last ( ) . html ( ) , "..." ) ;
41
48
element . tooltip ( "close" ) ;
42
49
equal ( element . attr ( "aria-describedby" ) , "fixture-span" ,
43
50
"correct describedby when closed" ) ;
44
51
equal ( element . attr ( "title" ) , "..." , "title restored when closed" ) ;
52
+
53
+ element . tooltip ( "open" ) ;
54
+ equal ( liveRegion . children ( ) . length , 2 ,
55
+ "After the second tooltip show, there should be two children" ) ;
56
+ equal ( liveRegion . children ( ) . filter ( ":visible" ) . length , 1 ,
57
+ "Only one of the children should be visible" ) ;
58
+ ok ( liveRegion . children ( ) . last ( ) . is ( ":visible" ) ,
59
+ "Only the last child should be visible" ) ;
60
+ element . tooltip ( "close" ) ;
61
+
62
+ element . tooltip ( "destroy" ) ;
63
+ equal ( liveRegion . parent ( ) . length , 0 ,
64
+ "Tooltip liveregion element should be removed" ) ;
45
65
} ) ;
46
66
47
67
test ( "delegated removal" , function ( ) {
0 commit comments