Home / File/ tree.spec.ts — vue Source File

tree.spec.ts — vue Source File

Architecture documentation for tree.spec.ts, a typescript file in the vue codebase. 3 imports, 0 dependents.

File typescript VueCore 3 imports

Entity Profile

Dependency Diagram

graph LR
  50fab577_d7fb_4b56_732d_67fbff58bf10["tree.spec.ts"]
  89e1d5c3_816b_464a_8e3e_7496dffe6752["e2eUtils.ts"]
  50fab577_d7fb_4b56_732d_67fbff58bf10 --> 89e1d5c3_816b_464a_8e3e_7496dffe6752
  29f97b51_38b6_0943_0c18_913d76c86b26["setupPuppeteer"]
  50fab577_d7fb_4b56_732d_67fbff58bf10 --> 29f97b51_38b6_0943_0c18_913d76c86b26
  0409ae0b_e495_6959_8f5e_6f3562f01086["getExampleUrl"]
  50fab577_d7fb_4b56_732d_67fbff58bf10 --> 0409ae0b_e495_6959_8f5e_6f3562f01086
  style 50fab577_d7fb_4b56_732d_67fbff58bf10 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { setupPuppeteer, getExampleUrl, E2E_TIMEOUT } from './e2eUtils'

describe('e2e: tree', () => {
  const { page, click, count, text, childrenCount, isVisible } =
    setupPuppeteer()

  async function testTree(apiType: 'classic' | 'composition') {
    await page().goto(getExampleUrl('tree', apiType))
    expect(await count('.item')).toBe(12)
    expect(await count('.add')).toBe(4)
    expect(await count('.item > ul')).toBe(4)
    expect(await isVisible('#demo li ul')).toBe(false)
    expect(await text('#demo li div span')).toBe('[+]')

    // expand root
    await click('.bold')
    expect(await isVisible('#demo ul')).toBe(true)
    expect(await childrenCount('#demo li ul')).toBe(4)
    expect(await text('#demo li div span')).toContain('[-]')
    expect(await text('#demo > .item > ul > .item:nth-child(1)')).toContain(
      'hello'
    )
    expect(await text('#demo > .item > ul > .item:nth-child(2)')).toContain(
      'wat'
    )
    expect(await text('#demo > .item > ul > .item:nth-child(3)')).toContain(
      'child folder'
    )
    expect(await text('#demo > .item > ul > .item:nth-child(3)')).toContain(
      '[+]'
    )

    // add items to root
    await click('#demo > .item > ul > .add')
    expect(await childrenCount('#demo li ul')).toBe(5)
    expect(await text('#demo > .item > ul > .item:nth-child(1)')).toContain(
      'hello'
    )
    expect(await text('#demo > .item > ul > .item:nth-child(2)')).toContain(
      'wat'
    )
    expect(await text('#demo > .item > ul > .item:nth-child(3)')).toContain(
      'child folder'
    )
    expect(await text('#demo > .item > ul > .item:nth-child(3)')).toContain(
      '[+]'
    )
    expect(await text('#demo > .item > ul > .item:nth-child(4)')).toContain(
      'new stuff'
    )

    // add another item
    await click('#demo > .item > ul > .add')
    expect(await childrenCount('#demo li ul')).toBe(6)
    expect(await text('#demo > .item > ul > .item:nth-child(1)')).toContain(
      'hello'
    )
    expect(await text('#demo > .item > ul > .item:nth-child(2)')).toContain(
      'wat'
    )
    expect(await text('#demo > .item > ul > .item:nth-child(3)')).toContain(
      'child folder'
    )
    expect(await text('#demo > .item > ul > .item:nth-child(3)')).toContain(
      '[+]'
    )
    expect(await text('#demo > .item > ul > .item:nth-child(4)')).toContain(
      'new stuff'
    )
    expect(await text('#demo > .item > ul > .item:nth-child(5)')).toContain(
      'new stuff'
    )

    await click('#demo ul .bold')
    expect(await isVisible('#demo ul ul')).toBe(true)
    expect(await text('#demo ul > .item:nth-child(3)')).toContain('[-]')
    expect(await childrenCount('#demo ul ul')).toBe(5)

    await click('.bold')
    expect(await isVisible('#demo ul')).toBe(false)
    expect(await text('#demo li div span')).toContain('[+]')
    await click('.bold')
    expect(await isVisible('#demo ul')).toBe(true)
    expect(await text('#demo li div span')).toContain('[-]')

    await click('#demo ul > .item div', { clickCount: 2 })
    expect(await count('.item')).toBe(15)
    expect(await count('.item > ul')).toBe(5)
    expect(await text('#demo ul > .item:nth-child(1)')).toContain('[-]')
    expect(await childrenCount('#demo ul > .item:nth-child(1) > ul')).toBe(2)
  }

  test(
    'classic',
    async () => {
      await testTree('classic')
    },
    E2E_TIMEOUT
  )

  test(
    'composition',
    async () => {
      await testTree('composition')
    },
    E2E_TIMEOUT
  )
})

Domain

Frequently Asked Questions

What does tree.spec.ts do?
tree.spec.ts is a source file in the vue codebase, written in typescript. It belongs to the VueCore domain.
What does tree.spec.ts depend on?
tree.spec.ts imports 3 module(s): e2eUtils.ts, getExampleUrl, setupPuppeteer.
Where is tree.spec.ts in the architecture?
tree.spec.ts is located at test/e2e/tree.spec.ts (domain: VueCore, directory: test/e2e).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free