aboutsummaryrefslogtreecommitdiff
path: root/tests/todo-app.spec.ts
diff options
context:
space:
mode:
Diffstat (limited to 'tests/todo-app.spec.ts')
-rw-r--r--tests/todo-app.spec.ts33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/todo-app.spec.ts b/tests/todo-app.spec.ts
new file mode 100644
index 0000000..1e0cd72
--- /dev/null
+++ b/tests/todo-app.spec.ts
@@ -0,0 +1,33 @@
+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.body))
+ console.log()
+ console.log()
+ console.log()
+ console.log()
+ })
+ })
+})