test: add unit test case

This commit is contained in:
Sagi 2022-09-18 23:13:57 +08:00
parent 39d041bb2a
commit beb144c86c
1 changed files with 51 additions and 11 deletions

View File

@ -1,17 +1,57 @@
import { mount } from '@vue/test-utils';
import { ButtonEdit } from '..';
describe('f-input-group', () => {
it('variant', () => {
const wrapper = mount({
setup() {
return () => {
return <ButtonEdit editable={false}></ButtonEdit>;
};
},
});
describe('f-button-edit', () => {
const mocks = {};
expect(wrapper.find('.f-cmp-inputgroup').exists()).toBeTruthy();
expect(wrapper.find('div').find('div').find('input').find('[readlony]').exists).toBeTruthy();
beforeAll(() => {});
describe('properties', () => {
it('should has default props', () => {});
it('should has auto complete', () => {});
it('should net has auto complete', () => {});
it('should be disabled', () => {});
it('should net be disabled', () => {});
it('should be editable', () => {
const wrapper = mount({
setup(props, ctx) {
return () => {
return <ButtonEdit editable={true}></ButtonEdit>;
};
},
});
expect(wrapper.find('div').find('div').find('input').attributes['readonly']).toBeFalsy();
});
it('should not be editable', () => {
const wrapper = mount({
setup(props, ctx) {
return () => {
return <ButtonEdit editable={false}></ButtonEdit>;
};
},
});
expect(wrapper.find('.f-cmp-inputgroup').exists()).toBeTruthy();
expect(wrapper.find('div').find('div').find('input').find('[readonly]').exists).toBeTruthy();
});
it('should show clear button', () => {});
it('should not show clear button', () => {});
it('should be readonly', () => {});
it('should not be readonly', () => {});
it('should enable text alignment', () => {});
it('should show append button even be disabled', () => {});
it('should has title', () => {});
it('should has type', () => {});
it('should has placeholder', () => {});
it('should has min length', () => {});
it('should has max length', () => {});
it('should has tab index', () => {});
});
describe('render', () => {});
describe('methods', () => {});
describe('events', () => {});
describe('behaviors', () => {});
});