@@ -27,13 +27,30 @@ test('style attribute bindings are added by string syntax',
27
27
( { get } ) => get ( 'span' ) . should ( haveClasses ( [ 'foo' ] ) )
28
28
)
29
29
30
- test ( 'aria-pressed/checked attribute boolean values are cast to a true/false string' ,
30
+ test ( 'aria-pressed/checked/expanded/selected attribute boolean values are cast to a true/false string' ,
31
31
html `
32
32
< div x-data ="{ open: true } ">
33
33
< span x-bind:aria-pressed ="open "> </ span >
34
+ < span x-bind:aria-checked ="open "> </ span >
35
+ < span x-bind:aria-expanded ="open "> </ span >
36
+ < span x-bind:aria-selected ="open "> </ span >
37
+
38
+ < span x-bind:aria-pressed ="false "> </ span >
39
+ < span x-bind:aria-checked ="false "> </ span >
40
+ < span x-bind:aria-expanded ="false "> </ span >
41
+ < span x-bind:aria-selected ="false "> </ span >
34
42
</ div >
35
43
` ,
36
- ( { get } ) => get ( 'span' ) . should ( haveAttribute ( 'aria-pressed' , 'true' ) )
44
+ ( { get } ) => {
45
+ get ( 'span:nth-of-type(1)' ) . should ( haveAttribute ( 'aria-pressed' , 'true' ) )
46
+ get ( 'span:nth-of-type(2)' ) . should ( haveAttribute ( 'aria-checked' , 'true' ) )
47
+ get ( 'span:nth-of-type(3)' ) . should ( haveAttribute ( 'aria-expanded' , 'true' ) )
48
+ get ( 'span:nth-of-type(4)' ) . should ( haveAttribute ( 'aria-selected' , 'true' ) )
49
+ get ( 'span:nth-of-type(5)' ) . should ( haveAttribute ( 'aria-pressed' , 'false' ) )
50
+ get ( 'span:nth-of-type(6)' ) . should ( haveAttribute ( 'aria-checked' , 'false' ) )
51
+ get ( 'span:nth-of-type(7)' ) . should ( haveAttribute ( 'aria-expanded' , 'false' ) )
52
+ get ( 'span:nth-of-type(8)' ) . should ( haveAttribute ( 'aria-selected' , 'false' ) )
53
+ }
37
54
)
38
55
39
56
test ( 'non-boolean attributes set to null/undefined/false are removed from the element' ,
@@ -46,6 +63,10 @@ test('non-boolean attributes set to null/undefined/false are removed from the el
46
63
< span visible ="true " x-bind:visible ="null "> null</ span >
47
64
< span visible ="true " x-bind:visible ="false "> false</ span >
48
65
< span visible ="true " x-bind:visible ="undefined "> undefined</ span >
66
+
67
+ < span hidden ="true " x-bind:hidden ="null "> null</ span >
68
+ < span hidden ="true " x-bind:hidden ="false "> false</ span >
69
+ < span hidden ="true " x-bind:hidden ="undefined "> undefined</ span >
49
70
</ div >
50
71
` ,
51
72
( { get } ) => {
@@ -55,6 +76,9 @@ test('non-boolean attributes set to null/undefined/false are removed from the el
55
76
get ( 'span:nth-of-type(1)' ) . should ( notHaveAttribute ( 'visible' ) )
56
77
get ( 'span:nth-of-type(2)' ) . should ( notHaveAttribute ( 'visible' ) )
57
78
get ( 'span:nth-of-type(3)' ) . should ( notHaveAttribute ( 'visible' ) )
79
+ get ( 'span:nth-of-type(4)' ) . should ( notHaveAttribute ( 'hidden' ) )
80
+ get ( 'span:nth-of-type(5)' ) . should ( notHaveAttribute ( 'hidden' ) )
81
+ get ( 'span:nth-of-type(6)' ) . should ( notHaveAttribute ( 'hidden' ) )
58
82
}
59
83
)
60
84
0 commit comments