@@ -6,16 +6,6 @@ import axe from 'axe-core'
6
6
import { FeatureFlags } from '../FeatureFlags'
7
7
8
8
describe ( 'ProgressBar' , ( ) => {
9
- const mockWarningFn = jest . fn ( )
10
-
11
- beforeEach ( ( ) => {
12
- jest . spyOn ( global . console , 'warn' ) . mockImplementation ( mockWarningFn )
13
- } )
14
-
15
- afterEach ( ( ) => {
16
- jest . clearAllMocks ( )
17
- } )
18
-
19
9
behavesAsComponent ( {
20
10
Component : ProgressBar ,
21
11
toRender : ( ) => < ProgressBar aria-label = "Upload test.png" aria-valuenow = { 10 } progress = { 0 } /> ,
@@ -123,18 +113,30 @@ describe('ProgressBar', () => {
123
113
expect ( getByRole ( 'progressbar' ) ) . toHaveAttribute ( 'aria-valuenow' , '0' )
124
114
} )
125
115
126
- it ( 'should warn users if aria-label is not provided' , ( ) => {
127
- HTMLRender ( < ProgressBar . Item progress = { 50 } /> )
128
- expect ( mockWarningFn ) . toHaveBeenCalled ( )
129
- } )
116
+ describe ( 'console.warn' , ( ) => {
117
+ const mockWarningFn = jest . fn ( )
130
118
131
- it ( 'should not warn users if aria-label is not provided but aria-hidden is' , ( ) => {
132
- HTMLRender ( < ProgressBar . Item progress = { 50 } aria-hidden = { true } /> )
133
- expect ( mockWarningFn ) . not . toHaveBeenCalled ( )
134
- } )
119
+ beforeEach ( ( ) => {
120
+ jest . spyOn ( global . console , 'warn' ) . mockImplementation ( mockWarningFn )
121
+ } )
122
+
123
+ afterEach ( ( ) => {
124
+ jest . clearAllMocks ( )
125
+ } )
126
+
127
+ it ( 'should warn users if aria-label is not provided' , ( ) => {
128
+ HTMLRender ( < ProgressBar . Item progress = { 50 } /> )
129
+ expect ( mockWarningFn ) . toHaveBeenCalled ( )
130
+ } )
131
+
132
+ it ( 'should not warn users if aria-label is not provided but aria-hidden is' , ( ) => {
133
+ HTMLRender ( < ProgressBar . Item progress = { 50 } aria-hidden = { true } /> )
134
+ expect ( mockWarningFn ) . not . toHaveBeenCalled ( )
135
+ } )
135
136
136
- it ( 'should not warn users if aria-label is provided' , ( ) => {
137
- HTMLRender ( < ProgressBar . Item progress = { 50 } aria-label = "Uploading test.png" /> )
138
- expect ( mockWarningFn ) . not . toHaveBeenCalled ( )
137
+ it ( 'should not warn users if aria-label is provided' , ( ) => {
138
+ HTMLRender ( < ProgressBar . Item progress = { 50 } aria-label = "Uploading test.png" /> )
139
+ expect ( mockWarningFn ) . not . toHaveBeenCalled ( )
140
+ } )
139
141
} )
140
142
} )
0 commit comments