@microsoft/fast-html 1.0.0-alpha.3 → 1.0.0-alpha.31

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 (56) hide show
  1. package/README.md +255 -18
  2. package/dist/dts/components/element.d.ts +10 -0
  3. package/dist/dts/components/index.d.ts +3 -1
  4. package/dist/dts/components/observer-map.d.ts +26 -0
  5. package/dist/dts/components/schema.d.ts +144 -0
  6. package/dist/dts/components/template.d.ts +83 -7
  7. package/dist/dts/components/utilities.d.ts +109 -18
  8. package/dist/dts/fixtures/lifecycle-callbacks/lifecycle-callbacks.spec.d.ts +1 -0
  9. package/dist/dts/fixtures/lifecycle-callbacks/main.d.ts +5 -0
  10. package/dist/dts/fixtures/observer-map/main.d.ts +1 -0
  11. package/dist/dts/fixtures/observer-map/observer-map.spec.d.ts +1 -0
  12. package/dist/dts/index.d.ts +1 -1
  13. package/dist/esm/components/element.js +28 -0
  14. package/dist/esm/components/index.js +3 -1
  15. package/dist/esm/components/observer-map.js +53 -0
  16. package/dist/esm/components/observer-map.spec.js +19 -0
  17. package/dist/esm/components/schema.js +250 -0
  18. package/dist/esm/components/schema.spec.js +485 -0
  19. package/dist/esm/components/template.js +199 -111
  20. package/dist/esm/components/utilities.js +741 -43
  21. package/dist/esm/components/utilities.spec.js +317 -44
  22. package/dist/esm/fixtures/attribute/main.js +3 -2
  23. package/dist/esm/fixtures/binding/binding.spec.js +6 -0
  24. package/dist/esm/fixtures/binding/main.js +13 -2
  25. package/dist/esm/fixtures/children/children.spec.js +4 -0
  26. package/dist/esm/fixtures/children/main.js +3 -2
  27. package/dist/esm/fixtures/dot-syntax/dot-syntax.spec.js +109 -2
  28. package/dist/esm/fixtures/dot-syntax/main.js +30 -4
  29. package/dist/esm/fixtures/event/event.spec.js +28 -5
  30. package/dist/esm/fixtures/event/main.js +21 -5
  31. package/dist/esm/fixtures/lifecycle-callbacks/lifecycle-callbacks.spec.js +166 -0
  32. package/dist/esm/fixtures/lifecycle-callbacks/main.js +126 -0
  33. package/dist/esm/fixtures/observer-map/main.js +375 -0
  34. package/dist/esm/fixtures/observer-map/observer-map.spec.js +251 -0
  35. package/dist/esm/fixtures/ref/main.js +3 -2
  36. package/dist/esm/fixtures/ref/ref.spec.js +2 -6
  37. package/dist/esm/fixtures/repeat/main.js +27 -2
  38. package/dist/esm/fixtures/repeat/repeat.spec.js +16 -6
  39. package/dist/esm/fixtures/slotted/main.js +15 -4
  40. package/dist/esm/fixtures/slotted/slotted.spec.js +18 -19
  41. package/dist/esm/fixtures/when/main.js +139 -2
  42. package/dist/esm/fixtures/when/when.spec.js +64 -1
  43. package/dist/esm/index.js +1 -1
  44. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  45. package/dist/fast-html.api.json +333 -0
  46. package/dist/fast-html.d.ts +282 -6
  47. package/dist/fast-html.untrimmed.d.ts +282 -6
  48. package/package.json +12 -7
  49. package/rules/attribute-directives.yml +38 -0
  50. package/rules/call-expression-with-event-argument.yml +41 -0
  51. package/rules/member-expression.yml +33 -0
  52. package/rules/tag-function-to-template-literal.yml +16 -0
  53. package/dist/esm/fixtures/partial/main.js +0 -31
  54. package/dist/esm/fixtures/partial/partial.spec.js +0 -14
  55. /package/dist/dts/{fixtures/partial/main.d.ts → components/observer-map.spec.d.ts} +0 -0
  56. /package/dist/dts/{fixtures/partial/partial.spec.d.ts → components/schema.spec.d.ts} +0 -0
@@ -1,4 +1,241 @@
1
+ import { Constructable } from '@microsoft/fast-element';
1
2
  import { FASTElement } from '@microsoft/fast-element';
3
+ import { HydrationControllerCallbacks } from '@microsoft/fast-element';
4
+ import { TemplateLifecycleCallbacks } from '@microsoft/fast-element';
5
+
6
+ declare interface AccessCachedPath extends CachedPathCommon {
7
+ type: AccessCachedPathType;
8
+ }
9
+
10
+ declare type AccessCachedPathType = "access";
11
+
12
+ declare type CachedPath = DefaultCachedPath | RepeatCachedPath | AccessCachedPath | EventCachedPath;
13
+
14
+ declare interface CachedPathCommon {
15
+ parentContext: string | null;
16
+ currentContext: string | null;
17
+ path: string;
18
+ }
19
+
20
+ declare type CachedPathMap = Map<string, Map<string, JSONSchema>>;
21
+
22
+ declare interface ChildrenMap {
23
+ customElementName: string;
24
+ attributeName: string;
25
+ }
26
+
27
+ declare interface DefaultCachedPath extends CachedPathCommon {
28
+ type: DefaultCachedPathType;
29
+ }
30
+
31
+ declare type DefaultCachedPathType = "default";
32
+
33
+ /**
34
+ * Element options the TemplateElement will use to update the registered element
35
+ */
36
+ declare interface ElementOptions {
37
+ observerMap?: ObserverMapOption;
38
+ }
39
+
40
+ /**
41
+ * A dictionary of element options the TemplateElement will use to update the registered element
42
+ */
43
+ declare interface ElementOptionsDictionary<ElementOptionsType = ElementOptions> {
44
+ [key: string]: ElementOptionsType;
45
+ }
46
+
47
+ declare interface EventCachedPath extends CachedPathCommon {
48
+ type: EventCachedPathType;
49
+ }
50
+
51
+ declare type EventCachedPathType = "event";
52
+
53
+ /**
54
+ * Lifecycle callbacks for template and hydration events.
55
+ * Combines template lifecycle callbacks with hydration callbacks and adds template-processing events.
56
+ */
57
+ declare interface HydrationLifecycleCallbacks extends HydrationControllerCallbacks, TemplateLifecycleCallbacks {
58
+ /**
59
+ * Called after the JS class definition has been registered
60
+ */
61
+ elementDidRegister?(name: string): void;
62
+ /**
63
+ * Called before the template has been evaluated and assigned
64
+ */
65
+ templateWillUpdate?(name: string): void;
66
+ }
67
+
68
+ declare interface JSONSchema extends JSONSchemaCommon {
69
+ $schema: string;
70
+ $id: string;
71
+ $defs?: Record<string, JSONSchemaDefinition>;
72
+ }
73
+
74
+ declare interface JSONSchemaCommon {
75
+ type?: string;
76
+ properties?: any;
77
+ items?: any;
78
+ anyOf?: Array<any>;
79
+ $ref?: string;
80
+ }
81
+
82
+ declare interface JSONSchemaDefinition extends JSONSchemaCommon {
83
+ $fast_context: string;
84
+ $fast_parent_contexts: Array<string>;
85
+ }
86
+
87
+ /**
88
+ * ObserverMap provides functionality for caching binding paths, extracting root properties,
89
+ * and defining observable properties on class prototypes
90
+ */
91
+ export declare class ObserverMap {
92
+ private schema;
93
+ private classPrototype;
94
+ constructor(classPrototype: any, schema: Schema);
95
+ defineProperties(): void;
96
+ /**
97
+ * Creates a proxy for an object that intercepts property mutations and triggers Observable notifications
98
+ * @param target - The target instance that owns the root property
99
+ * @param rootProperty - The name of the root property for notification purposes
100
+ * @param object - The object to wrap with a proxy
101
+ * @returns A proxy that triggers notifications on property mutations
102
+ */
103
+ private getAndAssignObservables;
104
+ /**
105
+ * Creates a property change handler function for observable properties
106
+ * This handler is called when an observable property transitions from undefined to a defined value
107
+ * @param propertyName - The name of the property for which to create the change handler
108
+ * @returns A function that handles property changes and sets up proxies for object values
109
+ */
110
+ private defineChanged;
111
+ }
112
+
113
+ /**
114
+ * Values for the observerMap element option.
115
+ */
116
+ declare const ObserverMapOption: {
117
+ readonly all: "all";
118
+ };
119
+
120
+ /**
121
+ * Type for the observerMap element option.
122
+ */
123
+ declare type ObserverMapOption = (typeof ObserverMapOption)[keyof typeof ObserverMapOption];
124
+
125
+ declare interface RegisterPathConfig {
126
+ rootPropertyName: string;
127
+ pathConfig: CachedPath;
128
+ childrenMap: ChildrenMap | null;
129
+ }
130
+
131
+ /**
132
+ * A mixin function that extends a base class with additional functionality for
133
+ * rendering and hydration.
134
+ *
135
+ * @param BaseCtor - The base class to extend.
136
+ * @returns A new class that extends the provided base class with additional functionality for rendering and hydration.
137
+ * @public
138
+ */
139
+ export declare function RenderableFASTElement<T extends Constructable<FASTElement>>(BaseCtor: T): T;
140
+
141
+ declare interface RepeatCachedPath extends CachedPathCommon {
142
+ type: RepeatCachedPathType;
143
+ }
144
+
145
+ declare type RepeatCachedPathType = "repeat";
146
+
147
+ /**
148
+ * A constructed JSON schema from a template
149
+ */
150
+ declare class Schema {
151
+ /**
152
+ * The name of the custom element
153
+ */
154
+ private customElementName;
155
+ /**
156
+ * A JSON schema describing each root schema
157
+ */
158
+ static jsonSchemaMap: CachedPathMap;
159
+ constructor(name: string);
160
+ /**
161
+ * Add a path to a schema
162
+ * @param config RegisterPathConfig
163
+ */
164
+ addPath(config: RegisterPathConfig): void;
165
+ /**
166
+ * Gets the JSON schema for a property name
167
+ * @param rootPropertyName - the root property the JSON schema is mapped to
168
+ * @returns The JSON schema for the root property
169
+ */
170
+ getSchema(rootPropertyName: string): JSONSchema | null;
171
+ /**
172
+ * Gets root properties
173
+ * @returns IterableIterator<string>
174
+ */
175
+ getRootProperties(): IterableIterator<string>;
176
+ /**
177
+ * Get a path split into property names
178
+ * @param path The dot syntax path e.g. a.b.c
179
+ * @returns An array of items in the path
180
+ */
181
+ private getSplitPath;
182
+ /**
183
+ * Gets the path to the $def
184
+ * @param context The context name e.g. {{item in items}} in a repeat creates the "item" context
185
+ * @returns A string to use as a $ref
186
+ */
187
+ private getDefsPath;
188
+ /**
189
+ * Get the schema $id
190
+ * @param customElementName - The custom element name
191
+ * @param propertyName - The property name
192
+ * @returns The ID that can be used in the JSON schema as $id
193
+ */
194
+ private getSchemaId;
195
+ /**
196
+ * Add a new JSON schema to the JSON schema map
197
+ * @param propertyName The name of the property to assign this JSON schema to
198
+ */
199
+ private addNewSchema;
200
+ /**
201
+ * Add properties to a context
202
+ * @param schema The schema to add the properties to
203
+ * @param splitPath The path split into property/context names
204
+ * @param context The paths context
205
+ */
206
+ private addPropertiesToAContext;
207
+ /**
208
+ * Add properties to an object
209
+ * @param schema The schema to add the properties to
210
+ * @param splitPath The path split into property/context names
211
+ * @param context The paths context
212
+ * @param type The data type (see JSON schema for details)
213
+ */
214
+ private addPropertiesToAnObject;
215
+ /**
216
+ * Add an array to an object property
217
+ * @param schema The schema to add the properties to
218
+ * @param context The name of the context
219
+ */
220
+ private addArrayToAnObject;
221
+ /**
222
+ * Add a context to the $defs property
223
+ * @param schema The schema to use
224
+ * @param propertyName The name of the property the context belongs to
225
+ * @param currentContext The current context
226
+ * @param parentContext The parent context
227
+ * @returns
228
+ */
229
+ private addContext;
230
+ /**
231
+ * Get parent contexts
232
+ * @param schema The schema to use
233
+ * @param parentContext The parent context
234
+ * @param contexts A list of parent contexts
235
+ * @returns
236
+ */
237
+ private getParentContexts;
238
+ }
2
239
 
3
240
  /**
4
241
  * The <f-template> custom element that will provide view logic to the element
@@ -8,12 +245,52 @@ export declare class TemplateElement extends FASTElement {
8
245
  * The name of the custom element this template will be applied to
9
246
  */
10
247
  name?: string;
11
- private partials;
248
+ /**
249
+ * A dictionary of custom element options
250
+ */
251
+ static elementOptions: ElementOptionsDictionary;
252
+ /**
253
+ * ObserverMap instance for caching binding paths
254
+ */
255
+ private observerMap?;
256
+ /**
257
+ * Default element options
258
+ */
259
+ private static defaultElementOptions;
260
+ /**
261
+ * Metadata containing JSON schema for properties on a custom eleemnt
262
+ */
263
+ private schema?;
264
+ /**
265
+ * Lifecycle callbacks for hydration events
266
+ */
267
+ private static lifecycleCallbacks;
268
+ /**
269
+ * Configure lifecycle callbacks for hydration events.
270
+ *
271
+ * @param callbacks - Lifecycle callbacks to configure.
272
+ * @returns The {@link TemplateElement} class.
273
+ */
274
+ static config(callbacks: HydrationLifecycleCallbacks): typeof TemplateElement;
275
+ /**
276
+ * Set options for custom elements.
277
+ *
278
+ * @param elementOptions - A dictionary of custom element options
279
+ * @returns The TemplateElement class.
280
+ */
281
+ static options(elementOptions?: ElementOptionsDictionary): typeof TemplateElement;
282
+ constructor();
283
+ /**
284
+ * Set options for a custom element
285
+ * @param name - The name of the custom element to set options for.
286
+ */
287
+ private static setOptions;
12
288
  connectedCallback(): void;
