Sukanya Pandey | e881499 | 2021-01-04 12:05:30 +0530 | [diff] [blame] | 1 | import { mount, createLocalVue } from '@vue/test-utils'; |
| 2 | import InputPasswordToggle from '@/components/Global/InputPasswordToggle'; |
| 3 | import BootstrapVue from 'bootstrap-vue'; |
| 4 | |
| 5 | const localVue = createLocalVue(); |
| 6 | localVue.use(BootstrapVue); |
| 7 | |
| 8 | describe('InputPasswordToggle.vue', () => { |
| 9 | const wrapper = mount(InputPasswordToggle, { |
| 10 | localVue, |
| 11 | data() { |
| 12 | return { |
| 13 | isVisible: false, |
| 14 | }; |
| 15 | }, |
| 16 | mocks: { |
| 17 | $t: (key) => key, |
| 18 | }, |
| 19 | }); |
| 20 | it('should exist', () => { |
| 21 | expect(wrapper.exists()).toBe(true); |
| 22 | }); |
| 23 | it('should not render isVisible class', () => { |
| 24 | expect(wrapper.find('.isVisible').exists()).toBe(false); |
| 25 | }); |
| 26 | it('should render isVisible class when button is clicked', async () => { |
| 27 | await wrapper.find('button').trigger('click'); |
| 28 | expect(wrapper.find('.isVisible').exists()).toBe(true); |
| 29 | }); |
| 30 | it('should render correctly', () => { |
| 31 | expect(wrapper.element).toMatchSnapshot(); |
| 32 | }); |
| 33 | }); |