mirror of
https://github.com/vuejs/babel-plugin-jsx.git
synced 2024-11-14 07:29:17 +08:00
style: format code
This commit is contained in:
parent
3a83e668f4
commit
1972dbad32
@ -4,6 +4,7 @@ import {
|
|||||||
defineComponent,
|
defineComponent,
|
||||||
CSSProperties,
|
CSSProperties,
|
||||||
ComponentPublicInstance,
|
ComponentPublicInstance,
|
||||||
|
Transition,
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
import { shallowMount, mount, VueWrapper } from '@vue/test-utils';
|
import { shallowMount, mount, VueWrapper } from '@vue/test-utils';
|
||||||
|
|
||||||
@ -415,7 +416,8 @@ describe('variables outside slots', () => {
|
|||||||
A.inheritAttrs = false;
|
A.inheritAttrs = false;
|
||||||
|
|
||||||
test('internal', async () => {
|
test('internal', async () => {
|
||||||
const wrapper = mount(defineComponent({
|
const wrapper = mount(
|
||||||
|
defineComponent({
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
val: 0,
|
val: 0,
|
||||||
@ -433,13 +435,18 @@ describe('variables outside slots', () => {
|
|||||||
return (
|
return (
|
||||||
<A inc={this.inc}>
|
<A inc={this.inc}>
|
||||||
<div>
|
<div>
|
||||||
|
<Transition name="foo">
|
||||||
<textarea id="textarea" {...attrs} />
|
<textarea id="textarea" {...attrs} />
|
||||||
|
</Transition>
|
||||||
</div>
|
</div>
|
||||||
<button id="button" onClick={this.inc}>+1</button>
|
<button id="button" onClick={this.inc}>
|
||||||
|
+1
|
||||||
|
</button>
|
||||||
</A>
|
</A>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
}));
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
expect(wrapper.get('#textarea').element.innerHTML).toBe('0');
|
expect(wrapper.get('#textarea').element.innerHTML).toBe('0');
|
||||||
await wrapper.get('#button').trigger('click');
|
await wrapper.get('#button').trigger('click');
|
||||||
@ -466,7 +473,9 @@ describe('variables outside slots', () => {
|
|||||||
return (
|
return (
|
||||||
<A inc={this.inc}>
|
<A inc={this.inc}>
|
||||||
<div>{textarea}</div>
|
<div>{textarea}</div>
|
||||||
<button id="button" onClick={this.inc}>+1</button>
|
<button id="button" onClick={this.inc}>
|
||||||
|
+1
|
||||||
|
</button>
|
||||||
</A>
|
</A>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -562,9 +571,7 @@ describe('should support passing object slots via JSX children', () => {
|
|||||||
test('single expression, function expression', () => {
|
test('single expression, function expression', () => {
|
||||||
const wrapper = mount({
|
const wrapper = mount({
|
||||||
render() {
|
render() {
|
||||||
return (
|
return <A>{() => 'foo'}</A>;
|
||||||
<A>{() => 'foo'}</A>
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -576,9 +583,7 @@ describe('should support passing object slots via JSX children', () => {
|
|||||||
|
|
||||||
const wrapper = mount({
|
const wrapper = mount({
|
||||||
render() {
|
render() {
|
||||||
return (
|
return <A>{foo}</A>;
|
||||||
<A>{foo}</A>
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -592,13 +597,19 @@ describe('should support passing object slots via JSX children', () => {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{data.map((item) => <A><span>{item}</span></A>)}
|
{data.map((item) => (
|
||||||
|
<A>
|
||||||
|
<span>{item}</span>
|
||||||
|
</A>
|
||||||
|
))}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(wrapper.html()).toBe('<span><span>A</span><!----></span><span><span>B</span><!----></span><span><span>C</span><!----></span>');
|
expect(wrapper.html()).toBe(
|
||||||
|
'<span><span>A</span><!----></span><span><span>B</span><!----></span><span><span>C</span><!----></span>',
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('xx', () => {
|
test('xx', () => {
|
||||||
@ -608,12 +619,16 @@ describe('should support passing object slots via JSX children', () => {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{data.map((item) => <A>{() => <span>{item}</span>}</A>)}
|
{data.map((item) => (
|
||||||
|
<A>{() => <span>{item}</span>}</A>
|
||||||
|
))}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(wrapper.html()).toBe('<span><span>A</span><!----></span><span><span>B</span><!----></span><span><span>C</span><!----></span>');
|
expect(wrapper.html()).toBe(
|
||||||
|
'<span><span>A</span><!----></span><span><span>B</span><!----></span><span><span>C</span><!----></span>',
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user