How to use the @vue/compiler-core.NodeTypes.JS_OBJECT_EXPRESSION function in @vue/compiler-core

To help you get started, we’ve selected a few @vue/compiler-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vuejs / vue-next / packages / compiler-dom / __tests__ / transforms / transformStyle.spec.ts View on Github external
test('working with v-bind transform', () => {
    const { node } = transformWithStyleTransform(`<div style="color: red">`, {
      nodeTransforms: [transformStyle, transformElement],
      directiveTransforms: {
        bind: transformBind
      }
    })
    expect((node.codegenNode as CallExpression).arguments[1]).toMatchObject({
      type: NodeTypes.JS_OBJECT_EXPRESSION,
      properties: [
        {
          key: {
            type: NodeTypes.SIMPLE_EXPRESSION,
            content: `style`,
            isStatic: true
          },
          value: {
            type: NodeTypes.SIMPLE_EXPRESSION,
            content: `_hoisted_1`,
            isStatic: false
          }
        }
      ]
    })
    // should not cause the STYLE patchFlag to be attached</div>
github vuejs / vue-next / packages / compiler-dom / __tests__ / transforms / vOn.spec.ts View on Github external
test('cache handler w/ modifiers', () =&gt; {
    const {
      root,
      props: [prop]
    } = parseWithVOn(`<div>`, {
      prefixIdentifiers: true,
      cacheHandlers: true
    })
    expect(root.cached).toBe(1)
    // should not treat cached handler as dynamicProp, so no flags
    expect((root as any).children[0].codegenNode.arguments.length).toBe(2)
    expect(prop.value).toMatchObject({
      type: NodeTypes.JS_CACHE_EXPRESSION,
      index: 1,
      value: {
        type: NodeTypes.JS_OBJECT_EXPRESSION,
        properties: [
          {
            key: { content: 'handler' },
            value: {
              type: NodeTypes.JS_CALL_EXPRESSION,
              callee: V_ON_WITH_KEYS
            }
          },
          {
            key: { content: 'options' },
            value: { type: NodeTypes.JS_OBJECT_EXPRESSION }
          }
        ]
      }
    })
  })</div>
github vuejs / vue-next / packages / compiler-dom / __tests__ / transforms / vOn.spec.ts View on Github external
expect(prop.value).toMatchObject({
      type: NodeTypes.JS_CACHE_EXPRESSION,
      index: 1,
      value: {
        type: NodeTypes.JS_OBJECT_EXPRESSION,
        properties: [
          {
            key: { content: 'handler' },
            value: {
              type: NodeTypes.JS_CALL_EXPRESSION,
              callee: V_ON_WITH_KEYS
            }
          },
          {
            key: { content: 'options' },
            value: { type: NodeTypes.JS_OBJECT_EXPRESSION }
          }
        ]
      }
    })
  })
})