glass-easel-miniprogram-adapter 0.7.0 → 0.8.1

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.
package/tests/env.test.ts CHANGED
@@ -135,7 +135,7 @@ describe('env', () => {
135
135
  const ab = env.associateBackend(backend)
136
136
  const root = ab.createRoot('body', codeSpace, 'path/to/comp')
137
137
  expect(domHtml(root.getComponent())).toBe(
138
- '<c-a>A</c-a><c-aa>A</c-aa><i-a></i-a><i-b></i-b><c-b>B</c-b>',
138
+ '<c-a is="inner-comp-1">A</c-a><c-aa is="inner-comp-1">A</c-aa><i-a></i-a><i-b></i-b><c-b is="inner-comp-2">B</c-b>',
139
139
  )
140
140
  })
141
141
  })
@@ -72,7 +72,9 @@ describe('selector query', () => {
72
72
  const ab = env.associateBackend()
73
73
  const root = ab.createRoot('body', codeSpace, 'path/to/comp')
74
74
  glassEasel.Element.pretendAttached(root.getComponent())
75
- expect(domHtml(root.getComponent())).toBe('<div><child>456</child><child>789</child></div>')
75
+ expect(domHtml(root.getComponent())).toBe(
76
+ '<div><child is="child/comp">456</child><child is="child/comp">789</child></div>',
77
+ )
76
78
  })
77
79
 
78
80
  test('select single component (with custom export)', () => {
@@ -159,7 +161,9 @@ describe('selector query', () => {
159
161
  const ab = env.associateBackend()
160
162
  const root = ab.createRoot('body', codeSpace, 'path/to/comp')
161
163
  glassEasel.Element.pretendAttached(root.getComponent())
162
- expect(domHtml(root.getComponent())).toBe('<div><child1>456</child1><child2>789</child2></div>')
164
+ expect(domHtml(root.getComponent())).toBe(
165
+ '<div><child1 is="child1/comp">456</child1><child2 is="child2/comp">789</child2></div>',
166
+ )
163
167
  })
164
168
 
165
169
  test('select single component (with custom export on behavior)', () => {
@@ -251,7 +255,9 @@ describe('selector query', () => {
251
255
  const ab = env.associateBackend()
252
256
  const root = ab.createRoot('body', codeSpace, 'path/to/comp')
253
257
  glassEasel.Element.pretendAttached(root.getComponent())
254
- expect(domHtml(root.getComponent())).toBe('<div><child1>456</child1><child2>789</child2></div>')
258
+ expect(domHtml(root.getComponent())).toBe(
259
+ '<div><child1 is="child1/comp">456</child1><child2 is="child2/comp">789</child2></div>',
260
+ )
255
261
  })
256
262
 
257
263
  test('select all components', () => {
@@ -316,7 +322,7 @@ describe('selector query', () => {
316
322
  const root = ab.createRoot('body', codeSpace, 'path/to/comp')
317
323
  glassEasel.Element.pretendAttached(root.getComponent())
318
324
  expect(domHtml(root.getComponent())).toBe(
319
- '<div><child class="c">0</child><child class="c">1</child><child-b class="c">2</child-b></div>',
325
+ '<div><child is="child/comp" class="c">0</child><child is="child/comp" class="c">1</child><child-b is="child/comp2" class="c">2</child-b></div>',
320
326
  )
321
327
  })
322
328
 
@@ -249,7 +249,9 @@ describe('define', () => {
249
249
 
250
250
  const ab = env.associateBackend()
251
251
  const root = ab.createRoot('body', codeSpace, 'path/to/comp')
252
- expect(domHtml(root.getComponent())).toBe('<a><c><span>B</span></c></a>')
252
+ expect(domHtml(root.getComponent())).toBe(
253
+ '<a is="comp/a"><c is="comp/b"><span>B</span></c></a>',
254
+ )
253
255
  })
254
256
 
255
257
  test('options placeholder', () => {
@@ -290,7 +292,7 @@ describe('define', () => {
290
292
 
291
293
  const ab = env.associateBackend()
292
294
  const root = ab.createRoot('body', codeSpace, 'path/to/comp')
293
- expect(domHtml(root.getComponent())).toBe('<a><div>A</div></a>')
295
+ expect(domHtml(root.getComponent())).toBe('<a is="comp/a"><div>A</div></a>')
294
296
 
295
297
  codeSpace.addComponentStaticConfig('comp/b', {
296
298
  component: true,
@@ -305,7 +307,7 @@ describe('define', () => {
305
307
  Component().register()
306
308
  })
307
309
 
308
- expect(domHtml(root.getComponent())).toBe('<a><span>B</span></a>')
310
+ expect(domHtml(root.getComponent())).toBe('<a is="comp/b"><span>B</span></a>')
309
311
  })
310
312
 
311
313
  test('options pureDataPattern (js)', () => {
@@ -853,15 +855,14 @@ describe('define', () => {
853
855
  // eslint-disable-next-line arrow-body-style
854
856
  const parentType = codeSpace.componentEnv('path/to/comp', ({ Component }) => {
855
857
  return Component()
856
- .methods({
857
- parentFn() {
858
- return 456
859
- },
860
- })
861
858
  .lifetime('attached', function () {
862
859
  expect(this.selectComponent('#c', childType)!.childFn()).toBe(123)
863
860
  callOrder.push(2)
864
861
  })
862
+ .init(({ method }) => {
863
+ const parentFn = method(() => 456)
864
+ return { parentFn }
865
+ })
865
866
  .register()
866
867
  })
867
868
 
@@ -1067,7 +1068,9 @@ describe('define', () => {
1067
1068
  const ab = env.associateBackend()
1068
1069
  const root = ab.createRoot('body', codeSpace, 'path/to/comp')
1069
1070
  glassEasel.Element.pretendAttached(root.getComponent())
1070
- expect(domHtml(root.getComponent())).toBe('<list><div>2</div><item></item><item></item></list>')
1071
+ expect(domHtml(root.getComponent())).toBe(
1072
+ '<list is="child/list"><div>2</div><item is="child/item"></item><item is="child/item"></item></list>',
1073
+ )
1071
1074
  })
1072
1075
 
1073
1076
  test('chaining extraThisFieldsType', () => {
@@ -138,7 +138,7 @@ describe('trait behavior', () => {
138
138
  const root = ab.createRoot('body', codeSpace, 'path/to/comp')
139
139
  glassEasel.Element.pretendAttached(root.getComponent())
140
140
  expect(domHtml(root.getComponent())).toBe(
141
- '<list><div>2</div><item>2</item><item>3</item></list>',
141
+ '<list is="child/list"><div>2</div><item is="child/item">2</item><item is="child/item">3</item></list>',
142
142
  )
143
143
  })
144
144
  })