13
289
  /**
14
290
  * Resolve strings and values from an innerHTML string
15
291
  * @param innerHTML - The innerHTML.
16
292
  * @param self - Indicates that this should refer to itself instead of a property when creating bindings.
293
+ * @param observerMap - ObserverMap instance for caching binding paths (optional).
17
294
  */
18
295
  private resolveStringsAndValues;
19
296
  /**
@@ -27,6 +304,8 @@ export declare class TemplateElement extends FASTElement {
27
304
  * @param behaviorConfig - The directive behavior configuration object.
28
305
  * @param externalValues - The interpreted values from the parent.
29
306
  * @param innerHTML - The innerHTML.
307
+ * @param self - Indicates that this should refer to itself instead of a property when creating bindings.
308
+ * @param observerMap - ObserverMap instance for caching binding paths (optional).
30
309
  */
31
310
  private resolveTemplateDirective;
32
311
  /**
@@ -43,6 +322,7 @@ export declare class TemplateElement extends FASTElement {
43
322
  * @param values - The interpreted values.
44
323
  * @param self - Indicates that this should refer to itself instead of a property when creating bindings.
45
324
  * @param behaviorConfig - The binding behavior configuration object.
325
+ * @param observerMap - ObserverMap instance for caching binding paths (optional).
46
326
  */
47
327
  private resolveDataBinding;
48
328
  /**
@@ -51,13 +331,9 @@ export declare class TemplateElement extends FASTElement {
51
331
  * @param strings - The strings array.
52
332
  * @param values - The interpreted values.
53
333
  * @param self - Indicates that this should refer to itself instead of a property when creating bindings.
334
+ * @param observerMap - ObserverMap instance for caching binding paths (optional).
54
335
  */
55
336
  private resolveInnerHTML;
56
- /**
57
- * Resolve all partial templates
58
- * @param unresolvedInnerHTML - The innerHTML.
59
- */
60
- private resolveAllPartials;
61
337
  }
62
338
 
63
339
  export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/fast-html",
3
- "version": "1.0.0-alpha.3",
3
+ "version": "1.0.0-alpha.31",
4
4
  "type": "module",
5
5
  "author": {
6
6
  "name": "Microsoft",
@@ -17,7 +17,8 @@
17
17
  "url": "https://github.com/Microsoft/fast/issues/new/choose"
18
18
  },
19
19
  "files": [
20
- "./dist"
20
+ "./dist",
21
+ "./rules/*.yml"
21
22
  ],
