Skip to content

Commit 2410e03

Browse files
committed
It adds display:none to NavigatorCard when navigator is loading
1 parent f47301f commit 2410e03

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/components/Navigator.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
class="navigator"
1515
>
1616
<NavigatorCard
17-
v-if="!isFetching"
17+
v-show="!isFetching"
1818
v-bind="technologyProps"
1919
:type="type"
2020
:children="flatChildren"
@@ -33,7 +33,7 @@
3333
</NavigatorCard>
3434
<LoadingNavigatorCard
3535
@close="$emit('close')"
36-
v-else
36+
v-if="isFetching"
3737
/>
3838
<div aria-live="polite" class="visuallyhidden">
3939
{{ $t('navigator.navigator-is', {

tests/unit/components/Navigator.spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import { INDEX_ROOT_KEY } from '@/constants/sidebar';
1717

1818
jest.mock('docc-render/utils/throttle', () => jest.fn(v => v));
1919

20+
const { LoadingNavigatorCard } = Navigator.components;
21+
2022
const technology = {
2123
title: 'FooTechnology',
2224
children: [
@@ -161,6 +163,24 @@ describe('Navigator', () => {
161163
expect(wrapper.find('[aria-live="polite"]').text()).toBe('navigator.navigator-is navigator.state.loading');
162164
});
163165

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('adds display:none to NavigatorCard when navigator is loading', () => {
176+
const wrapper = createWrapper({
177+
propsData: {
178+
isFetching: true,
179+
},
180+
});
181+
expect(wrapper.find(NavigatorCard).attributes('style')).toContain('display: none');
182+
});
183+
164184
it('renders an aria live that tells VO users when navigator is ready', () => {
165185
const wrapper = createWrapper();
166186
expect(wrapper.find('[aria-live="polite"]').exists()).toBe(true);

0 commit comments

Comments
 (0)