Skip to content

Commit

Permalink
add e2e test for reordering + component state persistence case
Browse files Browse the repository at this point in the history
  • Loading branch information
LankyMoose committed Jun 30, 2024
1 parent e572679 commit 9fc10e2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions e2e/cypress/e2e/reactivity.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ describe("basic reactivity & state", () => {
cy.get("main #counter button").click().click()
cy.get("main #counter p").should("exist")
})

it("correctly persists component state when order of children changes", () => {
cy.get("main #counter button").click().click()
cy.get("main #toggle-btn").click()
cy.get("main #counter span").should("have.text", "2")
})
})

describe("hooks & data", () => {
Expand Down
5 changes: 5 additions & 0 deletions e2e/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@ import { Link, Route, Router, memo, useModel, useState } from "kaioken"
import { Counter } from "./Counter"

export function App() {
const [toggled, setToggled] = useState(false)
return (
<main>
<header>
<h1>Hello World</h1>
</header>
{toggled && <p>Toggled</p>}
<Counter />
<TodoList />
<button id="toggle-btn" onclick={() => setToggled(!toggled)}>
toggle
</button>
<nav>
<ul>
<li>
Expand Down

0 comments on commit 9fc10e2

Please sign in to comment.