22
23
  "scripts": {
23
24
  "clean": "tsc -b --clean src",
@@ -28,12 +29,13 @@
28
29
  "build:binding": "webpack --config ./src/fixtures/binding/webpack.config.js",
29
30
  "build:children": "webpack --config ./src/fixtures/children/webpack.config.js",
30
31
  "build:dot-syntax": "webpack --config ./src/fixtures/dot-syntax/webpack.config.js",
31
- "build:partial": "webpack --config ./src/fixtures/partial/webpack.config.js",
32
32
  "build:when": "webpack --config ./src/fixtures/when/webpack.config.js",
33
33
  "build:ref": "webpack --config ./src/fixtures/ref/webpack.config.js",
34
34
  "build:repeat": "webpack --config ./src/fixtures/repeat/webpack.config.js",
35
+ "build:observer-map": "webpack --config ./src/fixtures/observer-map/webpack.config.js",
35
36
  "build:slotted": "webpack --config ./src/fixtures/slotted/webpack.config.js",
36
- "build-app": "npm run build:attribute && npm run build:dot-syntax && npm run build:partial && npm run build:event && npm run build:children && npm run build:binding && npm run build:when && npm run build:ref && npm run build:repeat && npm run build:slotted",
37
+ "build:lifecycle-callbacks": "webpack --config ./src/fixtures/lifecycle-callbacks/webpack.config.js",
38
+ "build-app": "npm run build:attribute && npm run build:dot-syntax && npm run build:event && npm run build:children && npm run build:binding && npm run build:when && npm run build:ref && npm run build:repeat && npm run build:observer-map && npm run build:slotted && npm run build:lifecycle-callbacks",
37
39
  "build-server": "tsc -b server",
38
40
  "doc": "api-extractor run --local",
39
41
  "doc:ci": "api-extractor run",
@@ -43,8 +45,9 @@
43
45
  "pretest": "npm run build && npm run build-server",
44
46
  "prettier:diff": "prettier --config ../../../.prettierrc \"**/*.{ts,html}\" --list-different",
45
47
  "prettier": "prettier --config ../../../.prettierrc --write \"**/*.{ts,html}\"",
46
- "test": "npm run build-app && playwright test --config=playwright.config.cjs",
48
+ "test": "npm run build-app && playwright test && npm run test:rules",
47
49
  "test-server": "node server/dist/server.js",
50
+ "test:rules": "sg test --skip-snapshot-tests",
48
51
  "install-playwright-browsers": "npm run playwright install",
49
52
  "dev": "npm run build && npm run build-app && npm run build-server && npm run test-server"
50
53
  },
@@ -54,17 +57,19 @@
54
57
  "types": "./dist/dts/index.d.ts",
55
58
  "default": "./dist/esm/index.js"
56
59
  },
60
+ "./rules/*.yml": "./rules/*.yml",
57
61
  "./package.json": "./package.json"
58
62
  },
59
63
  "sideEffects": [
60
64
  "./dist/esm/index.js"
61
65
  ],
62
66
  "peerDependencies": {
63
- "@microsoft/fast-element": "^2.2.0"
67
+ "@microsoft/fast-element": "^2.8.1"
64
68
  },
