-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Hex
committed
Feb 15, 2022
1 parent
9f71003
commit 0b4baa0
Showing
3 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,36 @@ | ||
import { shallowMount } from '@vue/test-utils'; | ||
import Component from '../../packages/box/src/box.vue'; | ||
|
||
const factory = (propsData) => { | ||
return shallowMount(Component, { | ||
propsData: { | ||
...propsData | ||
} | ||
}) | ||
} | ||
|
||
describe('box', () => { | ||
it('renders dom when mounted', () => { | ||
const wrapper = shallowMount(Component); | ||
const wrapper = factory(); | ||
expect(wrapper.classes()).toContain('cb-box'); | ||
}); | ||
|
||
it('renders props.theme when passed', () => { | ||
const theme = 'primary'; | ||
const wrapper = factory({ theme }); | ||
|
||
expect(wrapper.classes()).toContain(`box-${theme}`); | ||
}); | ||
|
||
it('renders props.collapsed when passed', () => { | ||
const wrapper = factory({ collapsed: true }); | ||
|
||
expect(wrapper.classes()).toContain('collapsed-box'); | ||
}); | ||
|
||
it('renders props.solid when passed', () => { | ||
const wrapper = factory({ solid: true }); | ||
|
||
expect(wrapper.classes()).toContain('box-solid'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters