-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test cases for NodeFilter and TreeWalker (#252)
- Loading branch information
Showing
4 changed files
with
87 additions
and
0 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,33 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta name="description" content="Partytown Test Page" /> | ||
<title>NodeFilter</title> | ||
<script> | ||
partytown = { | ||
logCalls: true, | ||
logGetters: true, | ||
logSetters: true, | ||
logStackTraces: false, | ||
logScriptExecution: true, | ||
}; | ||
</script> | ||
<script src="/~partytown/debug/partytown.js"></script> | ||
</head> | ||
<body> | ||
<h1>NodeFilter</h1> | ||
<div id="nodeFilterProps"></div> | ||
<script type="text/partytown"> | ||
(function () { | ||
const nodeFilterEntries = Object.entries(NodeFilter); | ||
document.getElementById('nodeFilterProps').textContent = | ||
nodeFilterEntries.map(([k, v]) => `${k}: ${v}`).join(', '); | ||
})(); | ||
</script> | ||
|
||
<hr /> | ||
<p><a href="/tests/">All Tests</a></p> | ||
</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,9 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('NodeFilter', async ({ page }) => { | ||
await page.goto('/tests/platform/node-filter/'); | ||
await page.waitForSelector('#nodeFilterProps'); | ||
const resultDiv = page.locator('#nodeFilterProps'); | ||
await expect(resultDiv).toContainText('FILTER_ACCEPT'); | ||
}); | ||
|
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,36 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta name="description" content="Partytown Test Page" /> | ||
<title>TreeWalker</title> | ||
<script> | ||
partytown = { | ||
logCalls: true, | ||
logGetters: true, | ||
logSetters: true, | ||
logStackTraces: false, | ||
logScriptExecution: true, | ||
}; | ||
</script> | ||
<script src="/~partytown/debug/partytown.js"></script> | ||
</head> | ||
<body> | ||
<h1>TreeWalker</h1> | ||
<div id="walkerResult"></div> | ||
<script type="text/partytown"> | ||
(function () { | ||
const tw = document.createTreeWalker(document.body, 1); | ||
result = []; | ||
do { | ||
result.push(tw.currentNode.nodeName); | ||
} while (tw.nextNode()); | ||
document.getElementById('walkerResult').textContent = result.join(' '); | ||
})(); | ||
</script> | ||
|
||
<hr /> | ||
<p><a href="/tests/">All Tests</a></p> | ||
</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,9 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('TreeWalker', async ({ page }) => { | ||
await page.goto('/tests/platform/tree-walker/'); | ||
await page.waitForSelector('#walkerResult'); | ||
const resultDiv = page.locator('#walkerResult'); | ||
await expect(resultDiv).toHaveText('BODY H1 DIV SCRIPT'); | ||
}); | ||
|
e5fbbac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
partytown – ./
partytown.vercel.app
partytown-git-main-builder-io.vercel.app
partytown-builder-io.vercel.app
partytown.builder.io