aboutsummaryrefslogtreecommitdiff
path: root/tests/todo-app.spec.ts
blob: 2bdcdee228bb49e3601f88bcd648908c0d05f4d1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { getByTestId, prettyDOM } from '@testing-library/dom'
import '@testing-library/jest-dom'
import { delay, loadHTMLFixture } from './util'

describe('todo-app example', () => {
  describe('Add new task', () => {
    beforeAll(async () => {
      await loadHTMLFixture('todo-app')
    })

    it('should add new unchecked task', async () => {
      const $textInput = getByTestId<HTMLInputElement>(
        document.body,
        'add-task-input',
      )
      $textInput.value = 'Buy Milk'

      const $addBtn = getByTestId<HTMLButtonElement>(
        document.body,
        'add-task-btn',
      )
      $addBtn.click()

      await delay(100)

      console.log(prettyDOM(document.getElementById('task-list')!))
      console.log('-------------------')
    })
  })
})