Skip to content

Commit 1972dba

Browse files
committed
style: format code
1 parent 3a83e66 commit 1972dba

File tree

1 file changed

+50
-35
lines changed

1 file changed

+50
-35
lines changed

packages/babel-plugin-jsx/test/index.test.tsx

Lines changed: 50 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
defineComponent,
55
CSSProperties,
66
ComponentPublicInstance,
7+
Transition,
78
} from 'vue';
89
import { shallowMount, mount, VueWrapper } from '@vue/test-utils';
910

@@ -415,31 +416,37 @@ describe('variables outside slots', () => {
415416
A.inheritAttrs = false;
416417

417418
test('internal', async () => {
418-
const wrapper = mount(defineComponent({
419-
data() {
420-
return {
421-
val: 0,
422-
};
423-
},
424-
methods: {
425-
inc() {
426-
this.val += 1;
419+
const wrapper = mount(
420+
defineComponent({
421+
data() {
422+
return {
423+
val: 0,
424+
};
427425
},
428-
},
429-
render() {
430-
const attrs = {
431-
innerHTML: `${this.val}`,
432-
};
433-
return (
434-
<A inc={this.inc}>
435-
<div>
436-
<textarea id="textarea" {...attrs} />
437-
</div>
438-
<button id="button" onClick={this.inc}>+1</button>
439-
</A>
440-
);
441-
},
442-
}));
426+
methods: {
427+
inc() {
428+
this.val += 1;
429+
},
430+
},
431+
render() {
432+
const attrs = {
433+
innerHTML: `${this.val}`,
434+
};
435+
return (
436+
<A inc={this.inc}>
437+
<div>
438+
<Transition name="foo">
439+
<textarea id="textarea" {...attrs} />
440+
</Transition>
441+
</div>
442+
<button id="button" onClick={this.inc}>
443+
+1
444+
</button>
445+
</A>
446+
);
447+
},
448+
}),
449+
);
443450

444451
expect(wrapper.get('#textarea').element.innerHTML).toBe('0');
445452
await wrapper.get('#button').trigger('click');
@@ -466,7 +473,9 @@ describe('variables outside slots', () => {
466473
return (
467474
<A inc={this.inc}>
468475
<div>{textarea}</div>
469-
<button id="button" onClick={this.inc}>+1</button>
476+
<button id="button" onClick={this.inc}>
477+
+1
478+
</button>
470479
</A>
471480
);
472481
},
@@ -562,9 +571,7 @@ describe('should support passing object slots via JSX children', () => {
562571
test('single expression, function expression', () => {
563572
const wrapper = mount({
564573
render() {
565-
return (
566-
<A>{() => 'foo'}</A>
567-
);
574+
return <A>{() => 'foo'}</A>;
568575
},
569576
});
570577

@@ -576,9 +583,7 @@ describe('should support passing object slots via JSX children', () => {
576583

577584
const wrapper = mount({
578585
render() {
579-
return (
580-
<A>{foo}</A>
581-
);
586+
return <A>{foo}</A>;
582587
},
583588
});
584589

@@ -592,13 +597,19 @@ describe('should support passing object slots via JSX children', () => {
592597
render() {
593598
return (
594599
<>
595-
{data.map((item) => <A><span>{item}</span></A>)}
600+
{data.map((item) => (
601+
<A>
602+
<span>{item}</span>
603+
</A>
604+
))}
596605
</>
597606
);
598607
},
599608
});
600609

601-
expect(wrapper.html()).toBe('<span><span>A</span><!----></span><span><span>B</span><!----></span><span><span>C</span><!----></span>');
610+
expect(wrapper.html()).toBe(
611+
'<span><span>A</span><!----></span><span><span>B</span><!----></span><span><span>C</span><!----></span>',
612+
);
602613
});
603614

604615
test('xx', () => {
@@ -608,12 +619,16 @@ describe('should support passing object slots via JSX children', () => {
608619
render() {
609620
return (
610621
<>
611-
{data.map((item) => <A>{() => <span>{item}</span>}</A>)}
622+
{data.map((item) => (
623+
<A>{() => <span>{item}</span>}</A>
624+
))}
612625
</>
613626
);
614627
},
615628
});
616629

617-
expect(wrapper.html()).toBe('<span><span>A</span><!----></span><span><span>B</span><!----></span><span><span>C</span><!----></span>');
630+
expect(wrapper.html()).toBe(
631+
'<span><span>A</span><!----></span><span><span>B</span><!----></span><span><span>C</span><!----></span>',
632+
);
618633
});
619634
});

0 commit comments

Comments
 (0)