glass-easel-miniprogram-adapter 0.5.4 → 0.6.0

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.
@@ -32,6 +32,7 @@ export class BaseBehaviorBuilder<
32
32
  TChainingFilter extends ChainingFilterType = never,
33
33
  TPendingChainingFilter extends ChainingFilterType = never,
34
34
  TComponentExport = never,
35
+ TExtraThisFields extends DataList = Empty,
35
36
  > {
36
37
  protected _$codeSpace!: CodeSpace
37
38
  protected _$!: glassEasel.BehaviorBuilder<
@@ -40,7 +41,8 @@ export class BaseBehaviorBuilder<
40
41
  TProperty,
41
42
  TMethod,
42
43
  TChainingFilter,
43
- TPendingChainingFilter
44
+ TPendingChainingFilter,
45
+ TExtraThisFields
44
46
  >
45
47
  protected _$parents: GeneralBehavior[] = []
46
48
  protected _$export?: (source: GeneralComponent | null) => TComponentExport
@@ -71,7 +73,8 @@ export class BaseBehaviorBuilder<
71
73
  TMethod,
72
74
  TChainingFilter,
73
75
  TPendingChainingFilter,
74
- TNewComponentExport
76
+ TNewComponentExport,
77
+ TExtraThisFields
75
78
  >,
76
79
  TChainingFilter
77
80
  > {
@@ -90,7 +93,8 @@ export class BaseBehaviorBuilder<
90
93
  TMethod,
91
94
  TChainingFilter,
92
95
  TPendingChainingFilter,
93
- TComponentExport
96
+ TComponentExport,
97
+ TExtraThisFields
94
98
  >,
95
99
  TChainingFilter
96
100
  > {
@@ -109,7 +113,8 @@ export class BaseBehaviorBuilder<
109
113
  TMethod,
110
114
  TChainingFilter,
111
115
  TPendingChainingFilter,
112
- TComponentExport
116
+ TComponentExport,
117
+ TExtraThisFields
113
118
  >,
114
119
  TChainingFilter
115
120
  > {
@@ -123,7 +128,7 @@ export class BaseBehaviorBuilder<
123
128
  * The public method can be used as an event handler, and can be visited in component instance.
124
129
  */
125
130
  methods<T extends MethodList>(
126
- funcs: T & ThisType<Component<TData, TProperty, TMethod & T, any>>,
131
+ funcs: T & ThisType<Component<TData, TProperty, TMethod & T, any, TExtraThisFields>>,
127
132
  ): ResolveBehaviorBuilder<
128
133
  BaseBehaviorBuilder<
129
134
  TPrevData,
@@ -132,7 +137,8 @@ export class BaseBehaviorBuilder<
132
137
  TMethod & T,
133
138
  TChainingFilter,
134
139
  TPendingChainingFilter,
135
- TComponentExport
140
+ TComponentExport,
141
+ TExtraThisFields
136
142
  >,
137
143
  TChainingFilter
138
144
  > {
@@ -153,7 +159,7 @@ export class BaseBehaviorBuilder<
153
159
  >,
154
160
  >(
155
161
  paths: P,
156
- func: (this: Component<TData, TProperty, TMethod, any>, newValue: V) => void,
162
+ func: (this: Component<TData, TProperty, TMethod, any, TExtraThisFields>, newValue: V) => void,
157
163
  once?: boolean,
158
164
  ): ResolveBehaviorBuilder<this, TChainingFilter>
159
165
  observer<
@@ -169,14 +175,17 @@ export class BaseBehaviorBuilder<
169
175
  >(
170
176
  paths: readonly [...P],
171
177
  func: (
172
- this: Component<TData, TProperty, TMethod, any>,
178
+ this: Component<TData, TProperty, TMethod, any, TExtraThisFields>,
173
179
  ...newValues: V extends any[] ? V : never
174
180
  ) => void,
175
181
  once?: boolean,
176
182
  ): ResolveBehaviorBuilder<this, TChainingFilter>
177
183
  observer(
178
184
  paths: string | readonly string[],
179
- func: (this: Component<TData, TProperty, TMethod, any>, ...args: any[]) => any,
185
+ func: (
186
+ this: Component<TData, TProperty, TMethod, any, TExtraThisFields>,
187
+ ...args: any[]
188
+ ) => any,
180
189
  once = false,
181
190
  ): ResolveBehaviorBuilder<this, TChainingFilter> {
182
191
  this._$.observer(paths as any, func as any, once)
@@ -189,7 +198,7 @@ export class BaseBehaviorBuilder<
189
198
  lifetime<L extends keyof Lifetimes>(
190
199
  name: L,
191
200
  func: (
192
- this: Component<TData, TProperty, TMethod, any>,
201
+ this: Component<TData, TProperty, TMethod, any, TExtraThisFields>,
193
202
  ...args: Parameters<Lifetimes[L]>
194
203
  ) => ReturnType<Lifetimes[L]>,
195
204
  once = false,
@@ -203,7 +212,10 @@ export class BaseBehaviorBuilder<
203
212
  */
204
213
  pageLifetime(
205
214
  name: string,
206
- func: (this: Component<TData, TProperty, TMethod, any>, ...args: any[]) => any,
215
+ func: (
216
+ this: Component<TData, TProperty, TMethod, any, TExtraThisFields>,
217
+ ...args: any[]
218
+ ) => any,
207
219
  once = false,
208
220
  ): ResolveBehaviorBuilder<this, TChainingFilter> {
209
221
  this._$.pageLifetime(name, func as any, once)
@@ -215,7 +227,8 @@ export class BaseBehaviorBuilder<
215
227
  */
216
228
  relation(
217
229
  name: string,
218
- rel: RelationParams & ThisType<Component<TData, TProperty, TMethod, TComponentExport>>,
230
+ rel: RelationParams &
231
+ ThisType<Component<TData, TProperty, TMethod, TComponentExport, TExtraThisFields>>,
219
232
  ): ResolveBehaviorBuilder<this, TChainingFilter> {
220
233
  const target =
221
234
  rel.target instanceof Behavior || rel.target instanceof ComponentType
@@ -234,11 +247,11 @@ export class BaseBehaviorBuilder<
234
247
 
235
248
  init<TExport extends Record<string, TaggedMethod<(...args: any[]) => any>> | void>(
236
249
  func: (
237
- this: Component<TData, TProperty, TMethod, TComponentExport>,
250
+ this: Component<TData, TProperty, TMethod, TComponentExport, TExtraThisFields>,
238
251
  builderContext: BuilderContext<
239
252
  TPrevData,
240
253
  TProperty,
241
- Component<TData, TProperty, TMethod, TComponentExport>
254
+ Component<TData, TProperty, TMethod, TComponentExport, TExtraThisFields>
242
255
  >,
243
256
  ) => TExport,
244
257
  // eslint-disable-next-line function-paren-newline
@@ -250,7 +263,8 @@ export class BaseBehaviorBuilder<
250
263
  TMethod,
251
264
  TChainingFilter,
252
265
  TPendingChainingFilter,
253
- TComponentExport
266
+ TComponentExport,
267
+ TExtraThisFields
254
268
  >,
255
269
  TChainingFilter
256
270
  > {
@@ -294,7 +308,13 @@ export class BaseBehaviorBuilder<
294
308
  implement(traitBehavior._$, impl)
295
309
  }) as BuilderContext<TPrevData, TProperty, TMethod>['implement']
296
310
 
297
- const methodCaller = this as unknown as Component<TData, TProperty, TMethod, TComponentExport>
311
+ const methodCaller = this as unknown as Component<
312
+ TData,
313
+ TProperty,
314
+ TMethod,
315
+ TComponentExport,
316
+ TExtraThisFields
317
+ >
298
318
 
299
319
  return func.call(methodCaller, {
300
320
  self: methodCaller,
@@ -331,7 +351,8 @@ export class BaseBehaviorBuilder<
331
351
  TData & TNewData,
332
352
  TProperty & TNewProperty,
333
353
  TMethod & TNewMethod,
334
- TNewComponentExport
354
+ TNewComponentExport,
355
+ TExtraThisFields
335
356
  >
336
357
  >,
337
358
  ): ResolveBehaviorBuilder<
@@ -342,7 +363,8 @@ export class BaseBehaviorBuilder<
342
363
  TMethod & TNewMethod,
343
364
  TChainingFilter,
344
365
  TPendingChainingFilter,
345
- TNewComponentExport
366
+ TNewComponentExport,
367
+ TExtraThisFields
346
368
  >,
347
369
  TChainingFilter
348
370
  > {
@@ -30,6 +30,7 @@ export class BehaviorBuilder<
30
30
  TChainingFilter extends ChainingFilterType = never,
31
31
  TPendingChainingFilter extends ChainingFilterType = never,
32
32
  TComponentExport = never,
33
+ TExtraThisFields extends DataList = Empty,
33
34
  > extends BaseBehaviorBuilder<
34
35
  TPrevData,
35
36
  TData,
@@ -37,7 +38,8 @@ export class BehaviorBuilder<
37
38
  TMethod,
38
39
  TChainingFilter,
39
40
  TPendingChainingFilter,
40
- TComponentExport
41
+ TComponentExport,
42
+ TExtraThisFields
41
43
  > {
42
44
  private _$definitionFilter: DefinitionFilter | undefined
43
45
 
@@ -66,7 +68,8 @@ export class BehaviorBuilder<
66
68
  add: TAddedFields
67
69
  remove: TRemovedFields
68
70
  },
69
- TComponentExport
71
+ TComponentExport,
72
+ TExtraThisFields
70
73
  >,
71
74
  TChainingFilter
72
75
  > {
@@ -80,8 +83,9 @@ export class BehaviorBuilder<
80
83
  UProperty extends PropertyList,
81
84
  UMethod extends MethodList,
82
85
  UChainingFilter extends ChainingFilterType,
86
+ UExtraThisFields extends DataList,
83
87
  >(
84
- behavior: Behavior<UData, UProperty, UMethod, UChainingFilter>,
88
+ behavior: Behavior<UData, UProperty, UMethod, UChainingFilter, UExtraThisFields>,
85
89
  ): ResolveBehaviorBuilder<
86
90
  BehaviorBuilder<
87
91
  TPrevData,
@@ -90,7 +94,8 @@ export class BehaviorBuilder<
90
94
  TMethod & UMethod,
91
95
  UChainingFilter,
92
96
  TPendingChainingFilter,
93
- TComponentExport
97
+ TComponentExport,
98
+ TExtraThisFields & UExtraThisFields
94
99
  >,
95
100
  UChainingFilter
96
101
  > {
@@ -111,7 +116,8 @@ export class BehaviorBuilder<
111
116
  TMethod,
112
117
  TChainingFilter,
113
118
  TPendingChainingFilter,
114
- TNewComponentExport
119
+ TNewComponentExport,
120
+ TExtraThisFields
115
121
  >,
116
122
  TChainingFilter
117
123
  > {
@@ -134,7 +140,8 @@ export class BehaviorBuilder<
134
140
  TMethod,
135
141
  TChainingFilter,
136
142
  TPendingChainingFilter,
137
- TComponentExport
143
+ TComponentExport,
144
+ TExtraThisFields
138
145
  >,
139
146
  TChainingFilter
140
147
  > {
@@ -157,7 +164,8 @@ export class BehaviorBuilder<
157
164
  TMethod,
158
165
  TChainingFilter,
159
166
  TPendingChainingFilter,
160
- TComponentExport
167
+ TComponentExport,
168
+ TExtraThisFields
161
169
  >,
162
170
  TChainingFilter
163
171
  > {
@@ -170,7 +178,7 @@ export class BehaviorBuilder<
170
178
  * The public method can be used as an event handler, and can be visited in component instance.
171
179
  */
172
180
  override methods<T extends MethodList>(
173
- funcs: T & ThisType<Component<TData, TProperty, TMethod & T, any>>,
181
+ funcs: T & ThisType<Component<TData, TProperty, TMethod & T, any, TExtraThisFields>>,
174
182
  ): ResolveBehaviorBuilder<
175
183
  BehaviorBuilder<
176
184
  TPrevData,
@@ -179,7 +187,8 @@ export class BehaviorBuilder<
179
187
  TMethod & T,
180
188
  TChainingFilter,
181
189
  TPendingChainingFilter,
182
- TComponentExport
190
+ TComponentExport,
191
+ TExtraThisFields
183
192
  >,
184
193
  TChainingFilter
185
194
  > {
@@ -195,11 +204,11 @@ export class BehaviorBuilder<
195
204
  */
196
205
  override init<TExport extends Record<string, TaggedMethod<(...args: any[]) => any>> | void>(
197
206
  func: (
198
- this: Component<TData, TProperty, TMethod, TComponentExport>,
207
+ this: Component<TData, TProperty, TMethod, TComponentExport, TExtraThisFields>,
199
208
  builderContext: BuilderContext<
200
209
  TPrevData,
201
210
  TProperty,
202
- Component<TData, TProperty, TMethod, TComponentExport>
211
+ Component<TData, TProperty, TMethod, TComponentExport, TExtraThisFields>
203
212
  >,
204
213
  ) => TExport,
205
214
  // eslint-disable-next-line function-paren-newline
@@ -211,7 +220,8 @@ export class BehaviorBuilder<
211
220
  TMethod,
212
221
  TChainingFilter,
213
222
  TPendingChainingFilter,
214
- TComponentExport
223
+ TComponentExport,
224
+ TExtraThisFields
215
225
  >,
216
226
  TChainingFilter
217
227
  > {
@@ -231,7 +241,8 @@ export class BehaviorBuilder<
231
241
  TData & TNewData,
232
242
  TProperty & TNewProperty,
233
243
  TMethod & TNewMethod,
234
- TNewComponentExport
244
+ TNewComponentExport,
245
+ TExtraThisFields
235
246
  >
236
247
  >,
237
248
  ): ResolveBehaviorBuilder<
@@ -242,7 +253,8 @@ export class BehaviorBuilder<
242
253
  TMethod & TNewMethod,
243
254
  TChainingFilter,
244
255
  TPendingChainingFilter,
245
- TNewComponentExport
256
+ TNewComponentExport,
257
+ TExtraThisFields
246
258
  >,
247
259
  TChainingFilter
248
260
  > {
@@ -254,7 +266,14 @@ export class BehaviorBuilder<
254
266
  /**
255
267
  * Finish the behavior definition process
256
268
  */
257
- register(): Behavior<TData, TProperty, TMethod, TPendingChainingFilter, TComponentExport> {
269
+ register(): Behavior<
270
+ TData,
271
+ TProperty,
272
+ TMethod,
273
+ TPendingChainingFilter,
274
+ TComponentExport,
275
+ TExtraThisFields
276
+ > {
258
277
  return new Behavior(
259
278
  this._$.registerBehavior(),
260
279
  this._$parents,
@@ -262,4 +281,23 @@ export class BehaviorBuilder<
262
281
  this._$export,
263
282
  )
264
283
  }
284
+
285
+ /**
286
+ * Add extra this fields type
287
+ */
288
+ extraThisFieldsType<T extends DataList>(): ResolveBehaviorBuilder<
289
+ BehaviorBuilder<
290
+ TPrevData,
291
+ TData,
292
+ TProperty,
293
+ TMethod,
294
+ TChainingFilter,
295
+ TPendingChainingFilter,
296
+ TComponentExport,
297
+ TExtraThisFields & T
298
+ >,
299
+ TChainingFilter
300
+ > {
301
+ return this as any
302
+ }
265
303
  }
@@ -36,6 +36,7 @@ export class ComponentBuilder<
36
36
  TChainingFilter extends ChainingFilterType = never,
37
37
  TPendingChainingFilter extends ChainingFilterType = never,
38
38
  TComponentExport = never,
39
+ TExtraThisFields extends DataList = Empty,
39
40
  > extends BaseBehaviorBuilder<
40
41
  TPrevData,
41
42
  TData,
@@ -43,7 +44,8 @@ export class ComponentBuilder<
43
44
  TMethod,
44
45
  TChainingFilter,
45
46
  TPendingChainingFilter,
46
- TComponentExport
47
+ TComponentExport,
48
+ TExtraThisFields
47
49
  > {
48
50
  private _$is!: string
49
51
  private _$alias?: string[]
@@ -92,8 +94,16 @@ export class ComponentBuilder<
92
94
  UMethod extends MethodList,
93
95
  UChainingFilter extends ChainingFilterType,
94
96
  UComponentExport,
97
+ UExtraThisFields extends DataList,
95
98
  >(
96
- behavior: Behavior<UData, UProperty, UMethod, UChainingFilter, UComponentExport>,
99
+ behavior: Behavior<
100
+ UData,
101
+ UProperty,
102
+ UMethod,
103
+ UChainingFilter,
104
+ UComponentExport,
105
+ UExtraThisFields
106
+ >,
97
107
  ): ResolveBehaviorBuilder<
98
108
  ComponentBuilder<
99
109
  TPrevData,
@@ -102,7 +112,8 @@ export class ComponentBuilder<
102
112
  TMethod & UMethod,
103
113
  UChainingFilter,
104
114
  TPendingChainingFilter,
105
- UComponentExport
115
+ UComponentExport,
116
+ TExtraThisFields & UExtraThisFields
106
117
  >,
107
118
  UChainingFilter
108
119
  > {
@@ -127,7 +138,8 @@ export class ComponentBuilder<
127
138
  TMethod,
128
139
  TChainingFilter,
129
140
  TPendingChainingFilter,
130
- TNewComponentExport
141
+ TNewComponentExport,
142
+ TExtraThisFields
131
143
  >,
132
144
  TChainingFilter
133
145
  > {
@@ -152,7 +164,8 @@ export class ComponentBuilder<
152
164
  TMethod,
153
165
  TChainingFilter,
154
166
  TPendingChainingFilter,
155
- TComponentExport
167
+ TComponentExport,
168
+ TExtraThisFields
156
169
  >,
157
170
  TChainingFilter
158
171
  > {
@@ -175,7 +188,8 @@ export class ComponentBuilder<
175
188
  TMethod,
176
189
  TChainingFilter,
177
190
  TPendingChainingFilter,
178
- TComponentExport
191
+ TComponentExport,
192
+ TExtraThisFields
179
193
  >,
180
194
  TChainingFilter
181
195
  > {
@@ -188,7 +202,7 @@ export class ComponentBuilder<
188
202
  * The public method can be used as an event handler, and can be visited in component instance.
189
203
  */
190
204
  override methods<T extends MethodList>(
191
- funcs: T & ThisType<Component<TData, TProperty, TMethod & T, any>>,
205
+ funcs: T & ThisType<Component<TData, TProperty, TMethod & T, any, TExtraThisFields>>,
192
206
  ): ResolveBehaviorBuilder<
193
207
  ComponentBuilder<
194
208
  TPrevData,
@@ -197,7 +211,8 @@ export class ComponentBuilder<
197
211
  TMethod & T,
198
212
  TChainingFilter,
199
213
  TPendingChainingFilter,
200
- TComponentExport
214
+ TComponentExport,
215
+ TExtraThisFields
201
216
  >,
202
217
  TChainingFilter
203
218
  > {
@@ -213,11 +228,11 @@ export class ComponentBuilder<
213
228
  */
214
229
  override init<TExport extends Record<string, TaggedMethod<(...args: any[]) => any>> | void>(
215
230
  func: (
216
- this: Component<TData, TProperty, TMethod, TComponentExport>,
231
+ this: Component<TData, TProperty, TMethod, TComponentExport, TExtraThisFields>,
217
232
  builderContext: BuilderContext<
218
233
  TPrevData,
219
234
  TProperty,
220
- Component<TData, TProperty, TMethod, TComponentExport>
235
+ Component<TData, TProperty, TMethod, TComponentExport, TExtraThisFields>
221
236
  >,
222
237
  ) => TExport,
223
238
  // eslint-disable-next-line function-paren-newline
@@ -229,7 +244,8 @@ export class ComponentBuilder<
229
244
  TMethod,
230
245
  TChainingFilter,
231
246
  TPendingChainingFilter,
232
- TComponentExport
247
+ TComponentExport,
248
+ TExtraThisFields
233
249
  >,
234
250
  TChainingFilter
235
251
  > {
@@ -249,7 +265,8 @@ export class ComponentBuilder<
249
265
  TData & TNewData,
250
266
  TProperty & TNewProperty,
251
267
  TMethod & TNewMethod,
252
- TNewComponentExport
268
+ TNewComponentExport,
269
+ TExtraThisFields
253
270
  >
254
271
  >,
255
272
  ): ResolveBehaviorBuilder<
@@ -260,7 +277,8 @@ export class ComponentBuilder<
260
277
  TMethod & TNewMethod,
261
278
  TChainingFilter,
262
279
  TPendingChainingFilter,
263
- TNewComponentExport
280
+ TNewComponentExport,
281
+ TExtraThisFields
264
282
  >,
265
283
  TChainingFilter
266
284
  > {
@@ -271,7 +289,15 @@ export class ComponentBuilder<
271
289
 
272
290
  pageDefinition<TNewData extends DataList, TNewExtraFields extends { [k: PropertyKey]: any }>(
273
291
  def: PageDefinition<TNewData, TNewExtraFields> &
274
- ThisType<Component<TData & TNewData, TProperty, TMethod & TNewExtraFields, undefined>>,
292
+ ThisType<
293
+ Component<
294
+ TData & TNewData,
295
+ TProperty,
296
+ TMethod & TNewExtraFields,
297
+ undefined,
298
+ TExtraThisFields
299
+ >
300
+ >,
275
301
  ): ResolveBehaviorBuilder<
276
302
  ComponentBuilder<
277
303
  TPrevData,
@@ -280,7 +306,8 @@ export class ComponentBuilder<
280
306
  TMethod & TNewExtraFields,
281
307
  TChainingFilter,
282
308
  TPendingChainingFilter,
283
- TComponentExport
309
+ TComponentExport,
310
+ TExtraThisFields
284
311
  >,
285
312
  TChainingFilter
286
313
  > {
@@ -334,4 +361,23 @@ export class ComponentBuilder<
334
361
  })
335
362
  return new ComponentType(compDef)
336
363
  }
364
+
365
+ /**
366
+ * Add extra this fields type
367
+ */
368
+ extraThisFieldsType<T extends DataList>(): ResolveBehaviorBuilder<
369
+ ComponentBuilder<
370
+ TPrevData,
371
+ TData,
372
+ TProperty,
373
+ TMethod,
374
+ TChainingFilter,
375
+ TPendingChainingFilter,
376
+ TComponentExport,
377
+ TExtraThisFields & T
378
+ >,
379
+ TChainingFilter
380
+ > {
381
+ return this as any
382
+ }
337
383
  }
package/src/component.ts CHANGED
@@ -5,6 +5,7 @@ import { SelectorQuery } from './selector_query'
5
5
  import { IntersectionObserver } from './intersection'
6
6
  import { MediaQueryObserver } from './media_query'
7
7
 
8
+ type Empty = typeUtils.Empty
8
9
  type DataList = typeUtils.DataList
9
10
  type PropertyList = typeUtils.PropertyList
10
11
  type MethodList = typeUtils.MethodList
@@ -76,9 +77,10 @@ export type Component<
76
77
  TProperty extends PropertyList,
77
78
  TMethod extends MethodList,
78
79
  TComponentExport,
80
+ TExtraThisFields extends DataList = Empty,
79
81
  > = ComponentCaller<TData, TProperty, TMethod, TComponentExport> & {
80
82
  [k in keyof TMethod]: TMethod[k]
81
- }
83
+ } & TExtraThisFields
82
84
 
83
85
  export class ComponentCaller<
84
86
  TData extends DataList,
@@ -1069,4 +1069,43 @@ describe('define', () => {
1069
1069
  glassEasel.Element.pretendAttached(root.getComponent())
1070
1070
  expect(domHtml(root.getComponent())).toBe('<list><div>2</div><item></item><item></item></list>')
1071
1071
  })
1072
+
1073
+ test('chaining extraThisFieldsType', () => {
1074
+ const env = new MiniProgramEnv()
1075
+ const codeSpace = env.createCodeSpace('', true)
1076
+
1077
+ codeSpace.addCompiledTemplate(
1078
+ 'path/to/comp',
1079
+ tmpl(`
1080
+ <div>{{hello}}</div>
1081
+ `),
1082
+ )
1083
+
1084
+ const beh = codeSpace
1085
+ .behavior()
1086
+ .extraThisFieldsType<{ behDelayedData: string }>()
1087
+ .lifetime('created', function () {
1088
+ this.behDelayedData = ' World!'
1089
+ })
1090
+ .register()
1091
+
1092
+ codeSpace
1093
+ .component('path/to/comp')
1094
+ .behavior(beh)
1095
+ .extraThisFieldsType<{ delayedData: string }>()
1096
+ .data(() => ({
1097
+ hello: '',
1098
+ }))
1099
+ .lifetime('created', function () {
1100
+ this.delayedData = 'Hello'
1101
+ this.setData({
1102
+ hello: this.delayedData + this.behDelayedData,
1103
+ })
1104
+ })
1105
+ .register()
1106
+
1107
+ const ab = env.associateBackend()
1108
+ const root = ab.createRoot('body', codeSpace, 'path/to/comp')
1109
+ expect(domHtml(root.getComponent())).toBe('<div>Hello World!</div>')
1110
+ })
1072
1111
  })