import { shallowMount } from '@vue/test-utils';
test('should render with setup', () => {
const wrapper = shallowMount({
setup() {
return () =>
123
;
},
});
expect(wrapper.text()).toBe('123');
});
test('Extracts attrs', () => {
const wrapper = shallowMount({
setup() {
return () => ;
},
});
expect(wrapper.element.id).toBe('hi');
expect(wrapper.element.dir).toBe('ltr');
});
test('Binds attrs', () => {
const id = 'foo';
const wrapper = shallowMount({
setup() {
return () => {id}
;
},
});
expect(wrapper.text()).toBe('foo');
});
test('should not fallthrough with inheritAttrs: false', () => {
const Child = (props) => {props.foo}
;
Child.inheritAttrs = false;
const wrapper = shallowMount({
setup() {
return () => (
);
},
});
expect(wrapper.text()).toBe('1');
});
test('should render', () => {
const App = {
render() {
return 1234
;
},
};
const wrapper = shallowMount(App);
expect(wrapper.html()).toBe('1234
');
});
test('xlink:href', () => {
const wrapper = shallowMount({
setup() {
return () => ;
},
});
expect(wrapper.attributes()['xlink:href']).toBe('#name');
});
// // test('Merge class', () => {
// // const wrapper = render(() => );
// // expect(wrapper.innerHTML).toBe('');
// // });
test('JSXSpreadChild', () => {
const a = ['1', '2'];
const wrapper = shallowMount({
setup() {
return () => {[...a]}
;
},
});
expect(wrapper.text).toBe('12');
});
test('domProps input[value]', () => {
const val = 'foo';
const wrapper = shallowMount({
setup() {
return () => ;
},
});
expect(wrapper.html()).toBe('');
});