How to use the @teleporthq/teleport-shared/dist/cjs/builders/uidl-builders.staticNode function in @teleporthq/teleport-shared

To help you get started, we’ve selected a few @teleporthq/teleport-shared 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 teleporthq / teleport-code-generators / packages / teleport-component-generator-react / __tests__ / integration / component-non-element-root.ts View on Github external
it('should support static as root node', async () => {
    const uidl = component('StaticRootComponent', staticNode('Teleport Code Generators'))
    const result = await generator.generateComponent(uidl)
    const jsFile = findFileByType(result.files, JS_FILE)

    expect(jsFile).toBeDefined()
    expect(result.files).toBeDefined()
    expect(jsFile.content).toContain('import React')
    expect(result.dependencies).toBeDefined()
    expect(jsFile.content).toContain(`(props) => 'Teleport Code Generators'`)
    expect(result.files.length).toBeTruthy()
  })
github teleporthq / teleport-code-generators / packages / teleport-component-generator-vue / __tests__ / integration / component-non-element-root.ts View on Github external
it('should support static as root node', async () => {
    const uidl = component('StaticRootComponent', staticNode('Teleport Code Generators'))
    const result = await generator.generateComponent(uidl)
    const file = findFileByType(result.files, VUE_FILE)
    const { content } = file

    expect(VUE_FILE).toBeDefined()
    expect(content).toBeDefined()
    expect(result.files).toBeDefined()
    expect(content).toContain('<span>Teleport Code Generators')
    expect(result.files.length).toBeTruthy()
  })
</span>
github teleporthq / teleport-code-generators / packages / teleport-component-generator-vue / __tests__ / integration / component-non-element-root.ts View on Github external
it('should support conditional array as root node', async () => {
    const uidl = component(
      'ComponentWithConditionalRootArrayNode',
      conditionalNode(
        dynamicNode('state', 'isVisible'),
        elementNode('text', {}, [staticNode('Now you see me!')]),
        true
      ),
      {},
      { isVisible: definition('boolean', true) }
    )

    const result = await generator.generateComponent(uidl)
    const file = findFileByType(result.files, VUE_FILE)
    const { content } = file

    expect(VUE_FILE).toBeDefined()
    expect(result.files).toBeDefined()
    expect(result.files.length).toBeTruthy()
    expect(content).toContain('data() {')
    expect(content).toContain('v-if="isVisible"')
  })
github teleporthq / teleport-code-generators / packages / teleport-component-generator-vue / __tests__ / integration / component-non-element-root.ts View on Github external
it('should support conditional and string as root node', async () =&gt; {
    const uidl = component(
      'ComponentWithConditionalRootStringNode',
      conditionalNode(dynamicNode('state', 'isVisible'), staticNode('Now you can see me!'), true),
      {},
      { isVisible: definition('boolean', true) }
    )

    const result = await generator.generateComponent(uidl)
    const file = findFileByType(result.files, VUE_FILE)
    const { content } = file

    expect(result.files.length).toBeTruthy()
    expect(VUE_FILE).toBeDefined()
    expect(result.files).toBeDefined()
    expect(content).toContain('<span>Now you can see me!</span>')
  })
github teleporthq / teleport-code-generators / packages / teleport-plugin-stencil-css / __tests__ / index.ts View on Github external
it('generates a string chunk out of the styles and adds the className', async () => {
    const style = {
      height: staticNode('100px'),
    }
    const element = elementNode('container', {}, [], null, style)
    element.content.key = 'container'
    const uidlSample = component('test', element)

    const structure: ComponentStructure = {
      uidl: uidlSample,
      options: {},
      chunks: [componentChunk, decoratorChunk],
      dependencies: {},
    }

    const { chunks } = await plugin(structure)

    expect(chunks.length).toBe(3)
    expect(chunks[2].type).toBe('string')