-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Phillip Rak <[email protected]>
- Loading branch information
1 parent
aa015ed
commit d63e3bd
Showing
2 changed files
with
40 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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { shallowMount } from '@vue/test-utils'; | ||
import ColorInput from '@shell/components/form/ColorInput.vue'; | ||
|
||
describe('colorInput.vue', () => { | ||
it('disables the input when disabled prop is true', () => { | ||
const wrapper = shallowMount( | ||
ColorInput, | ||
{ props: { disabled: true } } | ||
); | ||
|
||
const colorWrapper = wrapper.find('.color-input'); | ||
const colorInput = wrapper.find('input'); | ||
|
||
expect(colorWrapper.classes()).toContain('disabled'); | ||
expect(Object.keys(colorInput.attributes())).toContain('disabled'); | ||
}); | ||
|
||
it('defaults to enabled when no disabled prop is passed', () => { | ||
const wrapper = shallowMount(ColorInput); | ||
|
||
const colorWrapper = wrapper.find('.color-input'); | ||
const colorInput = wrapper.find('input'); | ||
|
||
expect(colorWrapper.classes()).not.toContain('disabled'); | ||
expect(Object.keys(colorInput.attributes())).not.toContain('disabled'); | ||
}); | ||
}); |