@@ -46,7 +46,7 @@ describe('Pager', () => {
46
46
expect ( indicators . length ) . toBe ( propsData . pages . length ) ;
47
47
} ) ;
48
48
49
- it ( 'collapses the controllers if contentWidth is smaller than the large contentWidth + the gutters width in large viewport' , ( ) => {
49
+ it ( 'collapses the controllers if contentWidth is smaller than the large contentWidth + the gutters width in large viewport' , async ( ) => {
50
50
// set large viewport
51
51
window . innerWidth = BreakpointAttributes . default . large . minWidth + 1 ;
52
52
const wrapper = shallowMount ( Pager , { propsData } ) ;
@@ -55,19 +55,21 @@ describe('Pager', () => {
55
55
contentWidth : BreakpointAttributes . default . large . contentWidth + GUTTERS_WIDTH + 10 ,
56
56
} ,
57
57
} ) ;
58
+ await wrapper . vm . $nextTick ( ) ;
58
59
59
- expect ( wrapper . classes ( 'with-compact-controls' ) ) . toBe ( false ) ;
60
+ expect ( wrapper . classes ( ) ) . not . toContain ( 'with-compact-controls' ) ;
60
61
61
62
wrapper . setData ( {
62
63
appState : {
63
64
contentWidth : BreakpointAttributes . default . large . contentWidth + GUTTERS_WIDTH - 10 ,
64
65
} ,
65
66
} ) ;
67
+ await wrapper . vm . $nextTick ( ) ;
66
68
67
- expect ( wrapper . classes ( 'with-compact-controls' ) ) . toBe ( true ) ;
69
+ expect ( wrapper . classes ( ) ) . toContain ( 'with-compact-controls' ) ;
68
70
} ) ;
69
71
70
- it ( 'collapses the controllers if contentWidth is smaller than the medium contentWidth + the gutters width in medium viewport' , ( ) => {
72
+ it ( 'collapses the controllers if contentWidth is smaller than the medium contentWidth + the gutters width in medium viewport' , async ( ) => {
71
73
// set medium viewport
72
74
window . innerWidth = BreakpointAttributes . default . medium . maxWidth - 1 ;
73
75
const wrapper = shallowMount ( Pager , { propsData } ) ;
@@ -77,16 +79,18 @@ describe('Pager', () => {
77
79
contentWidth : BreakpointAttributes . default . medium . contentWidth + GUTTERS_WIDTH + 10 ,
78
80
} ,
79
81
} ) ;
82
+ await wrapper . vm . $nextTick ( ) ;
80
83
81
- expect ( wrapper . classes ( 'with-compact-controls' ) ) . toBe ( false ) ;
84
+ expect ( wrapper . classes ( ) ) . not . toContain ( 'with-compact-controls' ) ;
82
85
83
86
wrapper . setData ( {
84
87
appState : {
85
88
contentWidth : BreakpointAttributes . default . medium . contentWidth + GUTTERS_WIDTH - 10 ,
86
89
} ,
87
90
} ) ;
91
+ await wrapper . vm . $nextTick ( ) ;
88
92
89
- expect ( wrapper . classes ( 'with-compact-controls' ) ) . toBe ( true ) ;
93
+ expect ( wrapper . classes ( ) ) . toContain ( 'with-compact-controls' ) ;
90
94
} ) ;
91
95
92
96
it ( 'collapses the controllers in small viewports' , ( ) => {
@@ -100,7 +104,7 @@ describe('Pager', () => {
100
104
} ,
101
105
} ) ;
102
106
103
- expect ( wrapper . classes ( 'with-compact-controls' ) ) . toBe ( true ) ;
107
+ expect ( wrapper . classes ( ) ) . toContain ( 'with-compact-controls' ) ;
104
108
} ) ;
105
109
106
110
it ( 'renders each page using provided slots' , ( ) => {
@@ -126,33 +130,33 @@ describe('Pager', () => {
126
130
127
131
let pages = wrapper . findAll ( '.page' ) ;
128
132
let indicators = wrapper . findAll ( '.indicator' ) ;
129
- expect ( pages . at ( 0 ) . classes ( 'active' ) ) . toBe ( true ) ;
133
+ expect ( pages . at ( 0 ) . classes ( ) ) . toContain ( 'active' ) ;
130
134
expect ( indicators . at ( 0 ) . attributes ( 'aria-current' ) ) . toBeTruthy ( ) ;
131
- expect ( pages . at ( 1 ) . classes ( 'active' ) ) . toBe ( false ) ;
135
+ expect ( pages . at ( 1 ) . classes ( ) ) . not . toContain ( 'active' ) ;
132
136
expect ( indicators . at ( 1 ) . attributes ( 'aria-current' ) ) . toBeFalsy ( ) ;
133
- expect ( pages . at ( 2 ) . classes ( 'active' ) ) . toBe ( false ) ;
137
+ expect ( pages . at ( 2 ) . classes ( ) ) . not . toContain ( 'active' ) ;
134
138
expect ( indicators . at ( 2 ) . attributes ( 'aria-current' ) ) . toBeFalsy ( ) ;
135
139
136
140
await indicators . at ( 1 ) . trigger ( 'click' ) ;
137
141
138
142
pages = wrapper . findAll ( '.page' ) ;
139
143
indicators = wrapper . findAll ( '.indicator' ) ;
140
- expect ( pages . at ( 0 ) . classes ( 'active' ) ) . toBe ( false ) ;
144
+ expect ( pages . at ( 0 ) . classes ( ) ) . not . toContain ( 'active' ) ;
141
145
expect ( indicators . at ( 0 ) . attributes ( 'aria-current' ) ) . toBeFalsy ( ) ;
142
- expect ( pages . at ( 1 ) . classes ( 'active' ) ) . toBe ( true ) ;
146
+ expect ( pages . at ( 1 ) . classes ( ) ) . toContain ( 'active' ) ;
143
147
expect ( indicators . at ( 1 ) . attributes ( 'aria-current' ) ) . toBeTruthy ( ) ;
144
- expect ( pages . at ( 2 ) . classes ( 'active' ) ) . toBe ( false ) ;
148
+ expect ( pages . at ( 2 ) . classes ( ) ) . not . toContain ( 'active' ) ;
145
149
expect ( indicators . at ( 2 ) . attributes ( 'aria-current' ) ) . toBeFalsy ( ) ;
146
150
147
151
await indicators . at ( 2 ) . trigger ( 'click' ) ;
148
152
149
153
pages = wrapper . findAll ( '.page' ) ;
150
154
indicators = wrapper . findAll ( '.indicator' ) ;
151
- expect ( pages . at ( 0 ) . classes ( 'active' ) ) . toBe ( false ) ;
155
+ expect ( pages . at ( 0 ) . classes ( ) ) . not . toContain ( 'active' ) ;
152
156
expect ( indicators . at ( 0 ) . attributes ( 'aria-current' ) ) . toBeFalsy ( ) ;
153
- expect ( pages . at ( 1 ) . classes ( 'active' ) ) . toBe ( false ) ;
157
+ expect ( pages . at ( 1 ) . classes ( ) ) . not . toContain ( 'active' ) ;
154
158
expect ( indicators . at ( 1 ) . attributes ( 'aria-current' ) ) . toBeFalsy ( ) ;
155
- expect ( pages . at ( 2 ) . classes ( 'active' ) ) . toBe ( true ) ;
159
+ expect ( pages . at ( 2 ) . classes ( ) ) . toContain ( 'active' ) ;
156
160
expect ( indicators . at ( 2 ) . attributes ( 'aria-current' ) ) . toBeTruthy ( ) ;
157
161
} ) ;
158
162
0 commit comments