@lightningjs/blits 1.30.1 → 1.31.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.
Files changed (70) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/package.json +4 -3
  3. package/src/router/router.js +2 -0
  4. package/vite/preCompiler.js +6 -1
  5. package/.editorconfig +0 -7
  6. package/.eslintignore +0 -1
  7. package/.eslintrc.cjs +0 -65
  8. package/.github/workflows/comment-lint-results.yml +0 -125
  9. package/.github/workflows/comment-test-results.yml +0 -109
  10. package/.github/workflows/deploy-docs.yml +0 -27
  11. package/.github/workflows/run-blits-tests.yml +0 -142
  12. package/.github/workflows/run-lint.yml +0 -128
  13. package/.husky/pre-commit +0 -1
  14. package/.husky/pre-push +0 -1
  15. package/.vscode/extensions.json +0 -7
  16. package/.vscode/settings.json +0 -9
  17. package/banner.png +0 -0
  18. package/docs/.nojekyll +0 -0
  19. package/docs/README.md +0 -19
  20. package/docs/_sidebar.md +0 -37
  21. package/docs/built-in/directives.md +0 -50
  22. package/docs/built-in/for-loop.md +0 -204
  23. package/docs/built-in/layout.md +0 -168
  24. package/docs/components/component_state.md +0 -90
  25. package/docs/components/computed_properties.md +0 -45
  26. package/docs/components/lifecycle_events.md +0 -42
  27. package/docs/components/methods.md +0 -45
  28. package/docs/components/props.md +0 -56
  29. package/docs/components/user_input.md +0 -186
  30. package/docs/components/utility_methods.md +0 -320
  31. package/docs/components/watchers.md +0 -34
  32. package/docs/essentials/application_root.md +0 -19
  33. package/docs/essentials/components.md +0 -68
  34. package/docs/essentials/displaying_images.md +0 -67
  35. package/docs/essentials/displaying_text.md +0 -135
  36. package/docs/essentials/element_attributes.md +0 -195
  37. package/docs/essentials/settings.md +0 -117
  38. package/docs/essentials/template_syntax.md +0 -83
  39. package/docs/getting_started/file_structure.md +0 -58
  40. package/docs/getting_started/getting_started.md +0 -45
  41. package/docs/getting_started/intro.md +0 -20
  42. package/docs/index.html +0 -47
  43. package/docs/performance/lazy-loading.md +0 -161
  44. package/docs/plugins/global_app_state.md +0 -98
  45. package/docs/plugins/language.md +0 -172
  46. package/docs/plugins/text-to-speech-announcer.md +0 -120
  47. package/docs/plugins/theme.md +0 -176
  48. package/docs/router/basics.md +0 -175
  49. package/docs/router/hooks.md +0 -70
  50. package/docs/router/transitions.md +0 -146
  51. package/docs/sidebar.json +0 -171
  52. package/docs/transitions_animations/transitions.md +0 -150
  53. package/jsconfig.json +0 -12
  54. package/src/component/setup/props.test.js +0 -238
  55. package/src/component.test.js +0 -388
  56. package/src/components/Circle.orig.js +0 -31
  57. package/src/components/FPScounter.orig.js +0 -121
  58. package/src/components/RouterView.orig.js +0 -54
  59. package/src/components/Sprite.orig.js +0 -58
  60. package/src/components/index.orig.js +0 -28
  61. package/src/engines/L3/element.test.js +0 -579
  62. package/src/helpers/deepEqualArray.test.js +0 -127
  63. package/src/lib/codegenerator/generator.test.js +0 -3801
  64. package/src/lib/colors/colors.test.js +0 -290
  65. package/src/lib/componentId.test.js +0 -84
  66. package/src/lib/eventListeners.test.js +0 -236
  67. package/src/lib/reactivity/effect.test.js +0 -35
  68. package/src/lib/reactivity/reactive.test.js +0 -27
  69. package/src/lib/templateparser/parser.test.js +0 -1411
  70. package/src/router/router.test.js +0 -473
