diff options
author | Sukanya Pandey <sukapan1@in.ibm.com> | 2021-01-04 09:35:30 +0300 |
---|---|---|
committer | Yoshie Muranaka <yoshiemuranaka@gmail.com> | 2021-01-07 01:02:16 +0300 |
commit | e881499e182bdb7030920c9dc81bfbf423ae620c (patch) | |
tree | 685ae51e72fa66738985957537cce58596193cd0 /tests/unit/Global/InputPasswordToggle.spec.js | |
parent | 5fe1c3fed73164d4fe82ebb142cefbca72c2e706 (diff) | |
download | webui-vue-e881499e182bdb7030920c9dc81bfbf423ae620c.tar.xz |
Add test case for input password toggle component
Signed-off-by: Sukanya Pandey <sukapan1@in.ibm.com>
Change-Id: I00e3fc12a58d644d0aad3c0caf4a94d2ed435109
Diffstat (limited to 'tests/unit/Global/InputPasswordToggle.spec.js')
-rw-r--r-- | tests/unit/Global/InputPasswordToggle.spec.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/unit/Global/InputPasswordToggle.spec.js b/tests/unit/Global/InputPasswordToggle.spec.js new file mode 100644 index 00000000..4a3a0b0e --- /dev/null +++ b/tests/unit/Global/InputPasswordToggle.spec.js @@ -0,0 +1,33 @@ +import { mount, createLocalVue } from '@vue/test-utils'; +import InputPasswordToggle from '@/components/Global/InputPasswordToggle'; +import BootstrapVue from 'bootstrap-vue'; + +const localVue = createLocalVue(); +localVue.use(BootstrapVue); + +describe('InputPasswordToggle.vue', () => { + const wrapper = mount(InputPasswordToggle, { + localVue, + data() { + return { + isVisible: false, + }; + }, + mocks: { + $t: (key) => key, + }, + }); + it('should exist', () => { + expect(wrapper.exists()).toBe(true); + }); + it('should not render isVisible class', () => { + expect(wrapper.find('.isVisible').exists()).toBe(false); + }); + it('should render isVisible class when button is clicked', async () => { + await wrapper.find('button').trigger('click'); + expect(wrapper.find('.isVisible').exists()).toBe(true); + }); + it('should render correctly', () => { + expect(wrapper.element).toMatchSnapshot(); + }); +}); |