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 = (
4949 mergeProps : boolean ,
5050 args : ( t . ObjectProperty | t . Expression | t . SpreadElement ) [ ] ,
5151) => {
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 ;
5454 if ( ! properties ) {
5555 if ( argument . isIdentifier ( ) ) {
56- walksScope ( nodePath , ( argument as any ) . name , SlotFlags . DYNAMIC ) ;
56+ walksScope ( nodePath , ( argument . node as t . Identifier ) . name , SlotFlags . DYNAMIC ) ;
5757 }
5858 args . push ( mergeProps ? argument . node : t . spreadElement ( argument . node ) ) ;
5959 } else if ( mergeProps ) {
Original file line number Diff line number Diff line change @@ -414,37 +414,37 @@ describe('variables outside slots', () => {
414414
415415 A . inheritAttrs = false ;
416416
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+ } ) ;
448448
449449 test ( 'forwarded' , async ( ) => {
450450 const wrapper = mount ( {
You can’t perform that action at this time.
0 commit comments