File tree Expand file tree Collapse file tree 2 files changed +34
-34
lines changed
packages/babel-plugin-jsx Expand file tree Collapse file tree 2 files changed +34
-34
lines changed Original file line number Diff line number Diff line change @@ -49,11 +49,11 @@ const transformJSXSpreadAttribute = (
49
49
mergeProps : boolean ,
50
50
args : ( t . ObjectProperty | t . Expression | t . SpreadElement ) [ ] ,
51
51
) => {
52
- const argument = path . get ( 'argument' ) as NodePath < t . ObjectExpression > ;
53
- const { properties } = argument . node ;
52
+ const argument = path . get ( 'argument' ) as NodePath < t . ObjectExpression | t . Identifier > ;
53
+ const properties = t . isObjectExpression ( argument . node ) ? argument . node . properties : undefined ;
54
54
if ( ! properties ) {
55
55
if ( argument . isIdentifier ( ) ) {
56
- walksScope ( nodePath , ( argument as any ) . name , SlotFlags . DYNAMIC ) ;
56
+ walksScope ( nodePath , ( argument . node as t . Identifier ) . name , SlotFlags . DYNAMIC ) ;
57
57
}
58
58
args . push ( mergeProps ? argument . node : t . spreadElement ( argument . node ) ) ;
59
59
} else if ( mergeProps ) {
Original file line number Diff line number Diff line change @@ -414,37 +414,37 @@ describe('variables outside slots', () => {
414
414
415
415
A . inheritAttrs = false ;
416
416
417
- // 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;
427
- // },
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
- // }));
443
-
444
- // expect(wrapper.get('#textarea').element.innerHTML).toBe('0');
445
- // await wrapper.get('#button').trigger('click');
446
- // expect(wrapper.get('#textarea').element.innerHTML).toBe('1');
447
- // });
417
+ 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 ;
427
+ } ,
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
+ } ) ) ;
443
+
444
+ expect ( wrapper . get ( '#textarea' ) . element . innerHTML ) . toBe ( '0' ) ;
445
+ await wrapper . get ( '#button' ) . trigger ( 'click' ) ;
446
+ expect ( wrapper . get ( '#textarea' ) . element . innerHTML ) . toBe ( '1' ) ;
447
+ } ) ;
448
448
449
449
test ( 'forwarded' , async ( ) => {
450
450
const wrapper = mount ( {
You can’t perform that action at this time.
0 commit comments