File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 14
14
class =" navigator"
15
15
>
16
16
<NavigatorCard
17
- v-if =" !isFetching"
17
+ v-show =" !isFetching"
18
18
v-bind =" technologyProps"
19
19
:type =" type"
20
20
:children =" flatChildren"
33
33
</NavigatorCard >
34
34
<LoadingNavigatorCard
35
35
@close =" $emit('close')"
36
- v-else
36
+ v-if = " isFetching "
37
37
/>
38
38
<div aria-live =" polite" class =" visuallyhidden" >
39
39
{{ $t('navigator.navigator-is', {
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ import { INDEX_ROOT_KEY } from '@/constants/sidebar';
17
17
18
18
jest . mock ( 'docc-render/utils/throttle' , ( ) => jest . fn ( v => v ) ) ;
19
19
20
+ const { LoadingNavigatorCard } = Navigator . components ;
21
+
20
22
const technology = {
21
23
title : 'FooTechnology' ,
22
24
children : [
@@ -161,6 +163,29 @@ describe('Navigator', () => {
161
163
expect ( wrapper . find ( '[aria-live="polite"]' ) . text ( ) ) . toBe ( 'navigator.navigator-is navigator.state.loading' ) ;
162
164
} ) ;
163
165
166
+ it ( 'renders a LoadingNavigatorCard when navigator is loading' , ( ) => {
167
+ const wrapper = createWrapper ( {
168
+ propsData : {
169
+ isFetching : true ,
170
+ } ,
171
+ } ) ;
172
+ expect ( wrapper . find ( LoadingNavigatorCard ) . exists ( ) ) . toBe ( true ) ;
173
+ } ) ;
174
+
175
+ it ( 'does not render a LoadingNavigatorCard when navigator is not loading' , ( ) => {
176
+ const wrapper = createWrapper ( ) ;
177
+ expect ( wrapper . find ( LoadingNavigatorCard ) . exists ( ) ) . toBe ( false ) ;
178
+ } ) ;
179
+
180
+ it ( 'adds display:none to NavigatorCard when navigator is loading' , ( ) => {
181
+ const wrapper = createWrapper ( {
182
+ propsData : {
183
+ isFetching : true ,
184
+ } ,
185
+ } ) ;
186
+ expect ( wrapper . find ( NavigatorCard ) . attributes ( 'style' ) ) . toContain ( 'display: none' ) ;
187
+ } ) ;
188
+
164
189
it ( 'renders an aria live that tells VO users when navigator is ready' , ( ) => {
165
190
const wrapper = createWrapper ( ) ;
166
191
expect ( wrapper . find ( '[aria-live="polite"]' ) . exists ( ) ) . toBe ( true ) ;
You can’t perform that action at this time.
0 commit comments