summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/fixtures/todo-app/index.html23
-rw-r--r--tests/signup.spec.ts9
-rw-r--r--tests/todo-app.spec.ts7
3 files changed, 15 insertions, 24 deletions
diff --git a/tests/fixtures/todo-app/index.html b/tests/fixtures/todo-app/index.html
index 66a9798..55996f3 100644
--- a/tests/fixtures/todo-app/index.html
+++ b/tests/fixtures/todo-app/index.html
@@ -10,7 +10,11 @@
#task-input-form {
--cssx-on-submit:
prevent-default()
- js-eval('console.log("todo: implement add new task")')
+ add-children(task-list,
+ instance(li#task-item, map(
+ --text: "Hello world",
+ ))
+ )
;
--cssx-children:
@@ -21,24 +25,13 @@
#text-input {}
#create-task-btn {
- --cssx-text: Submit;
+ --cssx-text: "Submit";
}
- #task-list {
- --cssx-children:
- instance(li#task-item, map(
- --text: "hello world",
- --checked: 0
- ))
- instance(li#task-item, map(
- --text: "coolio stuff",
- --checked: 0
- ))
- ;
- }
+ #task-list { }
[data-instance="task-item"] {
- --text: "default text";
+ --text: default text;
--checked: 0;
--cssx-text: var(--text);
diff --git a/tests/signup.spec.ts b/tests/signup.spec.ts
index 1317049..4764d7f 100644
--- a/tests/signup.spec.ts
+++ b/tests/signup.spec.ts
@@ -3,6 +3,7 @@ import {
waitFor,
getByText,
getByTestId,
+ prettyDOM,
} from '@testing-library/dom'
import '@testing-library/jest-dom'
import { delay, loadHTMLFixture } from './util'
@@ -33,9 +34,9 @@ describe('signup example', () => {
beforeEach(async () => {
const $showFormBtn = document.getElementById('show-form-btn')!
fireEvent.click($showFormBtn)
- await waitFor(() => expect($showFormBtn).not.toBeVisible())
- const $form = document.getElementById('signup-form')!
- expect($form).toBeVisible()
+ await waitFor(() =>
+ expect(document.getElementById('signup-form')).toBeVisible(),
+ )
await delay(100) // Wait for mounting
})
@@ -48,7 +49,7 @@ describe('signup example', () => {
const $password = getByTestId<HTMLInputElement>(document.body, 'password')
$password.value = 'password'
- await delay(2000)
+ await delay(100)
// Submit form
const $submitBtn = getByText(document.body, 'Submit')
diff --git a/tests/todo-app.spec.ts b/tests/todo-app.spec.ts
index 1e0cd72..2bdcdee 100644
--- a/tests/todo-app.spec.ts
+++ b/tests/todo-app.spec.ts
@@ -23,11 +23,8 @@ describe('todo-app example', () => {
await delay(100)
- console.log(prettyDOM(document.body))
- console.log()
- console.log()
- console.log()
- console.log()
+ console.log(prettyDOM(document.getElementById('task-list')!))
+ console.log('-------------------')
})
})
})