|
| 1 | +import { mount } from '@vue/test-utils'; |
| 2 | +import SecurityCode from '../src'; |
| 3 | + |
| 4 | +describe('props', () => { |
| 5 | + describe('modelValue', () => { |
| 6 | + it('should apply the given modelValue', () => { |
| 7 | + const wrapper = mount(SecurityCode, { |
| 8 | + props: { |
| 9 | + modelValue: '123456', |
| 10 | + }, |
| 11 | + }); |
| 12 | + |
| 13 | + expect(wrapper.props('modelValue')).toEqual('123456'); |
| 14 | + }); |
| 15 | + }); |
| 16 | + |
| 17 | + describe('blurOnComplete', () => { |
| 18 | + it('should not be blurOnComplete by false', () => { |
| 19 | + const wrapper = mount(SecurityCode); |
| 20 | + |
| 21 | + expect(wrapper.props('blurOnComplete')).toBe(false); |
| 22 | + }); |
| 23 | + |
| 24 | + it('should be blurOnComplete', () => { |
| 25 | + const wrapper = mount(SecurityCode, { |
| 26 | + props: { |
| 27 | + blurOnComplete: true, |
| 28 | + }, |
| 29 | + }); |
| 30 | + |
| 31 | + expect(wrapper.props('blurOnComplete')).toBe(true); |
| 32 | + }); |
| 33 | + }); |
| 34 | + |
| 35 | + describe('len', () => { |
| 36 | + it('should not display the len by default', () => { |
| 37 | + const wrapper = mount(SecurityCode); |
| 38 | + |
| 39 | + expect(wrapper.props('len')).toBe(6); |
| 40 | + }); |
| 41 | + |
| 42 | + it('should display the len four', () => { |
| 43 | + const wrapper = mount(SecurityCode, { |
| 44 | + props: { |
| 45 | + len: 4, |
| 46 | + }, |
| 47 | + }); |
| 48 | + |
| 49 | + expect(wrapper.props('len')).toBe(4); |
| 50 | + }); |
| 51 | + }); |
| 52 | + |
| 53 | + describe('isArray', () => { |
| 54 | + it('should not be isArray by false', () => { |
| 55 | + const wrapper = mount(SecurityCode, { |
| 56 | + props: { |
| 57 | + isArray: false, |
| 58 | + }, |
| 59 | + }); |
| 60 | + |
| 61 | + expect(wrapper.props('isArray')).toBe(false); |
| 62 | + }); |
| 63 | + |
| 64 | + it('should by isArray', () => { |
| 65 | + const wrapper = mount(SecurityCode, { |
| 66 | + props: { |
| 67 | + isArray: true, |
| 68 | + }, |
| 69 | + }); |
| 70 | + |
| 71 | + expect(wrapper.props('isArray')).toBe(true); |
| 72 | + }); |
| 73 | + }); |
| 74 | + |
| 75 | + describe('size', () => { |
| 76 | + it('should not be size by default', () => { |
| 77 | + const wrapper = mount(SecurityCode); |
| 78 | + |
| 79 | + expect(wrapper.props('size')).toBe('default'); |
| 80 | + }); |
| 81 | + |
| 82 | + it('should be size by md', () => { |
| 83 | + const wrapper = mount(SecurityCode, { |
| 84 | + props: { |
| 85 | + size: 'md', |
| 86 | + }, |
| 87 | + }); |
| 88 | + |
| 89 | + expect(wrapper.props('size')).toBe('md'); |
| 90 | + }); |
| 91 | + }); |
| 92 | +}); |
0 commit comments