@microsoft/fast-html 1.0.0-alpha.30 → 1.0.0-alpha.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/dts/components/observer-map.d.ts +1 -1
  2. package/dist/dts/components/schema.d.ts +1 -1
  3. package/dist/dts/components/utilities.d.ts +20 -18
  4. package/dist/esm/components/utilities.js +116 -71
  5. package/package.json +17 -32
  6. package/dist/dts/components/request-idle-callback.d.ts +0 -41
  7. package/dist/dts/fixtures/attribute/attribute.spec.d.ts +0 -1
  8. package/dist/dts/fixtures/attribute/main.d.ts +0 -1
  9. package/dist/dts/fixtures/binding/binding.spec.d.ts +0 -1
  10. package/dist/dts/fixtures/binding/main.d.ts +0 -1
  11. package/dist/dts/fixtures/children/children.spec.d.ts +0 -1
  12. package/dist/dts/fixtures/children/main.d.ts +0 -1
  13. package/dist/dts/fixtures/dot-syntax/dot-syntax.spec.d.ts +0 -1
  14. package/dist/dts/fixtures/dot-syntax/main.d.ts +0 -1
  15. package/dist/dts/fixtures/event/event.spec.d.ts +0 -1
  16. package/dist/dts/fixtures/event/main.d.ts +0 -1
  17. package/dist/dts/fixtures/lifecycle-callbacks/lifecycle-callbacks.spec.d.ts +0 -1
  18. package/dist/dts/fixtures/lifecycle-callbacks/main.d.ts +0 -5
  19. package/dist/dts/fixtures/observer-map/main.d.ts +0 -1
  20. package/dist/dts/fixtures/observer-map/observer-map.spec.d.ts +0 -1
  21. package/dist/dts/fixtures/ref/main.d.ts +0 -1
  22. package/dist/dts/fixtures/ref/ref.spec.d.ts +0 -1
  23. package/dist/dts/fixtures/repeat/main.d.ts +0 -1
  24. package/dist/dts/fixtures/repeat/repeat.spec.d.ts +0 -1
  25. package/dist/dts/fixtures/slotted/main.d.ts +0 -1
  26. package/dist/dts/fixtures/slotted/slotted.spec.d.ts +0 -1
  27. package/dist/dts/fixtures/when/main.d.ts +0 -1
  28. package/dist/dts/fixtures/when/when.spec.d.ts +0 -1
  29. package/dist/esm/components/request-idle-callback.js +0 -72
  30. package/dist/esm/fixtures/attribute/attribute.spec.js +0 -23
  31. package/dist/esm/fixtures/attribute/main.js +0 -20
  32. package/dist/esm/fixtures/binding/binding.spec.js +0 -23
  33. package/dist/esm/fixtures/binding/main.js +0 -30
  34. package/dist/esm/fixtures/children/children.spec.js +0 -37
  35. package/dist/esm/fixtures/children/main.js +0 -25
  36. package/dist/esm/fixtures/dot-syntax/dot-syntax.spec.js +0 -116
  37. package/dist/esm/fixtures/dot-syntax/main.js +0 -42
  38. package/dist/esm/fixtures/event/event.spec.js +0 -35
  39. package/dist/esm/fixtures/event/main.js +0 -32
  40. package/dist/esm/fixtures/lifecycle-callbacks/lifecycle-callbacks.spec.js +0 -166
  41. package/dist/esm/fixtures/lifecycle-callbacks/main.js +0 -126
  42. package/dist/esm/fixtures/observer-map/main.js +0 -375
  43. package/dist/esm/fixtures/observer-map/observer-map.spec.js +0 -251
  44. package/dist/esm/fixtures/ref/main.js +0 -15
  45. package/dist/esm/fixtures/ref/ref.spec.js +0 -9
  46. package/dist/esm/fixtures/repeat/main.js +0 -44
  47. package/dist/esm/fixtures/repeat/repeat.spec.js +0 -36
  48. package/dist/esm/fixtures/slotted/main.js +0 -33
  49. package/dist/esm/fixtures/slotted/slotted.spec.js +0 -24
  50. package/dist/esm/fixtures/when/main.js +0 -156
  51. package/dist/esm/fixtures/when/when.spec.js +0 -82
  52. package/dist/esm/tsconfig.tsbuildinfo +0 -1