65
69
  "devDependencies": {
70
+ "@ast-grep/cli": "^0.37.0",
66
71
  "@microsoft/api-extractor": "^7.47.0",
67
- "@microsoft/fast-element": "^2.2.0",
72
+ "@microsoft/fast-element": "^2.8.1",
68
73
  "@playwright/test": "^1.49.0",
69
74
  "@types/express": "^4.17.21",
70
75
  "@types/node": "^17.0.17",
@@ -0,0 +1,38 @@
1
+ # https://ast-grep.github.io/guide/rule-config.html#rule
2
+ # from: ${ref("defaultSlot")}
3
+ # to: f-ref="{defaultSlot}"
4
+ id: binding - convert attribute directives
5
+ language: typescript
6
+ utils:
7
+ call-expression:
8
+ has:
9
+ nthChild: 1
10
+ kind: call_expression
11
+ all:
12
+ - matches: identifier
13
+ - matches: arguments
14
+ identifier:
15
+ has:
16
+ nthChild: 1
17
+ kind: identifier
18
+ pattern: $DIRECTIVE
19
+ arguments:
20
+ has:
21
+ kind: arguments
22
+ matches: string
23
+ string:
24
+ has:
25
+ kind: string
26
+ matches: string-fragment
27
+ string-fragment:
28
+ has:
29
+ kind: string_fragment
30
+ pattern: $STRING
31
+ constraints:
32
+ DIRECTIVE:
33
+ regex: ref|slotted|children
34
+ rule:
35
+ kind: template_substitution
36
+ matches: call-expression
37
+ fix:
38
+ 'f-$DIRECTIVE="{$STRING}"'
@@ -0,0 +1,41 @@
1
+ # https://ast-grep.github.io/guide/rule-config.html#rule
2
+ # from: ${(x, c) => x.foo(c.event)}
3
+ # to: {foo(event)}
4
+ id: binding - convert call expression with event argument
5
+ language: typescript
6
+ utils:
7
+ arrow-function:
8
+ has:
9
+ kind: arrow_function
10
+ matches: call-expression
11
+ call-expression:
12
+ has:
13
+ kind: call_expression
14
+ all:
15
+ - matches: handler-arguments
16
+ - matches: handler-expression
17
+ handler-expression:
18
+ has:
19
+ kind: member_expression
20
+ matches: handler-expression-property
21
+ handler-expression-property:
22
+ has:
23
+ kind: property_identifier
24
+ pattern: $A
25
+ handler-arguments:
26
+ has:
27
+ kind: arguments
28
+ matches: handler-arguments-member-expression
29
+ handler-arguments-member-expression:
30
+ has:
31
+ kind: member_expression
32
+ matches: handler-arguments-property-identifier
33
+ handler-arguments-property-identifier:
34
+ has:
35
+ kind: property_identifier
36
+ pattern: $B
37
+ rule:
38
+ kind: template_substitution
39
+ matches: arrow-function
40
+ fix:
41
+ '{$A($B)}'
@@ -0,0 +1,33 @@
1
+ # https://ast-grep.github.io/guide/rule-config.html#rule
2
+ # from: ${x => x.foo}
3
+ # to: {{foo}}
4
+ id: binding - convert member expression
5
+ language: typescript
6
+ utils:
7
+ arrow-function:
8
+ has:
9
+ kind: arrow_function
10
+ all:
11
+ - matches: identifier
12
+ - matches: member-expression
13
+ member-expression:
14
+ has:
15
+ kind: member_expression
16
+ nthChild: 2
17
+ all:
18
+ - matches: identifier
19
+ - matches: property-identifier
20
+ identifier:
21
+ has:
22
+ kind: identifier
23
+ nthChild: 1
24
+ property-identifier:
25
+ has:
26
+ kind: property_identifier
27
+ nthChild: 2
28
+ pattern: $A
29
+ rule:
30
+ kind: template_substitution
31
+ matches: arrow-function
32
+ fix:
33
+ '{{$A}}'
@@ -0,0 +1,16 @@
1
+ # https://ast-grep.github.io/guide/rule-config.html#rule
2
+ # from: export const template = html`<slot></slot>`
3
+ # to: `<slot></slot>`
4
+ id: convert tag function to template literal
5
+ language: typescript
6
+ utils:
7
+ is-tag-template:
8
+ has:
9
+ kind: template_string
10
+ pattern: $B
11
+ rule:
12
+ kind: call_expression
13
+ matches: is-tag-template
14
+ pattern: $A
15
+ fix:
16
+ '$B'
@@ -1,31 +0,0 @@
1
- import { TemplateElement } from "@microsoft/fast-html";
2
- import { FASTElement } from "@microsoft/fast-element";
3
- class TestElement extends FASTElement {
4
- constructor() {
5
- super(...arguments);
6
- this.items = [
7
- {
8
- text: "Hello",
9
- },
10
- {
11
- text: "Earth",
12
- items: [
13
- {
14
- text: "Pluto",
15
- items: [
16
- {
17
- text: "Mars",
18
- },
19
- ],
20
- },
21
- ],
22
- },
23
- ];
24
- }
25
- }
26
- TestElement.define({
27
- name: "test-element",
28
- });
29
- TemplateElement.define({
30
- name: "f-template",
31
- });
@@ -1,14 +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 partial", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
5
- yield page.goto("/partial");
6
- const customElement = yield page.locator("#test");
7
- let customElementListItems = yield customElement.locator("li");
8
- expect(yield customElementListItems.count()).toEqual(4);
9
- expect(yield customElementListItems.nth(0).textContent()).toEqual("Hello");
10
- expect(yield customElementListItems.nth(1).textContent()).toContain("Earth");
11
- expect(yield customElementListItems.nth(2).textContent()).toContain("Pluto");
12
- expect(yield customElementListItems.nth(3).textContent()).toContain("Mars");
13
- }));
14
- }));