From 78550c0d1c7037b17bdaa9413351b759b20772c0 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sun, 13 Aug 2023 18:46:16 +0530 Subject: feat: adds conditionals --- tests/todo-app.spec.ts | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'tests/todo-app.spec.ts') 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( '[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 }) }) }) -- cgit v1.3.1