@@ -64,11 +64,13 @@ describe('TagGroup', function () {
64
64
65
65
it ( 'provides context for Tag component' , function ( ) {
66
66
let { getAllByRole} = render (
67
- < TagGroup aria-label = "tag group" allowsRemoving onRemove = { onRemoveSpy } >
68
- < Item aria-label = "Tag 1" > Tag 1</ Item >
69
- < Item aria-label = "Tag 2" > Tag 2</ Item >
70
- < Item aria-label = "Tag 3" > Tag 3</ Item >
71
- </ TagGroup >
67
+ < Provider theme = { theme } >
68
+ < TagGroup aria-label = "tag group" allowsRemoving onRemove = { onRemoveSpy } >
69
+ < Item aria-label = "Tag 1" > Tag 1</ Item >
70
+ < Item aria-label = "Tag 2" > Tag 2</ Item >
71
+ < Item aria-label = "Tag 3" > Tag 3</ Item >
72
+ </ TagGroup >
73
+ </ Provider >
72
74
) ;
73
75
74
76
let tags = getAllByRole ( 'row' ) ;
@@ -81,10 +83,12 @@ describe('TagGroup', function () {
81
83
82
84
it ( 'has correct accessibility roles' , ( ) => {
83
85
let { getByRole, getAllByRole} = render (
84
- < TagGroup
85
- aria-label = "tag group" >
86
- < Item aria-label = "Tag 1" > Tag 1</ Item >
87
- </ TagGroup >
86
+ < Provider theme = { theme } >
87
+ < TagGroup
88
+ aria-label = "tag group" >
89
+ < Item aria-label = "Tag 1" > Tag 1</ Item >
90
+ </ TagGroup >
91
+ </ Provider >
88
92
) ;
89
93
90
94
let tagGroup = getByRole ( 'grid' ) ;
@@ -96,10 +100,12 @@ describe('TagGroup', function () {
96
100
97
101
it ( 'has correct tab index' , ( ) => {
98
102
let { getAllByRole} = render (
99
- < TagGroup
100
- aria-label = "tag group" >
101
- < Item aria-label = "Tag 1" > Tag 1</ Item >
102
- </ TagGroup >
103
+ < Provider theme = { theme } >
104
+ < TagGroup
105
+ aria-label = "tag group" >
106
+ < Item aria-label = "Tag 1" > Tag 1</ Item >
107
+ </ TagGroup >
108
+ </ Provider >
103
109
) ;
104
110
105
111
let tags = getAllByRole ( 'row' ) ;
@@ -132,9 +138,11 @@ describe('TagGroup', function () {
132
138
133
139
it ( 'TagGroup allows aria-label' , function ( ) {
134
140
let { getByRole} = render (
135
- < TagGroup aria-label = "tag group" >
136
- < Item key = "1" aria-label = "Tag 1" > Tag 1</ Item >
137
- </ TagGroup >
141
+ < Provider theme = { theme } >
142
+ < TagGroup aria-label = "tag group" >
143
+ < Item key = "1" aria-label = "Tag 1" > Tag 1</ Item >
144
+ </ TagGroup >
145
+ </ Provider >
138
146
) ;
139
147
140
148
let tagGroup = getByRole ( 'grid' ) ;
@@ -143,9 +151,11 @@ describe('TagGroup', function () {
143
151
144
152
it ( 'TagGroup allows aria-labelledby' , function ( ) {
145
153
let { getByRole} = render (
146
- < TagGroup aria-labelledby = "tag group" >
147
- < Item key = "1" aria-label = "Tag 1" > Tag 1</ Item >
148
- </ TagGroup >
154
+ < Provider theme = { theme } >
155
+ < TagGroup aria-labelledby = "tag group" >
156
+ < Item key = "1" aria-label = "Tag 1" > Tag 1</ Item >
157
+ </ TagGroup >
158
+ </ Provider >
149
159
) ;
150
160
151
161
let tagGroup = getByRole ( 'grid' ) ;
@@ -154,11 +164,13 @@ describe('TagGroup', function () {
154
164
155
165
it ( 'TagGroup allows aria-label on Item' , function ( ) {
156
166
let { getByRole} = render (
157
- < TagGroup aria-label = "tag group" >
158
- < Item key = "1" aria-label = "Tag 1" > Tag 1</ Item >
159
- < Item key = "2" aria-label = "Tag 2" > Tag 2</ Item >
160
- < Item key = "3" aria-label = "Tag 3" > Tag 3</ Item >
161
- </ TagGroup >
167
+ < Provider theme = { theme } >
168
+ < TagGroup aria-label = "tag group" >
169
+ < Item key = "1" aria-label = "Tag 1" > Tag 1</ Item >
170
+ < Item key = "2" aria-label = "Tag 2" > Tag 2</ Item >
171
+ < Item key = "3" aria-label = "Tag 3" > Tag 3</ Item >
172
+ </ TagGroup >
173
+ </ Provider >
162
174
) ;
163
175
164
176
let tagGroup = getByRole ( 'grid' ) ;
@@ -481,7 +493,7 @@ describe('TagGroup', function () {
481
493
. mockImplementationOnce ( ( ) => ( { x : 200 , y : 400 , width : 95 , height : 32 , top : 400 , right : 290 , bottom : 435 , left : 200 } ) )
482
494
. mockImplementationOnce ( ( ) => ( { x : 200 , y : 300 , width : 200 , height : 128 , top : 300 , right : 400 , bottom : 435 , left : 200 } ) )
483
495
. mockImplementationOnce ( ( ) => ( { x : 265 , y : 335 , width : 75 , height : 32 , top : 335 , right : 345 , bottom : 370 , left : 265 } ) ) ;
484
- let computedStyles = jest . spyOn ( window , 'getComputedStyle' ) . mockImplementation ( ( ) => ( { marginRight : '4px' , marginTop : '4px' , height : '24px' } ) ) ;
496
+ let computedStyles = jest . spyOn ( window , 'getComputedStyle' ) . mockImplementation ( ( ) => ( { marginRight : '4px' } ) ) ;
485
497
486
498
let { getAllByRole, getByRole} = render (
487
499
< Provider theme = { theme } >
@@ -524,7 +536,7 @@ describe('TagGroup', function () {
524
536
. mockImplementationOnce ( ( ) => ( { x : 200 , y : 335 , width : 65 , height : 32 , top : 335 , right : 265 , bottom : 370 , left : 200 } ) )
525
537
. mockImplementationOnce ( ( ) => ( { x : 265 , y : 335 , width : 75 , height : 32 , top : 335 , right : 345 , bottom : 370 , left : 265 } ) )
526
538
. mockImplementationOnce ( ( ) => ( { x : 200 , y : 370 , width : 120 , height : 32 , top : 370 , right : 320 , bottom : 400 , left : 200 } ) ) ;
527
- let computedStyles = jest . spyOn ( window , 'getComputedStyle' ) . mockImplementation ( ( ) => ( { marginRight : '4px' , marginTop : '4px' , height : '24px' } ) ) ;
539
+ let computedStyles = jest . spyOn ( window , 'getComputedStyle' ) . mockImplementation ( ( ) => ( { marginRight : '4px' } ) ) ;
528
540
let { getAllByRole, queryAllByRole} = render (
529
541
< Provider theme = { theme } >
530
542
< TagGroup maxRows = { 2 } aria-label = "tag group" >
@@ -556,7 +568,7 @@ describe('TagGroup', function () {
556
568
} ;
557
569
}
558
570
] ;
559
- let computedStyles = jest . spyOn ( window , 'getComputedStyle' ) . mockImplementation ( ( ) => ( { marginRight : '4px' , marginTop : '4px' , height : '24px' } ) ) ;
571
+ let computedStyles = jest . spyOn ( window , 'getComputedStyle' ) . mockImplementation ( ( ) => ( { marginRight : '4px' } ) ) ;
560
572
mockImplementation ( target , mockCalls , true ) ;
561
573
let { getAllByRole, getByRole} = render (
562
574
< Provider theme = { theme } >
@@ -615,7 +627,7 @@ describe('TagGroup', function () {
615
627
. mockImplementationOnce ( ( ) => ( { x : 200 , y : 300 , width : 200 , height : 128 , top : 300 , right : 400 , bottom : 435 , left : 200 } ) )
616
628
. mockImplementationOnce ( ( ) => ( { x : 265 , y : 335 , width : 75 , height : 32 , top : 335 , right : 345 , bottom : 370 , left : 265 } ) )
617
629
. mockImplementationOnce ( ( ) => ( { x : 200 , y : 300 , width : 75 , height : 32 , top : 300 , right : 275 , bottom : 335 , left : 200 } ) ) ;
618
- let computedStyles = jest . spyOn ( window , 'getComputedStyle' ) . mockImplementation ( ( ) => ( { marginRight : '4px' , marginTop : '4px' , height : '24px' } ) ) ;
630
+ let computedStyles = jest . spyOn ( window , 'getComputedStyle' ) . mockImplementation ( ( ) => ( { marginRight : '4px' } ) ) ;
619
631
let { getAllByRole} = render (
620
632
< Provider theme = { theme } >
621
633
< TagGroup
@@ -672,7 +684,7 @@ describe('TagGroup', function () {
672
684
} ) ;
673
685
674
686
it ( 'action group is labelled correctly' , function ( ) {
675
- let computedStyles = jest . spyOn ( window , 'getComputedStyle' ) . mockImplementation ( ( ) => ( { marginRight : '4px' , marginTop : '4px' , height : '24px' } ) ) ;
687
+ let computedStyles = jest . spyOn ( window , 'getComputedStyle' ) . mockImplementation ( ( ) => ( { marginRight : '4px' } ) ) ;
676
688
677
689
let { getByRole} = render (
678
690
< Provider theme = { theme } >
@@ -710,7 +722,7 @@ describe('TagGroup', function () {
710
722
} ) ;
711
723
712
724
it ( 'should allow you to tab into TagGroup if empty with link' , async function ( ) {
713
- let computedStyles = jest . spyOn ( window , 'getComputedStyle' ) . mockImplementation ( ( ) => ( { marginRight : '4px' , marginTop : '4px' , height : '24px' } ) ) ;
725
+ let computedStyles = jest . spyOn ( window , 'getComputedStyle' ) . mockImplementation ( ( ) => ( { marginRight : '4px' } ) ) ;
714
726
715
727
let renderEmptyState = ( ) => (
716
728
< span > No tags. < Link > < a href = "//react-spectrum.com" > Click here</ a > </ Link > to add some.</ span >
0 commit comments