Skip to content

Commit

Permalink
test: add base avatar tests (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
stafyniaksacha authored Nov 3, 2024
1 parent f5ee3b0 commit 9610fff
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion components/base/BaseAvatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const props = withDefaults(
* Defines the color of the avatar
*
* @since 3.0.0
* @default 'default'
* @default 'muted'
*/
color?:
| 'white'
Expand Down
32 changes: 32 additions & 0 deletions test/components/base/BaseAvatar.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { BaseAvatar } from '#components'
import { mount } from '@vue/test-utils'
import { beforeEach, describe, expect, it } from 'vitest'
import { resetNuiAppConfig } from '../../utils'

describe('component: BaseAvatar', () => {
describe('rendering', () => {
beforeEach(() => resetNuiAppConfig('BaseAvatar'))

it('should render with custom app.config', async () => {
// useAppConfig().nui.BaseAvatar!.color = 'primary'
useAppConfig().nui.BaseAvatar!.size = 'xl'
useAppConfig().nui.BaseAvatar!.rounded = 'lg'

const component = mount(BaseAvatar)

const wrapper = component.get('.nui-avatar')
// expect(wrapper.classes('nui-avatar-muted')).toBeTruthy()
expect(wrapper.classes('nui-avatar-xl')).toBeTruthy()
expect(wrapper.classes('nui-avatar-rounded-lg')).toBeTruthy()
})

it('should render with default app.config', async () => {
const component = mount(BaseAvatar)

const wrapper = component.get('.nui-avatar')
// expect(wrapper.classes('nui-avatar-muted')).toBeTruthy()
expect(wrapper.classes('nui-avatar-sm')).toBeTruthy()
expect(wrapper.classes('nui-avatar-rounded-full')).toBeTruthy()
})
})
})

0 comments on commit 9610fff

Please sign in to comment.