diff options
| author | Akshay Nair <phenax5@gmail.com> | 2023-08-13 18:35:31 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2023-08-13 18:35:31 +0530 |
| commit | 2f3de513168ac8a912e4b6540907492437a5f834 (patch) | |
| tree | 957c286eb8b0806d82279d7596f5f47425d3a9a8 /tests | |
| parent | 95602d1b1ac5668772d5d400270b4209ee19057b (diff) | |
| download | css-everything-2f3de513168ac8a912e4b6540907492437a5f834.tar.gz css-everything-2f3de513168ac8a912e4b6540907492437a5f834.zip | |
feat: adds checked test case + implements pure actions flag + minor changes
Diffstat (limited to '')
| -rw-r--r-- | tests/fixtures/todo-app/index.html | 26 | ||||
| -rw-r--r-- | tests/todo-app.spec.ts | 14 |
2 files changed, 29 insertions, 11 deletions
diff --git a/tests/fixtures/todo-app/index.html b/tests/fixtures/todo-app/index.html index 25ccde7..bbf0963 100644 --- a/tests/fixtures/todo-app/index.html +++ b/tests/fixtures/todo-app/index.html @@ -8,31 +8,35 @@ } #task-input-form { + /* prettier-ignore */ --cssx-on-submit: prevent-default() - add-children(task-list, - instance(li#task-item, map(--text: attr(text-input, 'value'))) - ) - ; + add-children( + task-list, + instance(div#task-item, map(--text: attr(text-input, 'value'))) + ); + /* prettier-ignore */ --cssx-children: - input#text-input[data-testid="add-task-input"] - button#create-task-btn[type="submit"][data-testid="add-task-btn"] + input#text-input[data-testid=add-task-input] + button#create-task-btn[type=submit][data-testid=add-task-btn] ; } - #text-input {} + #text-input { + } #create-task-btn { - --cssx-text: "Submit"; + --cssx-text: 'Submit'; } - [data-instance="task-item"] { + [data-instance='task-item'] { --text: default text; - --checked: 0; + --checked: '0'; --cssx-on-mount: set-attr('data-testid', attr(id)); + --cssx-on-click: update(--checked, '1'); } - [data-instance="task-item"]::after { + [data-instance='task-item']::after { content: var(--text); } </style> diff --git a/tests/todo-app.spec.ts b/tests/todo-app.spec.ts index 7fe7d2f..6595bbf 100644 --- a/tests/todo-app.spec.ts +++ b/tests/todo-app.spec.ts @@ -49,5 +49,19 @@ describe('todo-app example', () => { 'Kill all the non-believers', ) }) + + // TODO: Add toggle state after implementing conditionals + it('should check item when clicked', async () => { + expect( + getComputedStyle($taskItems[0]).getPropertyValue('--checked'), + ).toBe(`'0'`) + + $taskItems[0].click() + await delay(100) + + expect( + getComputedStyle($taskItems[0]).getPropertyValue('--checked'), + ).toBe(`"1"`) // TODO: look into the quotes issue + }) }) }) |