@@ -1,251 +0,0 @@
1
- import { __awaiter } from "tslib";
2
- import { test, expect } from "@playwright/test";
3
- test.describe("ObserverMap", () => __awaiter(void 0, void 0, void 0, function* () {
4
- test.beforeEach(({ page }) => __awaiter(void 0, void 0, void 0, function* () {
5
- yield page.goto("/observer-map");
6
- yield page.waitForSelector("observer-map-test-element");
7
- }));
8
- test("should render initial users with deeply nested properties", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
9
- // Check that initial users are rendered
10
- yield expect(page.locator(".user-card")).toHaveCount(2);
11
- // Check deeply nested properties are displayed
12
- yield expect(page.locator("text=Alice Johnson")).toHaveCount(3);
13
- yield expect(page.locator("text=Bob Smith")).toHaveCount(2);
14
- // Check nested location data
15
- yield expect(page.locator("text=New York, USA")).toBeVisible();
16
- yield expect(page.locator("text=London, UK")).toBeVisible();
17
- // Check deeply nested preferences
18
- yield expect(page.locator("text=Theme: dark")).toBeVisible();
19
- yield expect(page.locator("text=Theme: light")).toBeVisible();
20
- }));
21
- test("should update deeply nested age property", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
22
- // Initial age should be 28 for Alice
23
- yield expect(page.locator("text=Age: 28 years old")).toBeVisible();
24
- // Click the age increment button for Alice (user ID 1)
25
- yield page.locator("button:has-text('Age +1')").first().click();
26
- // Age should now be 29
27
- yield expect(page.locator("text=Age: 29 years old")).toBeVisible();
28
- yield expect(page.locator("text=Age: 28 years old")).not.toBeVisible();
29
- }));
30
- test("should toggle theme in deeply nested preferences", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
31
- // Initial theme should be dark for Alice
32
- yield expect(page.locator("text=Theme: dark").first()).toBeVisible();
33
- // Click the toggle theme button for Alice
34
- yield page.locator("button:has-text('Toggle Theme')").first().click();
35
- // Theme should now be light
36
- yield expect(page.locator("text=Theme: light").first()).toBeVisible();
37
- }));
38
- test("should update location", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
39
- // Initial location should be New York, USA
40
- yield expect(page.locator("text=New York, USA")).toBeVisible();
41
- // Click the change location button for Alice
42
- yield page.locator("button:has-text('Change Location')").first().click();
43
- // Location should now be Tokyo, Japan
44
- yield expect(page.locator("text=Tokyo, Japan")).toBeVisible();
45
- yield expect(page.locator("text=New York, USA")).not.toBeVisible();
46
- }));
47
- test("should update notification settings", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
48
- // Check initial notification settings for Alice
49
- yield expect(page.locator("text=Email Notifications: true").first()).toBeVisible();
50
- yield expect(page.locator("text=Push Notifications: false").first()).toBeVisible();
51
- yield expect(page.locator("text=Notification Frequency: daily").first()).toBeVisible();
52
- // Click update notifications button
53
- yield page.locator("button:has-text('Update Notifications')").first().click();
54
- // Settings should be toggled
55
- yield expect(page.locator("text=Email Notifications: false").first()).toBeVisible();
56
- yield expect(page.locator("text=Push Notifications: true").first()).toBeVisible();
57
- yield expect(page.locator("text=Notification Frequency: weekly").first()).toBeVisible();
58
- }));
59
- test("should add and remove categories in deeply nested arrays", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
60
- // Check initial categories for Alice (should include "tech")
61
- yield expect(page.locator(".tag:has-text('tech')")).toHaveCount(2);
62
- // Add sports category
63
- yield page.locator("button:has-text('Add Category')").first().click();
64
- yield expect(page.locator(".tag:has-text('sports')").first()).toBeVisible();
65
- // Remove tech category
66
- yield page.locator("button:has-text('Remove Tech Category')").first().click();
67
- yield expect(page.locator(".tag:has-text('tech')")).toHaveCount(1);
68
- }));
69
- test("should increment post likes and update nested metadata", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
70
- const aliceCard = page.locator(".user-card").first();
71
- const firstPost = aliceCard.locator(".post-card").first();
72
- // Check initial likes (should be 25)
73
- yield expect(firstPost.locator("text=25 likes")).toBeVisible();
74
- // Click like button
75
- yield firstPost.locator("button:has-text('Like Post')").click();
76
- // Likes should increment to 26
77
- yield expect(firstPost.locator("text=26 likes")).toBeVisible();
78
- // Views should also increment (random amount)
79
- yield expect(firstPost.locator("text=views")).toBeVisible();
80
- }));
81
- test("should add new posts to users", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
82
- const aliceCard = page.locator(".user-card").first();
83
- // Initial post count should be 2
84
- yield expect(aliceCard.locator(".post-card")).toHaveCount(2);
85
- // Add new post
86
- yield aliceCard.locator("button:has-text('Add New Post')").click();
87
- // Should now have 3 posts
88
- yield expect(aliceCard.locator(".post-card")).toHaveCount(3);
89
- }));
90
- test("should update the likes on a new post", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
91
- const aliceCard = page.locator(".user-card").first();
92
- // Add new post first
93
- yield aliceCard.locator("button:has-text('Add New Post')").click();
94
- // Should now have 3 posts
95
- yield expect(aliceCard.locator(".post-card")).toHaveCount(3);
96
- // Get the newly added post (should be the last one)
97
- const newPost = aliceCard.locator(".post-card").nth(2);
98
- // Check initial likes on the new post (should be 0)
99
- yield expect(newPost.locator("text=0 likes")).toBeVisible();
100
- // Click like button on the new post
101
- yield newPost.locator("button:has-text('Like Post')").click();
102
- // Likes should increment to 1
103
- yield expect(newPost.locator("text=1 likes")).toBeVisible();
104
- yield expect(newPost.locator("text=0 likes")).not.toBeVisible();
105
- }));
106
- test("should add and remove users from the array", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
107
- // Initial user count should be 2
108
- yield expect(page.locator(".user-card")).toHaveCount(2);
109
- yield expect(page.locator("text=Total Users: 2")).toBeVisible();
110
- // Add new user
111
- yield page.locator("button:has-text('Add New User')").click();
112
- // Should now have 3 users
113
- yield expect(page.locator(".user-card")).toHaveCount(3);
114
- yield expect(page.locator("text=Total Users: 3")).toBeVisible();
115
- yield expect(page.locator("text=User 3")).toBeVisible();
116
- // Remove a user (Alice - first remove button)
117
- yield page.locator("button:has-text('Remove User')").first().click();
118
- // Should be back to 2 users
119
- yield expect(page.locator(".user-card")).toHaveCount(2);
120
- yield expect(page.locator("text=Total Users: 2")).toBeVisible();
121
- }));
122
- test("should be able to update nested properties on added users", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
123
- // Initial user count should be 2
124
- yield expect(page.locator(".user-card")).toHaveCount(2);
125
- // Add new user
126
- yield page.locator("button:has-text('Add New User')").click();
127
- // Should now have 3 users
128
- yield expect(page.locator(".user-card")).toHaveCount(3);
129
- const userCard3 = yield page.locator(".user-card").nth(2);
130
- // Initial theme should be dark for User 3
131
- yield expect(userCard3.locator("text=Theme: dark")).toBeVisible();
132
- // Click the toggle theme button for User 3
133
- yield userCard3.locator("button:has-text('Toggle Theme')").click();
134
- // Theme should now be light
135
- yield expect(userCard3.locator("text=Theme: light")).toBeVisible();
136
- }));
137
- test("should be able to update nested properties on added users after the items array has been emptied", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
138
- // Initial item count should be 1
139
- yield expect(page.locator(".item")).toHaveCount(1);
140
- // Remove item
141
- yield page.locator("button:has-text('Remove all items')").click();
142
- // Should now have 0 items
143
- yield expect(page.locator(".item")).toHaveCount(0);
144
- // Click the add item button
145
- yield page.locator("button:has-text('Add an item')").click();
146
- // There should now be 1 item
147
- yield expect(page.locator(".item")).toHaveCount(1);
148
- // Click the update item button
149
- yield page.locator("button:has-text('Update an item')").click();
150
- // The item should have updated text
151
- yield expect(page.locator(".item")).toHaveText('item C');
152
- }));
153
- test("should be able to update nested properties on added users after the group array has been emptied", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
154
- // Initial item count should be 1
155
- yield expect(page.locator(".item")).toHaveCount(1);
156
- // Remove groups
157
- yield page.locator("button:has-text('Remove groups')").click();
158
- // Should now have 0 items
159
- yield expect(page.locator(".item")).toHaveCount(0);
160
- // Click the add group button
161
- yield page.locator("button:has-text('Add group')").click();
162
- // There should now be 1 item
163
- yield expect(page.locator(".item")).toHaveCount(1);
164
- // Click the update item button
165
- yield page.locator("button:has-text('Update an item')").click();
166
- // The item should have updated text
167
- yield expect(page.locator(".item")).toHaveText('item C');
168
- // Click the update action label
169
- yield page.locator("button:has-text('Update an action label')").click();
170
- // The action label should have updated text
171
- yield expect(page.locator(".action-label")).toHaveText('action label B');
172
- }));
173
- test("should update global stats with nested metrics", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
174
- // Check initial engagement stats
175
- const initialDaily = yield page.locator(".stats .nested-info").nth(1).textContent();
176
- // Update stats
177
- yield page.locator(".stats .controls button").nth(0).click();
178
- yield page.evaluate(() => {
179
- return new Promise((resolve) => {
180
- requestAnimationFrame(() => resolve(true));
181
- });
182
- });
183
- // Stats should be updated (values should change)
184
- const updatedDaily = yield page.locator(".stats .nested-info").nth(1).textContent();
185
- expect(updatedDaily).not.toBe(initialDaily);
186
- }));
187
- test("should handle user selection with conditional rendering", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
188
- // Initially, Alice (ID 1) should be selected
189
- yield expect(page.locator("text=⭐ SELECTED").first()).toBeVisible();
190
- // Select Bob (user ID 2)
191
- yield page.locator(".user-card").nth(1).locator("button:has-text('Select User')").click();
192
- // Bob should now show as selected
193
- const bobCard = page.locator(".user-card").nth(1);
194
- yield expect(bobCard.locator("text=⭐ SELECTED")).toBeVisible();
195
- // Alice should no longer show as selected
196
- const aliceCard = page.locator(".user-card").first();
197
- yield expect(aliceCard.locator("text=⭐ SELECTED")).not.toBeVisible();
198
- }));
199
- test("should update a defined object when a nested property has been defined", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
200
- const undefinedText = yield page.locator(".nested-define").textContent();
201
- yield expect(undefinedText).toEqual("");
202
- // Define the object
203
- yield page.locator("button:has-text('Define B')").nth(0).click();
204
- yield page.evaluate(() => {
205
- return new Promise((resolve) => {
206
- requestAnimationFrame(() => resolve(true));
207
- });
208
- });
209
- const definedText = yield page.locator(".nested-define").textContent();
210
- yield expect(definedText).toEqual("Hello world");
211
- }));
212
- test("should update a defined object when a nested property has been updated", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
213
- // Define the object
214
- yield page.locator("button:has-text('Define B')").nth(0).click();
215
- // Update the object
216
- yield page.locator("button:has-text('Update C')").nth(0).click();
217
- yield page.evaluate(() => {
218
- return new Promise((resolve) => {
219
- requestAnimationFrame(() => resolve(true));
220
- });
221
- });
222
- const updatedText = yield page.locator(".nested-define").textContent();
223
- yield expect(updatedText).toEqual("Hello pluto");
224
- }));
225
- test("should update an undefined object when a nested property has been defined", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
226
- const undefinedText = yield page.locator(".nested-define-2");
227
- yield expect(undefinedText).toHaveCount(0);
228
- // Define the object
229
- yield page.locator("button:has-text('Define Y')").nth(0).click();
230
- yield page.evaluate(() => {
231
- return new Promise((resolve) => {
232
- requestAnimationFrame(() => resolve(true));
233
- });
234
- });
235
- const definedText = yield page.locator(".nested-define-2").textContent();
236
- yield expect(definedText).toEqual("Z1");
237
- }));
238
- test("should update an undefined object when a nested property has been updated", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
239
- // Define the object
240
- yield page.locator("button:has-text('Define Y')").nth(0).click();
241
- // Update the object
242
- yield page.locator("button:has-text('Update Z')").nth(0).click();
243
- yield page.evaluate(() => {
244
- return new Promise((resolve) => {
245
- requestAnimationFrame(() => resolve(true));
246
- });
247
- });
248
- const updatedText = yield page.locator(".nested-define-2").textContent();
249
- yield expect(updatedText).toEqual("Z2");
250
- }));
251
- }));
@@ -1,15 +0,0 @@
1
- import { FASTElement } from "@microsoft/fast-element";
2
- import { RenderableFASTElement, TemplateElement } from "@microsoft/fast-html";
3
- class TestElement extends FASTElement {
4
- constructor() {
5
- super(...arguments);
6
- this.video = null;
7
- }
8
- }
9
- RenderableFASTElement(TestElement).defineAsync({
10
- name: "test-element",
11
- templateOptions: "defer-and-hydrate",
12
- });
13
- TemplateElement.define({
14
- name: "f-template",
15
- });
@@ -1,9 +0,0 @@
1
- import { __awaiter } from "tslib";
2
- import { expect, test } from "@playwright/test";
3
- test.describe("f-template", () => __awaiter(void 0, void 0, void 0, function* () {
4
- test("create a ref directive", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
5
- yield page.goto("/ref");
6
- const element = page.locator("test-element");
7
- yield expect(element).toHaveJSProperty("video.nodeName", "VIDEO");
8
- }));
9
- }));
@@ -1,44 +0,0 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import { RenderableFASTElement, TemplateElement } from "@microsoft/fast-html";
3
- import { FASTElement, observable } from "@microsoft/fast-element";
4
- class TestElement extends FASTElement {
5
- constructor() {
6
- super(...arguments);
7
- this.list = ["Foo", "Bar"];
8
- this.item_parent = "Bat";
9
- }
10
- }
11
- __decorate([
12
- observable,
13
- __metadata("design:type", Array)
14
- ], TestElement.prototype, "list", void 0);
15
- RenderableFASTElement(TestElement).defineAsync({
16
- name: "test-element",
17
- templateOptions: "defer-and-hydrate",
18
- });
19
- class TestElementInnerWhen extends FASTElement {
20
- constructor() {
21
- super(...arguments);
22
- this.list = [
23
- {
24
- show: true,
25
- text: "Foo",
26
- },
27
- {
28
- show: false,
29
- text: "Bar",
30
- },
31
- ];
32
- }
33
- }
34
- __decorate([
35
- observable,
36
- __metadata("design:type", Array)
37
- ], TestElementInnerWhen.prototype, "list", void 0);
38
- RenderableFASTElement(TestElementInnerWhen).defineAsync({
39
- name: "test-element-inner-when",
40
- templateOptions: "defer-and-hydrate",
41
- });
42
- TemplateElement.define({
43
- name: "f-template",
44
- });
@@ -1,36 +0,0 @@
1
- import { __awaiter } from "tslib";
2
- import { expect, test } from "@playwright/test";
3
- test.describe("f-template", () => __awaiter(void 0, void 0, void 0, function* () {
4
- test("create a repeat directive", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
5
- yield page.goto("/repeat");
6
- const customElement = yield page.locator("test-element");
7
- let customElementListItems = yield customElement.locator("li");
8
- expect(yield customElementListItems.count()).toEqual(2);
9
- expect(yield customElementListItems.nth(0).textContent()).toEqual("Foo - Bat");
10
- expect(yield customElementListItems.nth(1).textContent()).toEqual("Bar - Bat");
11
- yield page.evaluate(() => {
12
- const customElement = document.getElementsByTagName("test-element");
13
- customElement.item(0).list = [
14
- "A",
15
- "B",
16
- "C"
17
- ];
18
- });
19
- const timeout = new Promise(function (resolve) {
20
- setTimeout(resolve, 100);
21
- });
22
- yield timeout;
23
- customElementListItems = yield customElement.locator("li");
24
- expect(yield customElementListItems.count()).toEqual(3);
25
- expect(yield customElementListItems.nth(0).textContent()).toEqual("A - Bat");
26
- expect(yield customElementListItems.nth(1).textContent()).toEqual("B - Bat");
27
- expect(yield customElementListItems.nth(2).textContent()).toEqual("C - Bat");
28
- }));
29
- test("create a repeat directive with an inner when", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
30
- yield page.goto("/repeat");
31
- const customElement = yield page.locator("test-element-inner-when");
32
- let customElementListItems = yield customElement.locator("li");
33
- expect(yield customElementListItems.count()).toEqual(1);
34
- expect(yield customElementListItems.nth(0).textContent()).toEqual("Foo");
35
- }));
36
- }));
@@ -1,33 +0,0 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import { RenderableFASTElement, TemplateElement } from "@microsoft/fast-html";
3
- import { FASTElement, observable } from "@microsoft/fast-element";
4
- class TestElement extends FASTElement {
5
- constructor() {
6
- super(...arguments);
7
- this.slottedNodes = [];
8
- this.slottedFooNodes = [];
9
- this.slottedBarNodes = [];
10
- }
11
- slottedFooNodesChanged() {
12
- this.classList.add(`class-${this.slottedFooNodes.length}`);
13
- }
14
- }
15
- __decorate([
16
- observable,
17
- __metadata("design:type", Array)
18
- ], TestElement.prototype, "slottedNodes", void 0);
19
- __decorate([
20
- observable,
21
- __metadata("design:type", Array)
22
- ], TestElement.prototype, "slottedFooNodes", void 0);
23
- __decorate([
24
- observable,
25
- __metadata("design:type", Array)
26
- ], TestElement.prototype, "slottedBarNodes", void 0);
27
- RenderableFASTElement(TestElement).defineAsync({
28
- name: "test-element",
29
- templateOptions: "defer-and-hydrate",
30
- });
31
- TemplateElement.define({
32
- name: "f-template",
33
- });
@@ -1,24 +0,0 @@
1
- import { __awaiter } from "tslib";
2
- import { expect, test } from "@playwright/test";
3
- test.describe("f-template", () => {
4
- let element;
5
- test.beforeEach(({ page }) => __awaiter(void 0, void 0, void 0, function* () {
6
- yield page.goto("/slotted");
7
- element = page.locator("test-element");
8
- }));
9
- test("create a slotted directive", () => __awaiter(void 0, void 0, void 0, function* () {
10
- yield expect(element).toHaveJSProperty("classList.length", 2);
11
- yield element.evaluate((node) => {
12
- const newElement = document.createElement("button");
13
- newElement.slot = "foo";
14
- node.append(newElement);
15
- });
16
- yield expect(element).toHaveJSProperty("classList.length", 3);
17
- }));
18
- test("slotted nodes are filtered by elements()", () => __awaiter(void 0, void 0, void 0, function* () {
19
- yield expect(element).toHaveJSProperty("slottedNodes.length", 1);
20
- }));
21
- test("slotted nodes are filtered by elements() with query", () => __awaiter(void 0, void 0, void 0, function* () {
22
- yield expect(element).toHaveJSProperty("slottedBarNodes.length", 1);
23
- }));
24
- });
@@ -1,156 +0,0 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import { RenderableFASTElement, TemplateElement } from "@microsoft/fast-html";
3
- import { attr, FASTElement } from "@microsoft/fast-element";
4
- class TestElement extends FASTElement {
5
- constructor() {
6
- super(...arguments);
7
- this.show = false;
8
- }
9
- }
10
- __decorate([
11
- attr({ mode: "boolean" }),
12
- __metadata("design:type", Boolean)
13
- ], TestElement.prototype, "show", void 0);
14
- RenderableFASTElement(TestElement).defineAsync({
15
- name: "test-element",
16
- templateOptions: "defer-and-hydrate",
17
- });
18
- class TestElementNot extends FASTElement {
19
- constructor() {
20
- super(...arguments);
21
- this.hide = false;
22
- }
23
- }
24
- __decorate([
25
- attr({ mode: "boolean" }),
26
- __metadata("design:type", Boolean)
27
- ], TestElementNot.prototype, "hide", void 0);
28
- RenderableFASTElement(TestElementNot).defineAsync({
29
- name: "test-element-not",
30
- templateOptions: "defer-and-hydrate",
31
- });
32
- class TestElementEquals extends FASTElement {
33
- constructor() {
34
- super(...arguments);
35
- this.varA = 0;
36
- }
37
- }
38
- __decorate([
39
- attr({ attribute: "var-a" }),
40
- __metadata("design:type", Number)
41
- ], TestElementEquals.prototype, "varA", void 0);
42
- RenderableFASTElement(TestElementEquals).defineAsync({
43
- name: "test-element-equals",
44
- templateOptions: "defer-and-hydrate",
45
- });
46
- class TestElementNotEquals extends FASTElement {
47
- constructor() {
48
- super(...arguments);
49
- this.varA = 0;
50
- }
51
- }
52
- __decorate([
53
- attr({ attribute: "var-a" }),
54
- __metadata("design:type", Number)
55
- ], TestElementNotEquals.prototype, "varA", void 0);
56
- RenderableFASTElement(TestElementNotEquals).defineAsync({
57
- name: "test-element-not-equals",
58
- templateOptions: "defer-and-hydrate",
59
- });
60
- class TestElementGe extends FASTElement {
61
- constructor() {
62
- super(...arguments);
63
- this.varA = 0;
64
- }
65
- }
66
- __decorate([
67
- attr({ attribute: "var-a" }),
68
- __metadata("design:type", Number)
69
- ], TestElementGe.prototype, "varA", void 0);
70
- RenderableFASTElement(TestElementGe).defineAsync({
71
- name: "test-element-ge",
72
- templateOptions: "defer-and-hydrate",
73
- });
74
- class TestElementGt extends FASTElement {
75
- constructor() {
76
- super(...arguments);
77
- this.varA = 0;
78
- }
79
- }
80
- __decorate([
81
- attr({ attribute: "var-a" }),
82
- __metadata("design:type", Number)
83
- ], TestElementGt.prototype, "varA", void 0);
84
- RenderableFASTElement(TestElementGt).defineAsync({
85
- name: "test-element-gt",
86
- templateOptions: "defer-and-hydrate",
87
- });
88
- class TestElementLe extends FASTElement {
89
- constructor() {
90
- super(...arguments);
91
- this.varA = 0;
92
- }
93
- }
94
- __decorate([
95
- attr({ attribute: "var-a" }),
96
- __metadata("design:type", Number)
97
- ], TestElementLe.prototype, "varA", void 0);
98
- RenderableFASTElement(TestElementLe).defineAsync({
99
- name: "test-element-le",
100
- templateOptions: "defer-and-hydrate",
101
- });
102
- class TestElementLt extends FASTElement {
103
- constructor() {
104
- super(...arguments);
105
- this.varA = 0;
106
- }
107
- }
108
- __decorate([
109
- attr({ attribute: "var-a" }),
110
- __metadata("design:type", Number)
111
- ], TestElementLt.prototype, "varA", void 0);
112
- RenderableFASTElement(TestElementLt).defineAsync({
113
- name: "test-element-lt",
114
- templateOptions: "defer-and-hydrate",
115
- });
116
- class TestElementOr extends FASTElement {
117
- constructor() {
118
- super(...arguments);
119
- this.thisVar = false;
120
- this.thatVar = false;
121
- }
122
- }
123
- __decorate([
124
- attr({ attribute: "this-var", mode: "boolean" }),
125
- __metadata("design:type", Boolean)
126
- ], TestElementOr.prototype, "thisVar", void 0);
127
- __decorate([
128
- attr({ attribute: "that-var", mode: "boolean" }),
129
- __metadata("design:type", Boolean)
130
- ], TestElementOr.prototype, "thatVar", void 0);
131
- RenderableFASTElement(TestElementOr).defineAsync({
132
- name: "test-element-or",
133
- templateOptions: "defer-and-hydrate",
134
- });
135
- class TestElementAnd extends FASTElement {
136
- constructor() {
137
- super(...arguments);
138
- this.thisVar = false;
139
- this.thatVar = false;
140
- }
141
- }
142
- __decorate([
143
- attr({ attribute: "this-var", mode: "boolean" }),
144
- __metadata("design:type", Boolean)
145
- ], TestElementAnd.prototype, "thisVar", void 0);
146
- __decorate([
147
- attr({ attribute: "that-var", mode: "boolean" }),
148
- __metadata("design:type", Boolean)
149
- ], TestElementAnd.prototype, "thatVar", void 0);
150
- RenderableFASTElement(TestElementAnd).defineAsync({
151
- name: "test-element-and",
152
- templateOptions: "defer-and-hydrate",
153
- });
154
- TemplateElement.define({
155
- name: "f-template",
156
- });
@@ -1,82 +0,0 @@
1
- import { __awaiter } from "tslib";
2
- import { expect, test } from "@playwright/test";
3
- test.describe("f-template", () => __awaiter(void 0, void 0, void 0, function* () {
4
- test("create a when directive for a boolean: true", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
5
- yield page.goto("/when");
6
- const customElementShow = yield page.locator("#show");
7
- const customElementHide = yield page.locator("#hide");
8
- yield expect(customElementShow).toHaveText("Hello world");
9
- yield expect(customElementHide).not.toHaveText("Hello world");
10
- yield page.evaluate(() => {
11
- const customElementShow = document.getElementById("show");
12
- const customElementHide = document.getElementById("hide");
13
- customElementShow === null || customElementShow === void 0 ? void 0 : customElementShow.removeAttribute("show");
14
- customElementHide === null || customElementHide === void 0 ? void 0 : customElementHide.setAttribute("show", "");
15
- });
16
- yield expect(customElementShow).not.toHaveText("Hello world");
17
- yield expect(customElementHide).toHaveText("Hello world");
18
- }));
19
- test("create a when directive for a boolean: false", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
20
- yield page.goto("/when");
21
- const customElementShow = yield page.locator("#show-not");
22
- const customElementHide = yield page.locator("#hide-not");
23
- yield expect(customElementShow).toHaveText("Hello world");
24
- yield expect(customElementHide).not.toHaveText("Hello world");
25
- }));
26
- test("create a when directive value uses equals", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
27
- yield page.goto("/when");
28
- const customElementShow = yield page.locator("#equals-true");
29
- const customElementHide = yield page.locator("#equals-false");
30
- yield expect(customElementShow).toHaveText("Equals 3");
31
- yield expect(customElementHide).not.toHaveText("Equals 3");
32
- }));
33
- test("create a when directive value uses not equals", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
34
- yield page.goto("/when");
35
- const customElementShow = yield page.locator("#not-equals-true");
36
- const customElementHide = yield page.locator("#not-equals-false");
37
- yield expect(customElementShow).toHaveText("Not equals 3");
38
- yield expect(customElementHide).not.toHaveText("Not equals 3");
39
- }));
40
- test("create a when directive value uses greater than or equals", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
41
- yield page.goto("/when");
42
- const customElementShow = yield page.locator("#ge-true");
43
- const customElementHide = yield page.locator("#ge-false");
44
- yield expect(customElementShow).toHaveText("Two and Over");
45
- yield expect(customElementHide).not.toHaveText("Two and Over");
46
- }));
47
- test("create a when directive value uses greater than", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
48
- yield page.goto("/when");
49
- const customElementShow = yield page.locator("#gt-true");
50
- const customElementHide = yield page.locator("#gt-false");
51
- yield expect(customElementShow).toHaveText("Over two");
52
- yield expect(customElementHide).not.toHaveText("Over two");
53
- }));
54
- test("create a when directive value uses less than or equals", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
55
- yield page.goto("/when");
56
- const customElementShow = yield page.locator("#le-true");
57
- const customElementHide = yield page.locator("#le-false");
58
- yield expect(customElementShow).toHaveText("Two and Under");
59
- yield expect(customElementHide).not.toHaveText("Two and Under");
60
- }));
61
- test("create a when directive value uses less than", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
62
- yield page.goto("/when");
63
- const customElementShow = yield page.locator("#lt-true");
64
- const customElementHide = yield page.locator("#lt-false");
65
- yield expect(customElementShow).toHaveText("Under two");
66
- yield expect(customElementHide).not.toHaveText("Under two");
67
- }));
68
- test("create a when directive value uses or", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
69
- yield page.goto("/when");
70
- const customElementShow = yield page.locator("#or-true");
71
- const customElementHide = yield page.locator("#or-false");
72
- yield expect(customElementShow).toHaveText("This or That");
73
- yield expect(customElementHide).not.toHaveText("This or That");
74
- }));
75
- test("create a when directive value uses and", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
76
- yield page.goto("/when");
77
- const customElementShow = yield page.locator("#and-true");
78
- const customElementHide = yield page.locator("#and-false");
79
- yield expect(customElementShow).toHaveText("This and That");
80
- yield expect(customElementHide).not.toHaveText("This and That");
81
- }));
82
- }));