aboutsummaryrefslogtreecommitdiff
path: root/tests/todo-app.spec.ts
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2023-08-13 18:46:16 +0530
committerAkshay Nair <phenax5@gmail.com>2023-08-13 18:56:10 +0530
commit78550c0d1c7037b17bdaa9413351b759b20772c0 (patch)
tree2fbef895d94698ec3ec20fe961493748c1a6f1c0 /tests/todo-app.spec.ts
parent2f3de513168ac8a912e4b6540907492437a5f834 (diff)
downloadcss-everything-78550c0d1c7037b17bdaa9413351b759b20772c0.tar.gz
css-everything-78550c0d1c7037b17bdaa9413351b759b20772c0.zip
feat: adds conditionals
Diffstat (limited to 'tests/todo-app.spec.ts')
-rw-r--r--tests/todo-app.spec.ts25
1 files changed, 19 insertions, 6 deletions
diff --git a/tests/todo-app.spec.ts b/tests/todo-app.spec.ts
index 6595bbf..624efb9 100644
--- a/tests/todo-app.spec.ts
+++ b/tests/todo-app.spec.ts
@@ -1,4 +1,4 @@
-import { getByTestId, prettyDOM } from '@testing-library/dom'
+import { getByTestId } from '@testing-library/dom'
import '@testing-library/jest-dom'
import { delay, loadHTMLFixture } from './util'
@@ -13,7 +13,7 @@ describe('todo-app example', () => {
$textInput.value = text
$addBtn.click()
- await delay(100)
+ await delay(10)
$taskItems = [
...document.querySelectorAll<HTMLElement>(
'[data-instance="task-item"]',
@@ -50,18 +50,31 @@ describe('todo-app example', () => {
)
})
- // TODO: Add toggle state after implementing conditionals
it('should check item when clicked', async () => {
expect(
getComputedStyle($taskItems[0]).getPropertyValue('--checked'),
- ).toBe(`'0'`)
+ ).toBe(`false`)
$taskItems[0].click()
- await delay(100)
+ await delay(10)
expect(
getComputedStyle($taskItems[0]).getPropertyValue('--checked'),
- ).toBe(`"1"`) // TODO: look into the quotes issue
+ ).toBe(`"true"`) // TODO: look into the quotes issue
+
+ $taskItems[0].click()
+ await delay(10)
+
+ expect(
+ getComputedStyle($taskItems[0]).getPropertyValue('--checked'),
+ ).toBe(`"false"`) // TODO: look into the quotes issue
+
+ $taskItems[0].click()
+ await delay(10)
+
+ expect(
+ getComputedStyle($taskItems[0]).getPropertyValue('--checked'),
+ ).toBe(`"true"`) // TODO: look into the quotes issue
})
})
})