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 11<template >
22 <li class =" c-nav-item" >
33 <CLink
4- :class =" ['c-nav-link', addLinkClasses] "
4+ :class =" linkClasses "
55 :exact =" true"
66 v-bind =" linkProps"
77 @click.native =" click"
@@ -26,13 +26,15 @@ const props = Object.assign(linkProps, {
2626 name: String ,
2727 icon: [String , Array , Object ],
2828 badge: Object ,
29- addLinkClasses: [String , Array , Object ]
29+ addLinkClasses: [String , Array , Object ],
30+ label: Boolean
3031})
3132
3233export default {
3334 name: ' CSidebarNavLink' ,
3435 components: {
35- CLink, CBadge
36+ CLink,
37+ CBadge
3638 },
3739 props,
3840 computed: {
@@ -41,6 +43,12 @@ export default {
4143 props[key] = this [key]
4244 return props
4345 }, {})
46+ },
47+ linkClasses () {
48+ return [
49+ this .label ? ' c-nav-label' : ' c-nav-link' ,
50+ this .addLinkClasses
51+ ]
4452 }
4553 },
4654 methods: {
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ import CSidebarNav from './CSidebarNav'
77import CSidebarMinimizer from './CSidebarMinimizer'
88import CSidebarNavDivider from './CSidebarNavDivider'
99import CSidebarNavDropdown from './CSidebarNavDropdown'
10- import CSidebarNavLabel from './CSidebarNavLabel'
1110import CSidebarNavLink from './CSidebarNavLink'
1211import CSidebarNavTitle from './CSidebarNavTitle'
1312import CSidebarToggler from './CSidebarToggler'
@@ -22,7 +21,6 @@ export {
2221 CSidebarNav ,
2322 CSidebarNavDivider ,
2423 CSidebarNavDropdown ,
25- CSidebarNavLabel ,
2624 CSidebarNavLink ,
2725 CSidebarNavTitle ,
2826 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, {
1717 }
1818} )
1919
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+
2036describe ( `${ ComponentName } .vue` , ( ) => {
2137 it ( 'has a name' , ( ) => {
2238 expect ( Component . name ) . toBe ( ComponentName )
2339 } )
2440 it ( 'renders correctly' , ( ) => {
2541 expect ( wrapper . element ) . toMatchSnapshot ( )
2642 } )
43+ it ( 'renders correctly in label mode' , ( ) => {
44+ expect ( wrapperLabel . element ) . toMatchSnapshot ( )
45+ } )
2746 it ( 'emits link-clicked event when clicked' , ( ) => {
2847 // cannot trigger native click
2948 // 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`] = `
2424 </a >
2525</li >
2626` ;
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