@@ -1,238 +0,0 @@
1
- /*
2
- * Copyright 2023 Comcast Cable Communications Management, LLC
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- *
7
- * http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software
10
- * distributed under the License is distributed on an "AS IS" BASIS,
11
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- * See the License for the specific language governing permissions and
13
- * limitations under the License.
14
- *
15
- * SPDX-License-Identifier: Apache-2.0
16
- */
17
-
18
- import test from 'tape'
19
- import propsFn from './props.js'
20
- import { initLog } from '../../lib/log.js'
21
- import Settings from '../../settings.js'
22
- import symbols from '../../lib/symbols.js'
23
-
24
- test('Type props function', (assert) => {
25
- const expected = 'function'
26
- const actual = typeof propsFn
27
-
28
- assert.equal(actual, expected, 'props should be a function')
29
- assert.end()
30
- })
31
-
32
- test('Has correct symbols', (assert) => {
33
- const component = new Function()
34
- const props = ['index', 'img', 'url']
35
- propsFn(component, props)
36
- /* eslint-disable */
37
- assert.true(component[symbols.propKeys], 'Component should have a propKey symbol')
38
- assert.end()
39
- })
40
-
41
- test('Pass props as an array', (assert) => {
42
- const component = new Function()
43
- const props = ['index', 'img', 'url']
44
- propsFn(component, props)
45
-
46
- assert.equal(props.length, component[symbols.propKeys].length, 'All passed props should be stored on propKeys')
47
- assert.equal(props.length, props.map(prop => component[symbols.propKeys].indexOf(prop) > -1).filter(prop => prop === true).length, 'All passed props should be stored on propKeys')
48
-
49
- props.forEach((prop) => {
50
- assert.true(typeof Object.getOwnPropertyDescriptor(component, prop).get === 'function', `A getter should have been created for property ${prop}`)
51
- })
52
-
53
- assert.end()
54
- })
55
-
56
-
57
- test('Get value of props', (assert) => {
58
- const component = new Function()
59
-
60
- const componentInstance = Object.create(component)
61
- componentInstance[symbols.props] = {
62
- index: 1,
63
- img: 'lorem-ipsum.jpg',
64
- url: 'http://localhost'
65
- }
66
-
67
- const componentInstance2 = Object.create(component)
68
- componentInstance2[symbols.props] = {
69
- index: 2,
70
- img: 'bla.jpg',
71
- url: 'http://127.0.0.1'
72
- }
73
-
74
- const props = ['index', 'img', 'url']
75
- propsFn(component, props)
76
-
77
- props.forEach((prop) => {
78
- assert.equal(componentInstance[prop], componentInstance[symbols.props][prop], `The correct value of ${prop} should be returned via the getter`)
79
- assert.equal(componentInstance2[prop], componentInstance2[symbols.props][prop], `The correct value of ${prop} should be returned via the getter`)
80
- })
81
-
82
- assert.equal(componentInstance['bla'], undefined, `Undefined should be returned if a prop doesn't exist`)
83
- assert.end()
84
- })
85
-
86
- test('Passing props as an object', (assert) => {
87
-
88
- const component = new Function()
89
- const props = [{key: 'index'}, {key: 'img'}, {key: 'url'}]
90
- propsFn(component, props)
91
-
92
- assert.equal(props.length, component[symbols.propKeys].length, 'All passed props should be stored on propKeys')
93
- assert.equal(props.length, props.map(prop => component[symbols.propKeys].indexOf(typeof prop === 'object' ? prop.key : prop) > -1).filter(prop => prop === true).length, 'All passed props should be stored on propKeys')
94
-
95
- props.forEach((prop) => {
96
- assert.true(typeof Object.getOwnPropertyDescriptor(component, typeof prop === 'object' ? prop.key : prop).get === 'function', `A getter should have been created for property ${prop}`)
97
- })
98
-
99
- assert.end()
100
- })
101
-
102
- test('Passing props as an object mixed with single keys', (assert) => {
103
-
104
- const component = new Function()
105
- const props = [{key: 'index'}, 'img', {key: 'url'}]
106
- propsFn(component, props)
107
-
108
- assert.equal(props.length, component[symbols.propKeys].length, 'All passed props should be stored on propKeys')
109
- assert.equal(props.length, props.map(prop => component[symbols.propKeys].indexOf(typeof prop === 'object' ? prop.key : prop) > -1).filter(prop => prop === true).length, 'All passed props should be stored on propKeys')
110
-
111
- props.forEach((prop) => {
112
- assert.true(typeof Object.getOwnPropertyDescriptor(component, typeof prop === 'object' ? prop.key : prop).get === 'function', `A getter should have been created for property ${prop}`)
113
- })
114
-
115
- assert.end()
116
- })
117
-
118
- test('Casting props to a type', (assert) => {
119
- const component = new Function()
120
-
121
- const componentInstance = Object.create(component)
122
- componentInstance[symbols.props] = {
123
- number: '1',
124
- string: 100,
125
- boolean: true,
126
- image: 'my_image.jpg'
127
- }
128
-
129
- const props = [{
130
- key: 'number',
131
- cast: Number
132
- }, {
133
- key: 'string',
134
- cast: String
135
- }, {
136
- key: 'boolean',
137
- cast: Boolean
138
- },{
139
- key: 'image',
140
- cast(v) {
141
- return `http://localhost/${v}`
142
- }
143
- }]
144
- propsFn(component, props)
145
-
146
- assert.equal(typeof componentInstance.number, 'number', 'Should cast prop value to a Number')
147
- assert.equal(typeof componentInstance.string, 'string', 'Should cast prop value to a String')
148
- assert.equal(typeof componentInstance.boolean, 'boolean', 'Should cast prop value to a Boolean')
149
- assert.equal(componentInstance.image, 'http://localhost/my_image.jpg','Should cast according to a custom function')
150
-
151
- assert.end()
152
- })
153
-
154
- test('Setting default value for undefined props', (assert) => {
155
- const component = new Function()
156
-
157
- const componentInstance = Object.create(component)
158
-
159
- const props = [{
160
- key: 'missing',
161
- default: 'I am missing'
162
- }]
163
- propsFn(component, props)
164
-
165
- assert.equal(componentInstance.missing, 'I am missing','Should return default prop value when undefined')
166
-
167
- assert.end()
168
- })
169
-
170
- test('Required props with default', (assert) => {
171
- const component = new Function()
172
-
173
- const componentInstance = Object.create(component)
174
-
175
- const props = [{
176
- key: 'missing',
177
- default: 'I am missing',
178
- required: true
179
- }]
180
- propsFn(component, props)
181
-
182
- assert.equal(componentInstance.missing, 'I am missing', 'Should return default prop value when undefined')
183
-
184
- assert.end()
185
- })
186
-
187
- test('Required props without default', (assert) => {
188
- initLogTest(assert)
189
- const capture = assert.capture(console, 'warn')
190
- const component = new Function()
191
-
192
- const componentInstance = Object.create(component)
193
-
194
- const props = [{
195
- key: 'missing',
196
- required: true
197
- }]
198
- propsFn(component, props)
199
-
200
- assert.equal(componentInstance.missing, undefined, 'Should return undefined prop value when undefined')
201
- const logs = capture()
202
- assert.equal(logs.length, 1)
203
- assert.equal(logs[0].args.pop(), 'missing is required', 'Should log warning message')
204
-
205
- assert.end()
206
- })
207
-
208
- test('Setting prop value directly', (assert) => {
209
- initLogTest(assert)
210
- const capture = assert.capture(console, 'warn')
211
- const component = new Function()
212
- const componentInstance = Object.create(component)
213
- componentInstance[symbols.props] = {
214
- property: 'foo'
215
- }
216
- const props = [{
217
- key: 'property',
218
- }]
219
-
220
- propsFn(component, props)
221
- componentInstance.property = 'bar'
222
-
223
- assert.equal(componentInstance[symbols.props].property, 'bar', 'Should be possible to mutate the property')
224
- let logs = capture()
225
- assert.equal(logs.length, 1)
226
- assert.equal(logs[0].args.pop(), `Warning! Avoid mutating props directly (prop "${props[0].key}" in component "${componentInstance.componentId}")`, 'Should log warning message')
227
-
228
- assert.end()
229
- })
230
-
231
- function initLogTest(assert) {
232
- assert.capture(Settings, 'get', (key) => {
233
- if (key === 'debugLevel') {
234
- return 1
235
- }
236
- })
237
- initLog()
238
- }
@@ -1,388 +0,0 @@
1
- /*
2
- * Copyright 2023 Comcast Cable Communications Management, LLC
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- *
7
- * http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software
10
- * distributed under the License is distributed on an "AS IS" BASIS,
11
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- * See the License for the specific language governing permissions and
13
- * limitations under the License.
14
- *
15
- * SPDX-License-Identifier: Apache-2.0
16
- */
17
-
18
- import test from 'tape'
19
- import Component from './component.js'
20
- import { initLog } from './lib/log.js'
21
- import symbols from './lib/symbols.js'
22
- import util from 'node:util'
23
- import { renderer, stage } from './launch.js'
24
-
25
- initLog()
26
-
27
- test('Type', (assert) => {
28
- const expected = 'function'
29
- const actual = typeof Component
30
-
31
- assert.equal(actual, expected, 'Component should be a function')
32
- assert.end()
33
- })
34
-
35
- test('Component - Factory function', (assert) => {
36
- const expected = 'function'
37
- const actual = typeof Component('my component', {})
38
-
39
- assert.equal(actual, expected, 'Component should be a factory function (i.e. return a function)')
40
- assert.end()
41
- })
42
-
43
- test('Component - Factory requires a name to be passed', (assert) => {
44
- assert.throws(() => {
45
- Component()
46
- }, 'Throw an error when no name argument has been passed')
47
-
48
- assert.end()
49
- })
50
-
51
- test('Component - Factory requires a config to be passed', (assert) => {
52
- assert.throws(() => {
53
- Component('Foo')
54
- }, 'Throw an error when no config argument has been passed')
55
-
56
- assert.end()
57
- })
58
-
59
- test('Component - Instance should create internal id', (assert) => {
60
- const button = Component('Button', {})()
61
- const heading = Component('Heading', {})()
62
-
63
- assert.equal(button[symbols.id], 1, 'Button instance object should have correct internal id')
64
- assert.equal(heading[symbols.id], 2, 'Heading instance object should have correct internal id')
65
- assert.end()
66
- })
67
-
68
- test('Component - Instance should create component Id', (assert) => {
69
- const foo = Component('Foo', {})
70
- const bar = Component('Bar', {})
71
- const fooInstance0 = foo()
72
- const fooInstance1 = foo()
73
- const barInstance0 = bar()
74
-
75
- assert.equal(
76
- fooInstance0.componentId,
77
- 'BlitsComponent::Foo_1',
78
- 'First Foo instance should have correct id'
79
- )
80
- assert.equal(
81
- fooInstance1.componentId,
82
- 'BlitsComponent::Foo_2',
83
- 'Second Foo instance should have correct id'
84
- )
85
- assert.equal(
86
- barInstance0.componentId,
87
- 'BlitsComponent::Bar_1',
88
- 'First Bar instance should have correct id'
89
- )
90
- assert.end()
91
- })
92
-
93
- test('Component - Instance should initiate lifecycle object', (assert) => {
94
- const foo = Component('Foo', {})()
95
-
96
- assert.ok(foo.lifecycle, 'Lifecycle object should be initialized')
97
- assert.equal(
98
- foo.lifecycle.component,
99
- foo,
100
- 'Lifecycle object should have a reference to foo instance'
101
- )
102
- assert.equal(
103
- foo.lifecycle.previous,
104
- null,
105
- 'Lifecycle object should have previous state not initialized'
106
- )
107
- assert.equal(foo.lifecycle.current, 'init', 'Lifecycle object should have initial current state')
108
- assert.end()
109
- })
110
-
111
- test('Component - Instance should set a parent reference', (assert) => {
112
- const parentElement = {}
113
- const parentComponent = {}
114
-
115
- const foo = Component('Foo', {})({}, parentElement, parentComponent)
116
-
117
- assert.equal(
118
- foo.parent,
119
- parentComponent,
120
- 'Foo instance object should have parent component object reference'
121
- )
122
- assert.equal(
123
- foo[symbols.holder],
124
- parentElement,
125
- 'Foo instance object should have parent element object reference'
126
- )
127
- assert.end()
128
- })
129
-
130
- test('Component - Instance should set a root reference', (assert) => {
131
- const root = {}
132
-
133
- const foo = Component('Foo', {})({}, {}, {}, root)
134
-
135
- assert.equal(
136
- foo.rootParent,
137
- root,
138
- 'Foo instance object should have root component object reference'
139
- )
140
- assert.end()
141
- })
142
-
143
- test('Component - Instance should initialize reactive props', (assert) => {
144
- const foo = Component(
145
- 'Foo',
146
- {}
147
- )({
148
- props: { foo: 'bar' },
149
- })
150
-
151
- const props = foo[symbols.props]
152
-
153
- assert.ok(props, 'Foo instance should have props defined')
154
- assert.ok(util.types.isProxy(props), 'Foo instance props should be proxy')
155
- assert.equal(props.foo, 'bar')
156
- assert.end()
157
- })
158
-
159
- test('Component - Instance should initialize timeouts array', (assert) => {
160
- const foo = Component('Foo', {})()
161
-
162
- const timeouts = foo[symbols.timeouts]
163
-
164
- assert.ok(Array.isArray(timeouts), 'Foo instance timeouts should be an array')
165
- assert.end()
166
- })
167
-
168
- test('Component - Instance should initialize intervals array', (assert) => {
169
- const foo = Component('Foo', {})()
170
-
171
- const intervals = foo[symbols.intervals]
172
-
173
- assert.ok(Array.isArray(intervals), 'Foo instance intervals should be an array')
174
- assert.end()
175
- })
176
-
177
- test('Component - Instance should initialize originalState', (assert) => {
178
- const config = {
179
- state() {
180
- return {
181
- foo: 'bar',
182
- }
183
- },
184
- }
185
- const foo = Component('Foo', config)()
186
-
187
- const state = foo[symbols.originalState]
188
-
189
- assert.equal(state.foo, 'bar', 'Foo instance should store originalState properties')
190
- assert.equal(state.hasFocus, false, 'Foo instance should store originalState hasFocus property')
191
- assert.end()
192
- })
193
-
194
- test('Component - Instance should initialize reactive state', (assert) => {
195
- const config = {
196
- state() {
197
- return {
198
- foo: 'bar',
199
- }
200
- },
201
- }
202
- const foo = Component('Foo', config)()
203
-
204
- const state = foo[symbols.state]
205
-
206
- assert.ok(state, 'Foo instance should have state defined')
207
- assert.ok(util.types.isProxy(state), 'Foo instance state should be proxy')
208
- assert.equal(state.foo, 'bar')
209
- assert.end()
210
- })
211
-
212
- test('Component - Instance should initialize children', (assert) => {
213
- const parent = {}
214
- const expected = []
215
- const config = {
216
- code: {
217
- render: () => {},
218
- effects: [],
219
- },
220
- state() {
221
- return {
222
- foo: 'bar',
223
- }
224
- },
225
- }
226
- const capture = assert.capture(config.code, 'render', () => expected)
227
- const foo = Component('Foo', config)({}, parent)
228
-
229
- const children = foo[symbols.children]
230
-
231
- assert.ok(Array.isArray(children), 'Foo instance children should be an array')
232
- assert.equal(children, expected, 'Children should be an expected array')
233
- const args = capture()[0].args
234
- assert.equal(args[0], parent, 'Render should be called with parent parameter')
235
- assert.equal(args[1], foo, 'Render should be called with Foo component instance')
236
- assert.equal(args[2], config, 'Render should be called with config parameter')
237
- assert.ok(args[3].Sprite, 'Render should be called with global components object')
238
- assert.end()
239
- })
240
-
241
- test('Component - Instance should initialize wrapper', (assert) => {
242
- const expected = {}
243
- const config = {
244
- code: {
245
- render: () => [expected],
246
- effects: [],
247
- },
248
- }
249
- const foo = Component('Foo', config)()
250
-
251
- const wrapper = foo[symbols.wrapper]
252
-
253
- assert.equal(wrapper, expected, 'Wrapper should be a first element of the children')
254
- assert.end()
255
- })
256
-
257
- test('Component - Instance should initialize slots', (assert) => {
258
- const expected = {
259
- [symbols.isSlot]: true,
260
- }
261
- const config = {
262
- code: {
263
- render: () => [{}, {}, expected, {}],
264
- effects: [],
265
- },
266
- }
267
- const foo = Component('Foo', config)()
268
-
269
- const slots = foo[symbols.slots]
270
-
271
- assert.ok(Array.isArray(slots), 'Slots should be an array')
272
- assert.equal(slots[0], expected, 'Slot should be a expected element of the children')
273
- assert.end()
274
- })
275
-
276
- test('Component - Instance should initialize hook events', (assert) => {
277
- const wrapper = {
278
- node: {
279
- on() {},
280
- },
281
- }
282
- const rendererCapture = assert.capture(renderer, 'on')
283
- const nodeCapture = assert.capture(wrapper.node, 'on')
284
- const config = {
285
- code: {
286
- render: () => [wrapper],
287
- effects: [],
288
- },
289
- hooks: {
290
- frameTick() {},
291
- idle() {},
292
- attach() {},
293
- detach() {},
294
- enter() {},
295
- exit() {},
296
- },
297
- }
298
- Component('Foo', config)()
299
-
300
- const rendererCalls = rendererCapture()
301
- assert.equal(
302
- rendererCalls[0].args[0],
303
- 'frameTick',
304
- '`frameTick` event should be registered in Renderer'
305
- )
306
- assert.equal(rendererCalls[1].args[0], 'idle', '`idle` event should be registered in Renderer')
307
- const nodeCalls = nodeCapture()
308
- assert.equal(
309
- nodeCalls[0].args[0],
310
- 'inBounds',
311
- '`inBounds` event should be registered in the wrapper'
312
- )
313
- assert.equal(
314
- nodeCalls[1].args[0],
315
- 'outOfBounds',
316
- '`outOfBounds` event should be registered in the wrapper'
317
- )
318
- assert.equal(
319
- nodeCalls[2].args[0],
320
- 'inViewport',
321
- '`inViewport` event should be registered in the wrapper'
322
- )
323
- assert.equal(
324
- nodeCalls[3].args[0],
325
- 'outOfBounds',
326
- '`outOfBounds` event should be registered in the wrapper'
327
- )
328
- assert.end()
329
- })
330
-
331
- test('Component - Instance should execute all side effects', (assert) => {
332
- const root = {}
333
- const capture = assert.captureFn(() => {})
334
- const children = []
335
- const config = {
336
- code: {
337
- render: () => children,
338
- effects: [capture],
339
- },
340
- }
341
- const foo = Component('Foo', config)({}, {}, {}, root)
342
-
343
- const calls = capture.calls[0]
344
- // todo: look into this
345
- // assert.equals(calls.receiver, stage, 'Effect`s receiver should be the stage object')
346
- assert.equals(calls.args[0], foo, 'Effect should be invoked with foo component instance')
347
- assert.equals(calls.args[1], children, 'Effect should be invoked with component`s children')
348
- assert.equals(calls.args[2], config, 'Effect should be invoked with config object')
349
- assert.ok(calls.args[3].Sprite, 'Effect should be invoked with global components object')
350
- assert.equals(calls.args[4], root, 'Effect should be invoked with root component')
351
- assert.ok(typeof calls.args[5] === 'function', 'Effect should be invoked with effect function')
352
- assert.end()
353
- })
354
-
355
- test('Component - Instance should have all symbols configured', (assert) => {
356
- const config = {
357
- state() {
358
- return {
359
- foo: 'bar',
360
- }
361
- },
362
- watch: {
363
- foo(value, oldValue) {},
364
- },
365
- }
366
- const foo = Component('Foo', config)()
367
-
368
- Object.getOwnPropertySymbols(foo).forEach((symbol) => {
369
- const descriptor = Object.getOwnPropertyDescriptor(foo, symbol)
370
- assert.ok(descriptor.enumerable === true, `${symbol.description} should be be enumerable`)
371
- assert.ok(descriptor.configurable === true, `${symbol.description} should be configurable`)
372
- })
373
- assert.end()
374
- })
375
-
376
- test('Component - Instance should have ready state after the next process tick', (assert) => {
377
- assert.plan(1)
378
-
379
- const foo = Component('Foo', {})()
380
-
381
- setTimeout(() => {
382
- assert.equal(
383
- foo.lifecycle.state,
384
- 'ready',
385
- 'Foo component lifecycle should be eventually in a ready state'
386
- )
387
- })
388
- })
@@ -1,31 +0,0 @@
1
- /*
2
- * Copyright 2023 Comcast Cable Communications Management, LLC
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- *
7
- * http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software
10
- * distributed under the License is distributed on an "AS IS" BASIS,
11
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- * See the License for the specific language governing permissions and
13
- * limitations under the License.
14
- *
15
- * SPDX-License-Identifier: Apache-2.0
16
- */
17
-
18
- import Component from '../component.js'
19
-
20
- export default () =>
21
- Component('Circle', {
22
- template: `
23
- <Element :color="$color" :w="$size" :h="$size" :effects="[$shader('radius', {radius: $radius})]"></Element>
24
- `,
25
- props: [{ key: 'size', default: 40 }, 'color'],
26
- computed: {
27
- radius() {
28
- return this.size / 2
29
- },
30
- },
31
- })