Skip to content

Commit 82c3a22

Browse files
committed
It adds the "router-link-exact-active" class for case insensitive version of technologyPath
1 parent 909d30c commit 82c3a22

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

Diff for: src/components/Navigator/NavigatorCard.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
v-if="technology"
3737
:id="INDEX_ROOT_KEY"
3838
:url="technologyPath"
39-
class="technology-title"
39+
:class="['technology-title', { 'router-link-exact-active': isSameRoute }]"
4040
@click.alt.native.prevent="toggleAllNodes"
4141
>
4242
<h2 class="card-link">
@@ -247,6 +247,8 @@ export default {
247247
};
248248
},
249249
computed: {
250+
isSameRoute: ({ technologyPath, $route }) => (
251+
technologyPath.toLowerCase() === $route.path.toLowerCase()),
250252
politeAriaLive() {
251253
const { hasNodes, navigatorItems } = this;
252254
if (!hasNodes) return '';

Diff for: src/components/Navigator/NavigatorCardItem.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
:is="refComponent"
9090
:id="item.uid"
9191
:class="{ bolded: isBold }"
92-
:url="isGroupMarker ? null : (item.path.toLowerCase() || '')"
92+
:url="isGroupMarker ? null : (item.path || '')"
9393
:tabindex="isFocused ? '0' : '-1'"
9494
:aria-describedby="`${ariaDescribedBy} ${usageLabel}`"
9595
class="leaf-link"

Diff for: tests/unit/components/Navigator/NavigatorCard.spec.js

+9
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ const createWrapper = ({ propsData, ...others } = {}) => shallowMount(NavigatorC
189189
BaseNavigatorCard,
190190
},
191191
sync: false,
192+
mocks: { $route: { path: defaultProps.technologyPath } },
192193
attachToDocument: true,
193194
...others,
194195
});
@@ -370,6 +371,14 @@ describe('NavigatorCard', () => {
370371
});
371372
});
372373

374+
it('adds the "router-link-exact-active" class for case insensitive version of technologyPath', async () => {
375+
const wrapper = createWrapper();
376+
wrapper.setProps({
377+
technologyPath: '/documentation/Testkit',
378+
});
379+
expect(wrapper.find('.technology-title').classes()).toContain('router-link-exact-active');
380+
});
381+
373382
it('focus the first item if there is no active item', async () => {
374383
const wrapper = createWrapper();
375384
await flushPromises();

0 commit comments

Comments
 (0)