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