From e5fbbac472d4b262fc113e7930a0d74f3386ada7 Mon Sep 17 00:00:00 2001
From: Mason Zhang <12515123+MasonPinZ@users.noreply.github.com>
Date: Wed, 2 Aug 2023 17:40:14 +0900
Subject: [PATCH] add test cases for NodeFilter and TreeWalker (#252)
---
tests/platform/node-filter/index.html | 33 +++++++++++++++++
.../platform/node-filter/node-filter.spec.ts | 9 +++++
tests/platform/tree-walker/index.html | 36 +++++++++++++++++++
.../platform/tree-walker/tree-walker.spec.ts | 9 +++++
4 files changed, 87 insertions(+)
create mode 100644 tests/platform/node-filter/index.html
create mode 100644 tests/platform/node-filter/node-filter.spec.ts
create mode 100644 tests/platform/tree-walker/index.html
create mode 100644 tests/platform/tree-walker/tree-walker.spec.ts
diff --git a/tests/platform/node-filter/index.html b/tests/platform/node-filter/index.html
new file mode 100644
index 00000000..09567d4f
--- /dev/null
+++ b/tests/platform/node-filter/index.html
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+ NodeFilter
+
+
+
+
+ NodeFilter
+
+
+
+
+ All Tests
+
+
diff --git a/tests/platform/node-filter/node-filter.spec.ts b/tests/platform/node-filter/node-filter.spec.ts
new file mode 100644
index 00000000..9467c59f
--- /dev/null
+++ b/tests/platform/node-filter/node-filter.spec.ts
@@ -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');
+});
+
diff --git a/tests/platform/tree-walker/index.html b/tests/platform/tree-walker/index.html
new file mode 100644
index 00000000..076a9827
--- /dev/null
+++ b/tests/platform/tree-walker/index.html
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+ TreeWalker
+
+
+
+
+ TreeWalker
+
+
+
+
+ All Tests
+
+
diff --git a/tests/platform/tree-walker/tree-walker.spec.ts b/tests/platform/tree-walker/tree-walker.spec.ts
new file mode 100644
index 00000000..0019856d
--- /dev/null
+++ b/tests/platform/tree-walker/tree-walker.spec.ts
@@ -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');
+});
+