Skip to content

Commit 5960f11

Browse files
committed
test: fix snapshots and sidebar test
1 parent 0493a99 commit 5960f11

21 files changed

+932
-828
lines changed
Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
1-
import Vue from 'vue'
2-
import { shallowMount } from '@vue/test-utils';
1+
import { shallowMount, createLocalVue } from '@vue/test-utils';
32
import CoreuiVue from '@coreui/vue'
3+
import Vuex from 'vuex'
44
import TheSidebar from '@/containers/TheSidebar'
55

6-
Vue.use(CoreuiVue)
6+
const localVue = createLocalVue()
7+
localVue.use(CoreuiVue)
8+
localVue.use(Vuex)
9+
10+
const store = new Vuex.Store({
11+
state: {
12+
sidebarShow: 'responsive',
13+
sidebarMinimize: false
14+
}
15+
})
716

817
describe('TheSidebar.vue', () => {
918
it('has a name', () => {
1019
expect(TheSidebar.name).toBe('TheSidebar')
1120
})
1221
test('renders correctly', () => {
13-
const wrapper = shallowMount(TheSidebar)
22+
const wrapper = shallowMount(TheSidebar, { store, localVue })
1423
expect(wrapper.element).toMatchSnapshot()
1524
})
1625
})

tests/unit/containers/__snapshots__/TheContainer.spec.js.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ exports[`TheContainer.vue renders correctly 1`] = `
77
<thesidebar-stub />
88
99
<div
10-
class="c-wrapper"
10+
class="c-wrapper c-fixed-components"
1111
>
1212
<theheader-stub />
1313
@@ -26,9 +26,9 @@ exports[`TheContainer.vue renders correctly 1`] = `
2626
/>
2727
</ccontainer-stub>
2828
</main>
29+
30+
<thefooter-stub />
2931
</div>
30-
31-
<thefooter-stub />
3232
</div>
3333
</div>
3434
`;

tests/unit/containers/__snapshots__/TheHeader.spec.js.snap

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ exports[`TheHeader.vue renders correctly 1`] = `
2121
/>
2222
2323
<cheaderbrand-stub
24+
activeclass="router-link-active"
2425
class="mx-auto d-lg-none"
26+
event="click"
27+
exactactiveclass="router-link-exact-active"
28+
routertag="a"
29+
tag="div"
30+
target="_self"
2531
to="/"
2632
>
2733
<cicon-stub
@@ -38,9 +44,9 @@ exports[`TheHeader.vue renders correctly 1`] = `
3844
class="px-3"
3945
>
4046
<cheadernavlink-stub
41-
activeclass="active"
47+
activeclass="router-link-active"
4248
event="click"
43-
exactactiveclass="active"
49+
exactactiveclass="router-link-exact-active"
4450
routertag="a"
4551
target="_self"
4652
to="/dashboard"
@@ -55,10 +61,10 @@ exports[`TheHeader.vue renders correctly 1`] = `
5561
class="px-3"
5662
>
5763
<cheadernavlink-stub
58-
activeclass="active"
64+
activeclass="router-link-active"
5965
event="click"
6066
exact="true"
61-
exactactiveclass="active"
67+
exactactiveclass="router-link-exact-active"
6268
routertag="a"
6369
target="_self"
6470
to="/users"
@@ -73,9 +79,9 @@ exports[`TheHeader.vue renders correctly 1`] = `
7379
class="px-3"
7480
>
7581
<cheadernavlink-stub
76-
activeclass="active"
82+
activeclass="router-link-active"
7783
event="click"
78-
exactactiveclass="active"
84+
exactactiveclass="router-link-exact-active"
7985
routertag="a"
8086
target="_self"
8187
>
@@ -93,9 +99,9 @@ exports[`TheHeader.vue renders correctly 1`] = `
9399
class="d-md-down-none mx-2"
94100
>
95101
<cheadernavlink-stub
96-
activeclass="active"
102+
activeclass="router-link-active"
97103
event="click"
98-
exactactiveclass="active"
104+
exactactiveclass="router-link-exact-active"
99105
routertag="a"
100106
target="_self"
101107
>
@@ -109,9 +115,9 @@ exports[`TheHeader.vue renders correctly 1`] = `
109115
class="d-md-down-none mx-2"
110116
>
111117
<cheadernavlink-stub
112-
activeclass="active"
118+
activeclass="router-link-active"
113119
event="click"
114-
exactactiveclass="active"
120+
exactactiveclass="router-link-exact-active"
115121
routertag="a"
116122
target="_self"
117123
>
@@ -125,9 +131,9 @@ exports[`TheHeader.vue renders correctly 1`] = `
125131
class="d-md-down-none mx-2"
126132
>
127133
<cheadernavlink-stub
128-
activeclass="active"
134+
activeclass="router-link-active"
129135
event="click"
130-
exactactiveclass="active"
136+
exactactiveclass="router-link-exact-active"
131137
routertag="a"
132138
target="_self"
133139
>
@@ -145,7 +151,7 @@ exports[`TheHeader.vue renders correctly 1`] = `
145151
tag="div"
146152
>
147153
<cbreadcrumbrouter-stub
148-
class="border-0"
154+
class="border-0 mb-0"
149155
/>
150156
</csubheader-stub>
151157
</cheader-stub>

tests/unit/containers/__snapshots__/TheHeaderDropdownAccnt.spec.js.snap

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ exports[`TheHeaderDropdownAccnt.vue renders correctly 1`] = `
2323
</cdropdownheader-stub>
2424
2525
<cdropdownitem-stub
26-
activeclass="active"
26+
activeclass="router-link-active"
2727
event="click"
28-
exactactiveclass="active"
28+
exactactiveclass="router-link-exact-active"
2929
routertag="a"
3030
target="_self"
3131
>
@@ -35,11 +35,11 @@ exports[`TheHeaderDropdownAccnt.vue renders correctly 1`] = `
3535
Updates
3636
3737
<cbadge-stub
38-
activeclass="active"
38+
activeclass="router-link-active"
3939
class="ml-auto"
4040
color="info"
4141
event="click"
42-
exactactiveclass="active"
42+
exactactiveclass="router-link-exact-active"
4343
routertag="a"
4444
tag="span"
4545
target="_self"
@@ -49,9 +49,9 @@ exports[`TheHeaderDropdownAccnt.vue renders correctly 1`] = `
4949
</cdropdownitem-stub>
5050
5151
<cdropdownitem-stub
52-
activeclass="active"
52+
activeclass="router-link-active"
5353
event="click"
54-
exactactiveclass="active"
54+
exactactiveclass="router-link-exact-active"
5555
routertag="a"
5656
target="_self"
5757
>
@@ -61,11 +61,11 @@ exports[`TheHeaderDropdownAccnt.vue renders correctly 1`] = `
6161
Messages
6262
6363
<cbadge-stub
64-
activeclass="active"
64+
activeclass="router-link-active"
6565
class="ml-auto"
6666
color="success"
6767
event="click"
68-
exactactiveclass="active"
68+
exactactiveclass="router-link-exact-active"
6969
routertag="a"
7070
tag="span"
7171
target="_self"
@@ -75,9 +75,9 @@ exports[`TheHeaderDropdownAccnt.vue renders correctly 1`] = `
7575
</cdropdownitem-stub>
7676
7777
<cdropdownitem-stub
78-
activeclass="active"
78+
activeclass="router-link-active"
7979
event="click"
80-
exactactiveclass="active"
80+
exactactiveclass="router-link-exact-active"
8181
routertag="a"
8282
target="_self"
8383
>
@@ -87,11 +87,11 @@ exports[`TheHeaderDropdownAccnt.vue renders correctly 1`] = `
8787
Tasks
8888
8989
<cbadge-stub
90-
activeclass="active"
90+
activeclass="router-link-active"
9191
class="ml-auto"
9292
color="danger"
9393
event="click"
94-
exactactiveclass="active"
94+
exactactiveclass="router-link-exact-active"
9595
routertag="a"
9696
tag="span"
9797
target="_self"
@@ -101,9 +101,9 @@ exports[`TheHeaderDropdownAccnt.vue renders correctly 1`] = `
101101
</cdropdownitem-stub>
102102
103103
<cdropdownitem-stub
104-
activeclass="active"
104+
activeclass="router-link-active"
105105
event="click"
106-
exactactiveclass="active"
106+
exactactiveclass="router-link-exact-active"
107107
routertag="a"
108108
target="_self"
109109
>
@@ -113,11 +113,11 @@ exports[`TheHeaderDropdownAccnt.vue renders correctly 1`] = `
113113
Comments
114114
115115
<cbadge-stub
116-
activeclass="active"
116+
activeclass="router-link-active"
117117
class="ml-auto"
118118
color="warning"
119119
event="click"
120-
exactactiveclass="active"
120+
exactactiveclass="router-link-exact-active"
121121
routertag="a"
122122
tag="span"
123123
target="_self"
@@ -137,9 +137,9 @@ exports[`TheHeaderDropdownAccnt.vue renders correctly 1`] = `
137137
</cdropdownheader-stub>
138138
139139
<cdropdownitem-stub
140-
activeclass="active"
140+
activeclass="router-link-active"
141141
event="click"
142-
exactactiveclass="active"
142+
exactactiveclass="router-link-exact-active"
143143
routertag="a"
144144
target="_self"
145145
>
@@ -151,9 +151,9 @@ exports[`TheHeaderDropdownAccnt.vue renders correctly 1`] = `
151151
</cdropdownitem-stub>
152152
153153
<cdropdownitem-stub
154-
activeclass="active"
154+
activeclass="router-link-active"
155155
event="click"
156-
exactactiveclass="active"
156+
exactactiveclass="router-link-exact-active"
157157
routertag="a"
158158
target="_self"
159159
>
@@ -165,9 +165,9 @@ exports[`TheHeaderDropdownAccnt.vue renders correctly 1`] = `
165165
</cdropdownitem-stub>
166166
167167
<cdropdownitem-stub
168-
activeclass="active"
168+
activeclass="router-link-active"
169169
event="click"
170-
exactactiveclass="active"
170+
exactactiveclass="router-link-exact-active"
171171
routertag="a"
172172
target="_self"
173173
>
@@ -177,11 +177,11 @@ exports[`TheHeaderDropdownAccnt.vue renders correctly 1`] = `
177177
Payments
178178
179179
<cbadge-stub
180-
activeclass="active"
180+
activeclass="router-link-active"
181181
class="ml-auto"
182182
color="secondary"
183183
event="click"
184-
exactactiveclass="active"
184+
exactactiveclass="router-link-exact-active"
185185
routertag="a"
186186
tag="span"
187187
target="_self"
@@ -191,9 +191,9 @@ exports[`TheHeaderDropdownAccnt.vue renders correctly 1`] = `
191191
</cdropdownitem-stub>
192192
193193
<cdropdownitem-stub
194-
activeclass="active"
194+
activeclass="router-link-active"
195195
event="click"
196-
exactactiveclass="active"
196+
exactactiveclass="router-link-exact-active"
197197
routertag="a"
198198
target="_self"
199199
>
@@ -203,11 +203,11 @@ exports[`TheHeaderDropdownAccnt.vue renders correctly 1`] = `
203203
Projects
204204
205205
<cbadge-stub
206-
activeclass="active"
206+
activeclass="router-link-active"
207207
class="ml-auto"
208208
color="primary"
209209
event="click"
210-
exactactiveclass="active"
210+
exactactiveclass="router-link-exact-active"
211211
routertag="a"
212212
tag="span"
213213
target="_self"
@@ -221,9 +221,9 @@ exports[`TheHeaderDropdownAccnt.vue renders correctly 1`] = `
221221
/>
222222
223223
<cdropdownitem-stub
224-
activeclass="active"
224+
activeclass="router-link-active"
225225
event="click"
226-
exactactiveclass="active"
226+
exactactiveclass="router-link-exact-active"
227227
routertag="a"
228228
target="_self"
229229
>
@@ -235,9 +235,9 @@ exports[`TheHeaderDropdownAccnt.vue renders correctly 1`] = `
235235
</cdropdownitem-stub>
236236
237237
<cdropdownitem-stub
238-
activeclass="active"
238+
activeclass="router-link-active"
239239
event="click"
240-
exactactiveclass="active"
240+
exactactiveclass="router-link-exact-active"
241241
routertag="a"
242242
target="_self"
243243
>

tests/unit/containers/__snapshots__/TheSidebar.spec.js.snap

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ exports[`TheSidebar.vue renders correctly 1`] = `
1010
show="responsive"
1111
>
1212
<csidebarbrand-stub
13+
activeclass="router-link-active"
1314
class="d-md-down-none"
15+
event="click"
16+
exactactiveclass="router-link-exact-active"
17+
routertag="a"
18+
tag="div"
19+
target="_self"
1420
to="/"
1521
>
1622
<cicon-stub

0 commit comments

Comments
 (0)