Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a1a8203

Browse filesBrowse files
committed
fix: CSidebarNavItem: allow adding 'size' prop in 'icon' object coreui#76
1 parent 44244fd commit a1a8203
Copy full SHA for a1a8203

File tree

2 files changed

+8
-1
lines changed
Filter options

2 files changed

+8
-1
lines changed

‎src/components/template/CSidebarNavItem.vue

Copy file name to clipboardExpand all lines: src/components/template/CSidebarNavItem.vue
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ export default {
7070
},
7171
computedIcon () {
7272
if (typeof this.icon === 'object') {
73+
const key = this.icon.size ? 'class' : 'customClasses'
7374
return Object.assign(
74-
{ customClasses: 'c-sidebar-nav-icon' },
75+
{ [`${key}`]: 'c-sidebar-nav-icon' },
7576
this.icon
7677
)
7778
} else {

‎src/components/template/tests/CSidebarNavItem.spec.js

Copy file name to clipboardExpand all lines: src/components/template/tests/CSidebarNavItem.spec.js
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,10 @@ describe(`${ComponentName}.vue`, () => {
4343
it('renders correctly in label mode', () => {
4444
expect(wrapperLabel.element).toMatchSnapshot()
4545
})
46+
it('assign correct classes in case of custom icon size', () => {
47+
wrapperLabel.setProps({ icon: { name: 'cui-settings', size: 'lg' }})
48+
expect(wrapperLabel.find('svg').classes().join(',')).toBe(
49+
'c-icon,c-icon-lg,c-sidebar-nav-icon'
50+
)
51+
})
4652
})

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.