test: fix tests w/ nested CompoundExpressions
This commit is contained in:
		
							parent
							
								
									c952321fcf
								
							
						
					
					
						commit
						8f9e85afb1
					
				@ -99,7 +99,7 @@ exports[`compiler: codegen compound expression 1`] = `
 | 
			
		||||
"
 | 
			
		||||
return function render() {
 | 
			
		||||
  with (this) {
 | 
			
		||||
    return _ctx.foo + _toDisplayString(bar)
 | 
			
		||||
    return _ctx.foo + _toDisplayString(bar) + nested
 | 
			
		||||
  }
 | 
			
		||||
}"
 | 
			
		||||
`;
 | 
			
		||||
 | 
			
		||||
@ -207,12 +207,14 @@ describe('compiler: codegen', () => {
 | 
			
		||||
            type: NodeTypes.INTERPOLATION,
 | 
			
		||||
            loc: locStub,
 | 
			
		||||
            content: createSimpleExpression(`bar`, false, locStub)
 | 
			
		||||
          }
 | 
			
		||||
          },
 | 
			
		||||
          // nested compound
 | 
			
		||||
          createCompoundExpression([` + `, `nested`])
 | 
			
		||||
        ])
 | 
			
		||||
      })
 | 
			
		||||
    )
 | 
			
		||||
    expect(code).toMatch(
 | 
			
		||||
      `return _ctx.foo + _${helperNameMap[TO_DISPLAY_STRING]}(bar)`
 | 
			
		||||
      `return _ctx.foo + _${helperNameMap[TO_DISPLAY_STRING]}(bar) + nested`
 | 
			
		||||
    )
 | 
			
		||||
    expect(code).toMatchSnapshot()
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
@ -190,6 +190,8 @@ describe('compiler: transform v-model', () => {
 | 
			
		||||
      value: {
 | 
			
		||||
        children: [
 | 
			
		||||
          '$event => (',
 | 
			
		||||
          {
 | 
			
		||||
            children: [
 | 
			
		||||
              {
 | 
			
		||||
                content: '_ctx.model',
 | 
			
		||||
                isStatic: false
 | 
			
		||||
@ -199,7 +201,9 @@ describe('compiler: transform v-model', () => {
 | 
			
		||||
                content: '_ctx.index',
 | 
			
		||||
                isStatic: false
 | 
			
		||||
              },
 | 
			
		||||
          ']',
 | 
			
		||||
              ']'
 | 
			
		||||
            ]
 | 
			
		||||
          },
 | 
			
		||||
          ' = $event)'
 | 
			
		||||
        ]
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
@ -168,11 +168,16 @@ describe('compiler: transform v-on', () => {
 | 
			
		||||
        type: NodeTypes.COMPOUND_EXPRESSION,
 | 
			
		||||
        children: [
 | 
			
		||||
          `$event => (`,
 | 
			
		||||
          {
 | 
			
		||||
            type: NodeTypes.COMPOUND_EXPRESSION,
 | 
			
		||||
            children: [
 | 
			
		||||
              { content: `_ctx.foo` },
 | 
			
		||||
              `(`,
 | 
			
		||||
              // should NOT prefix $event
 | 
			
		||||
              { content: `$event` },
 | 
			
		||||
          `)`,
 | 
			
		||||
              `)`
 | 
			
		||||
            ]
 | 
			
		||||
          },
 | 
			
		||||
          `)`
 | 
			
		||||
        ]
 | 
			
		||||
      }
 | 
			
		||||
@ -191,13 +196,17 @@ describe('compiler: transform v-on', () => {
 | 
			
		||||
        type: NodeTypes.COMPOUND_EXPRESSION,
 | 
			
		||||
        children: [
 | 
			
		||||
          `$event => {`,
 | 
			
		||||
          {
 | 
			
		||||
            children: [
 | 
			
		||||
              { content: `_ctx.foo` },
 | 
			
		||||
              `(`,
 | 
			
		||||
              // should NOT prefix $event
 | 
			
		||||
              { content: `$event` },
 | 
			
		||||
              `);`,
 | 
			
		||||
              { content: `_ctx.bar` },
 | 
			
		||||
          `()`,
 | 
			
		||||
              `()`
 | 
			
		||||
            ]
 | 
			
		||||
          },
 | 
			
		||||
          `}`
 | 
			
		||||
        ]
 | 
			
		||||
      }
 | 
			
		||||
@ -363,7 +372,11 @@ describe('compiler: transform v-on', () => {
 | 
			
		||||
        index: 1,
 | 
			
		||||
        value: {
 | 
			
		||||
          type: NodeTypes.COMPOUND_EXPRESSION,
 | 
			
		||||
          children: [`$event => (`, { content: `_ctx.foo` }, `++`, `)`]
 | 
			
		||||
          children: [
 | 
			
		||||
            `$event => (`,
 | 
			
		||||
            { children: [{ content: `_ctx.foo` }, `++`] },
 | 
			
		||||
            `)`
 | 
			
		||||
          ]
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user