File tree Expand file tree Collapse file tree 7 files changed +55
-87
lines changed Expand file tree Collapse file tree 7 files changed +55
-87
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<li class =" c-nav-item" >
3
3
<CLink
4
- :class =" ['c-nav-link', addLinkClasses] "
4
+ :class =" linkClasses "
5
5
:exact =" true"
6
6
v-bind =" linkProps"
7
7
@click.native =" click"
@@ -26,13 +26,15 @@ const props = Object.assign(linkProps, {
26
26
name: String ,
27
27
icon: [String , Array , Object ],
28
28
badge: Object ,
29
- addLinkClasses: [String , Array , Object ]
29
+ addLinkClasses: [String , Array , Object ],
30
+ label: Boolean
30
31
})
31
32
32
33
export default {
33
34
name: ' CSidebarNavLink' ,
34
35
components: {
35
- CLink, CBadge
36
+ CLink,
37
+ CBadge
36
38
},
37
39
props,
38
40
computed: {
@@ -41,6 +43,12 @@ export default {
41
43
props[key] = this [key]
42
44
return props
43
45
}, {})
46
+ },
47
+ linkClasses () {
48
+ return [
49
+ this .label ? ' c-nav-label' : ' c-nav-link' ,
50
+ this .addLinkClasses
51
+ ]
44
52
}
45
53
},
46
54
methods: {
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ import CSidebarNav from './CSidebarNav'
7
7
import CSidebarMinimizer from './CSidebarMinimizer'
8
8
import CSidebarNavDivider from './CSidebarNavDivider'
9
9
import CSidebarNavDropdown from './CSidebarNavDropdown'
10
- import CSidebarNavLabel from './CSidebarNavLabel'
11
10
import CSidebarNavLink from './CSidebarNavLink'
12
11
import CSidebarNavTitle from './CSidebarNavTitle'
13
12
import CSidebarToggler from './CSidebarToggler'
@@ -22,7 +21,6 @@ export {
22
21
CSidebarNav ,
23
22
CSidebarNavDivider ,
24
23
CSidebarNavDropdown ,
25
- CSidebarNavLabel ,
26
24
CSidebarNavLink ,
27
25
CSidebarNavTitle ,
28
26
CSidebarToggler
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -17,13 +17,32 @@ const wrapper = mount(Component, {
17
17
}
18
18
} )
19
19
20
+ const wrapperLabel = mount ( Component , {
21
+ attachToDocument : true ,
22
+ propsData : {
23
+ name : 'test link' ,
24
+ label : true ,
25
+ icon : 'cui-settings' ,
26
+ badge : {
27
+ variant : 'success' ,
28
+ textHtml : 'NEW'
29
+ }
30
+ } ,
31
+ attrs : {
32
+ id : 'link'
33
+ }
34
+ } )
35
+
20
36
describe ( `${ ComponentName } .vue` , ( ) => {
21
37
it ( 'has a name' , ( ) => {
22
38
expect ( Component . name ) . toBe ( ComponentName )
23
39
} )
24
40
it ( 'renders correctly' , ( ) => {
25
41
expect ( wrapper . element ) . toMatchSnapshot ( )
26
42
} )
43
+ it ( 'renders correctly in label mode' , ( ) => {
44
+ expect ( wrapperLabel . element ) . toMatchSnapshot ( )
45
+ } )
27
46
it ( 'emits link-clicked event when clicked' , ( ) => {
28
47
// cannot trigger native click
29
48
// wrapper.find('a').trigger('click')
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -24,3 +24,28 @@ exports[`CSidebarNavLink.vue renders correctly 1`] = `
24
24
</a >
25
25
</li >
26
26
` ;
27
+
28
+ exports [` CSidebarNavLink.vue renders correctly in label mode 1` ] = `
29
+ <li
30
+ class = " c-nav-item"
31
+ id = " link"
32
+ >
33
+ <a
34
+ class = " c-nav-label"
35
+ href = " #"
36
+ target = " _self"
37
+ >
38
+ <i
39
+ class = " c-nav-icon cui-settings"
40
+ />
41
+
42
+ test link
43
+
44
+ <span
45
+ class = " badge badge-success"
46
+ >
47
+ NEW
48
+ </span >
49
+ </a >
50
+ </li >
51
+ ` ;
You can’t perform that action at this time.
0 commit comments