@@ -562,6 +562,12 @@ describe("Compiler", () => {
562562 expect ( output ) . toBe ( `h(Container, { obj: computed(() => ({ foo: bar(), nested: baz })) })` ) ;
563563 } ) ;
564564
565+ test ( 'should compile object attribute with spread and function' , ( ) => {
566+ const input = `<Container obj={{ ...base, count: total() }} />` ;
567+ const output = parser . parse ( input ) ;
568+ expect ( output ) . toBe ( `h(Container, { obj: computed(() => ({ ...base, count: total() })) })` ) ;
569+ } ) ;
570+
565571 test ( "should compile component with complex object attribute" , ( ) => {
566572 const input = `<Sprite
567573 sheet={{
@@ -655,6 +661,12 @@ describe("Compiler", () => {
655661 expect ( output ) . toBe ( `h(Canvas, { width: computed(() => [x(), 20]) })` ) ;
656662 } ) ;
657663
664+ test ( "should compile component with array attribute containing expression without computed" , ( ) => {
665+ const input = `<Canvas width={ [x + 1, y] } />` ;
666+ const output = parser . parse ( input ) ;
667+ expect ( output ) . toBe ( `h(Canvas, { width: [x + 1, y] })` ) ;
668+ } ) ;
669+
658670 test ( "should compile component with standalone dynamic attribute" , ( ) => {
659671 const input = `<Canvas width />` ;
660672 const output = parser . parse ( input ) ;
@@ -751,6 +763,12 @@ describe("Compiler", () => {
751763 expect ( output ) . toBe ( `h(Sprite, { click: selected() })` ) ;
752764 } ) ;
753765
766+ test ( 'should compile component with complex event handler expression without computed' , ( ) => {
767+ const input = `<Sprite click={selected() ? onA : onB} />` ;
768+ const output = parser . parse ( input ) ;
769+ expect ( output ) . toBe ( `h(Sprite, { click: selected() ? onA : onB })` ) ;
770+ } ) ;
771+
754772 test ( "should compile component with component attribute" , ( ) => {
755773 const input = `<Canvas child={<Sprite />} />` ;
756774 const output = parser . parse ( input ) ;
@@ -816,6 +834,12 @@ describe("Compiler", () => {
816834 expect ( output ) . toBe ( `h(DOMElement, { element: "p", textContent: computed(() => a + b()) })` ) ;
817835 } ) ;
818836
837+ test ( "should compile text content with multiple function calls" , ( ) => {
838+ const input = `<p>{a() + b()}</p>` ;
839+ const output = parser . parse ( input ) ;
840+ expect ( output ) . toBe ( `h(DOMElement, { element: "p", textContent: computed(() => a() + b()) })` ) ;
841+ } ) ;
842+
819843 test ( "should compile text content with dot notation without computed" , ( ) => {
820844 const input = `<p>{user.name}</p>` ;
821845 const output = parser . parse ( input ) ;
@@ -1025,6 +1049,16 @@ describe("Condition", () => {
10251049 expect ( output ) . toBe ( `cond(val(), () => h(Sprite))` ) ;
10261050 } ) ;
10271051
1052+ test ( "should compile condition with function call without computed" , ( ) => {
1053+ const input = `
1054+ @if (isVisible()) {
1055+ <Sprite />
1056+ }
1057+ ` ;
1058+ const output = parser . parse ( input ) ;
1059+ expect ( output ) . toBe ( `cond(isVisible(), () => h(Sprite))` ) ;
1060+ } ) ;
1061+
10281062 test ( "should compile condition for multiple sprites" , ( ) => {
10291063 const input = `
10301064 @if (sprite) {
0 commit comments