This repository was archived by the owner on Mar 27, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
packages/bootstrap-vue-next/src/components/BNav Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<li class =" nav-item" >
3
3
<b-link
4
- class =" nav-link "
4
+ : class =" computedLinkClasses "
5
5
v-bind =" $props"
6
6
active-class =" active"
7
7
:tabindex =" disabledBoolean ? -1 : undefined"
16
16
import BLink , {BLINK_PROPS } from ' ../BLink/BLink.vue'
17
17
import {omit } from ' ../../utils'
18
18
import {useBooleanish } from ' ../../composables'
19
- import {defineComponent , type SlotsType } from ' vue'
19
+ import {computed , defineComponent , type SlotsType } from ' vue'
20
20
21
21
export default defineComponent ({
22
22
slots: Object as SlotsType <{
@@ -25,11 +25,14 @@ export default defineComponent({
25
25
components: {BLink },
26
26
props: {
27
27
... omit (BLINK_PROPS , [' event' , ' routerTag' ] as const ),
28
+ linkClasses: {type: String , default: null },
28
29
},
29
30
setup(props ) {
30
31
const disabledBoolean = useBooleanish (() => props .disabled )
31
32
32
- return {disabledBoolean }
33
+ const computedLinkClasses = computed (() => [' nav-link' , props .linkClasses ])
34
+
35
+ return {disabledBoolean , computedLinkClasses }
33
36
},
34
37
})
35
38
</script >
Original file line number Diff line number Diff line change @@ -23,6 +23,17 @@ describe('nav-item', () => {
23
23
expect ( $blink . classes ( ) ) . toContain ( 'nav-link' )
24
24
} )
25
25
26
+ it ( "blink has custom-class class when prop link-classes='custom-class'" , ( ) => {
27
+ const wrapper = mount ( BNavItem , {
28
+ props : {
29
+ linkClasses : 'custom-class' ,
30
+ } ,
31
+ } )
32
+ const $blink = wrapper . findComponent ( BLink )
33
+
34
+ expect ( $blink . classes ( ) ) . toContain ( 'custom-class' )
35
+ } )
36
+
26
37
it ( 'blink has tabindex -1 when prop disabled' , ( ) => {
27
38
const wrapper = mount ( BNavItem , {
28
39
props : {
You can’t perform that action at this time.
0 commit comments