-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e6017d7
commit 2ec01bc
Showing
9 changed files
with
205 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<link rel="stylesheet" href="/tests/reset.css" /> | ||
<link rel="stylesheet" href="/node_modules/@flows/js/css.min/flows.css" /> | ||
</head> | ||
<body> | ||
<button class="add-target">Add target</button> | ||
<button class="remove-target">Remove target</button> | ||
<button class="start-flow">Start flow</button> | ||
<div class="log"></div> | ||
|
||
<script type="module" src="./error.ts"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { expect, test } from "@playwright/test"; | ||
|
||
test("Emits error event", async ({ page }) => { | ||
await page.goto("/error/error.html"); | ||
await page.locator(".start-flow").click(); | ||
await expect(page.locator("[data-type='tooltipError']")).toHaveCount(1); | ||
await expect(page.locator("[data-type='invalidateTooltipError']")).toHaveCount(0); | ||
}); | ||
|
||
test("should invalidate error without issues", async ({ page }) => { | ||
await page.goto("/error/error.html"); | ||
await page.locator(".start-flow").click(); | ||
await expect(page.locator("[data-type='tooltipError']")).toHaveCount(1); | ||
await page.locator(".add-target").click(); | ||
await page.locator(".remove-target").click(); | ||
await page.locator(".add-target").click(); | ||
await expect(page.locator("[data-type='tooltipError']")).toHaveCount(1); | ||
await expect(page.locator("[data-type='invalidateTooltipError']")).toHaveAttribute( | ||
"data-reference-id", | ||
"0", | ||
); | ||
await expect(page.locator("[data-type='invalidateTooltipError']")).toHaveCount(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { init, startFlow } from "@flows/js"; | ||
|
||
let counter = 0; | ||
|
||
init({ | ||
flows: [ | ||
{ | ||
id: "flow", | ||
steps: [ | ||
{ | ||
element: ".target", | ||
title: "Hello", | ||
}, | ||
], | ||
}, | ||
], | ||
_debug: async (e) => { | ||
const p = document.createElement("p"); | ||
p.classList.add("log-item"); | ||
p.dataset.type = e.type; | ||
p.dataset.referenceId = e.referenceId; | ||
p.innerText = JSON.stringify(e); | ||
document.querySelector(".log")?.appendChild(p); | ||
const referenceId = counter.toString(); | ||
counter = counter + 1; | ||
return { referenceId }; | ||
}, | ||
}); | ||
|
||
const createTarget = (): void => { | ||
const el = document.createElement("div"); | ||
el.classList.add("target"); | ||
el.style.width = "20px"; | ||
el.style.height = "20px"; | ||
el.style.background = "grey"; | ||
el.style.margin = "40px"; | ||
document.body.appendChild(el); | ||
}; | ||
document.querySelector(".add-target")?.addEventListener("click", () => { | ||
createTarget(); | ||
}); | ||
document.querySelector(".remove-target")?.addEventListener("click", () => { | ||
document.querySelector(".target")?.remove(); | ||
}); | ||
|
||
document.querySelector(".start-flow")?.addEventListener("click", () => { | ||
startFlow("flow"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.