@domql/element 3.1.1 → 3.2.3

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 (90) hide show
  1. package/README.md +4 -6
  2. package/__tests__/checkIfOnUpdate.test.js +12 -12
  3. package/__tests__/children.test.js +34 -38
  4. package/__tests__/inheritStateUpdates.test.js +12 -12
  5. package/__tests__/renderElement.test.js +11 -11
  6. package/__tests__/resetElement.test.js +6 -6
  7. package/__tests__/set.test.js +32 -36
  8. package/__tests__/throughExecProps.test.js +12 -12
  9. package/__tests__/throughInitialDefine.test.js +16 -16
  10. package/__tests__/throughInitialExec.test.js +16 -16
  11. package/__tests__/throughUpdatedDefine.test.js +14 -14
  12. package/__tests__/throughUpdatedExec.test.js +17 -16
  13. package/__tests__/update.test.js +54 -54
  14. package/children.js +5 -6
  15. package/create.js +18 -20
  16. package/dist/cjs/children.js +4 -2
  17. package/dist/cjs/create.js +16 -16
  18. package/dist/cjs/extend.js +88 -0
  19. package/dist/cjs/iterate.js +76 -20
  20. package/dist/cjs/mixins/content.js +73 -0
  21. package/dist/cjs/mixins/html.js +1 -1
  22. package/dist/cjs/mixins/registry.js +2 -2
  23. package/dist/cjs/mixins/scope.js +1 -1
  24. package/dist/cjs/mixins/state.js +2 -2
  25. package/dist/cjs/mixins/text.js +4 -4
  26. package/dist/cjs/node.js +15 -15
  27. package/dist/cjs/set.js +22 -27
  28. package/dist/cjs/update.js +24 -33
  29. package/dist/cjs/utils/applyParam.js +4 -4
  30. package/dist/cjs/utils/extendUtils.js +132 -0
  31. package/dist/cjs/utils/propEvents.js +39 -0
  32. package/dist/esm/children.js +5 -3
  33. package/dist/esm/create.js +16 -16
  34. package/dist/esm/extend.js +74 -0
  35. package/dist/esm/iterate.js +77 -22
  36. package/dist/esm/mixins/content.js +53 -0
  37. package/dist/esm/mixins/html.js +1 -1
  38. package/dist/esm/mixins/registry.js +1 -1
  39. package/dist/esm/mixins/scope.js +1 -1
  40. package/dist/esm/mixins/state.js +3 -3
  41. package/dist/esm/mixins/text.js +4 -4
  42. package/dist/esm/node.js +15 -15
  43. package/dist/esm/set.js +23 -28
  44. package/dist/esm/update.js +24 -33
  45. package/dist/esm/utils/applyParam.js +5 -5
  46. package/dist/esm/utils/extendUtils.js +119 -0
  47. package/dist/esm/utils/propEvents.js +19 -0
  48. package/extend.js +98 -0
  49. package/iterate.js +80 -25
  50. package/mixins/content.js +65 -0
  51. package/mixins/html.js +1 -1
  52. package/mixins/registry.js +1 -1
  53. package/mixins/scope.js +1 -1
  54. package/mixins/state.js +3 -3
  55. package/mixins/text.js +4 -4
  56. package/node.js +15 -15
  57. package/package.json +8 -8
  58. package/set.js +23 -28
  59. package/update.js +25 -34
  60. package/utils/applyParam.js +5 -5
  61. package/utils/extendUtils.js +149 -0
  62. package/utils/propEvents.js +19 -0
  63. package/dist/cjs/__tests__/checkIfOnUpdate.test.js +0 -73
  64. package/dist/cjs/__tests__/children.test.js +0 -177
  65. package/dist/cjs/__tests__/define.test.js +0 -75
  66. package/dist/cjs/__tests__/inheritStateUpdates.test.js +0 -62
  67. package/dist/cjs/__tests__/renderElement.test.js +0 -138
  68. package/dist/cjs/__tests__/resetElement.test.js +0 -35
  69. package/dist/cjs/__tests__/set.test.js +0 -256
  70. package/dist/cjs/__tests__/throughExecProps.test.js +0 -62
  71. package/dist/cjs/__tests__/throughInitialDefine.test.js +0 -79
  72. package/dist/cjs/__tests__/throughInitialExec.test.js +0 -73
  73. package/dist/cjs/__tests__/throughUpdatedDefine.test.js +0 -69
  74. package/dist/cjs/__tests__/throughUpdatedExec.test.js +0 -84
  75. package/dist/cjs/__tests__/tree.test.js +0 -11
  76. package/dist/cjs/__tests__/update.test.js +0 -222
  77. package/dist/esm/__tests__/checkIfOnUpdate.test.js +0 -73
  78. package/dist/esm/__tests__/children.test.js +0 -177
  79. package/dist/esm/__tests__/define.test.js +0 -53
  80. package/dist/esm/__tests__/inheritStateUpdates.test.js +0 -62
  81. package/dist/esm/__tests__/renderElement.test.js +0 -116
  82. package/dist/esm/__tests__/resetElement.test.js +0 -35
  83. package/dist/esm/__tests__/set.test.js +0 -256
  84. package/dist/esm/__tests__/throughExecProps.test.js +0 -62
  85. package/dist/esm/__tests__/throughInitialDefine.test.js +0 -79
  86. package/dist/esm/__tests__/throughInitialExec.test.js +0 -73
  87. package/dist/esm/__tests__/throughUpdatedDefine.test.js +0 -69
  88. package/dist/esm/__tests__/throughUpdatedExec.test.js +0 -84
  89. package/dist/esm/__tests__/tree.test.js +0 -11
  90. package/dist/esm/__tests__/update.test.js +0 -222
@@ -22,91 +22,87 @@ describe('set', () => {
22
22
  })
23
23
 
24
24
  // 1. Basic Content Updates
25
- it('updates element.props when params.props are provided', async () => {
26
- await set.call(element, { props: { title: 'New Title' } })
25
+ it('updates element.props when params.props are provided', () => {
26
+ set.call(element, { props: { title: 'New Title' } })
27
27
  expect(element.content.props.title).toBe('New Title')
28
28
  })
29
29
 
30
30
  // 2. Deep Equality Checks
31
- it('skips update when deepContains matches existing content', async () => {
31
+ it('skips update when deepContains matches existing content', () => {
32
32
  ref.__noChildrenDifference = true
33
33
  const originalProps = { ...element.props }
34
- await set.call(element, { props: { id: 'same' } })
34
+ set.call(element, { props: { id: 'same' } })
35
35
  expect(element.props).toEqual(originalProps)
36
36
  })
37
37
 
38
38
  // 3. ChildExtends Inheritance
39
- it('merges element.childExtends into params when missing', async () => {
39
+ it('merges element.childExtends into params when missing', () => {
40
40
  element.childExtends = { button: 'PrimaryButton' }
41
41
  const params = { tag: 'fragment', props: {} }
42
- await set.call(element, params)
42
+ set.call(element, params)
43
43
  expect(params.childExtends).toEqual({ button: 'PrimaryButton' })
44
44
  expect(params.props.ignoreChildExtends).toBe(true)
45
45
  })
46
46
 
47
47
  // 6. Prevent Content Update
48
- it('preserves content when preventContentUpdate=true and no children', async () => {
48
+ it('preserves content when preventContentUpdate=true and no children', () => {
49
49
  const originalContent = element[ref.contentElementKey]
50
- await set.call(
51
- element,
52
- { props: { new: true } },
53
- { preventContentUpdate: true }
54
- )
50
+ set.call(element, { props: { new: true } }, { preventContentUpdate: true })
55
51
  expect(element[ref.contentElementKey]).toBeDefined()
56
52
  expect(originalContent).toBeUndefined()
57
53
  })
58
54
 
59
55
  // 7. ChildProps Inheritance
60
- it('copies element.props.childProps into params when missing', async () => {
56
+ it('copies element.props.childProps into params when missing', () => {
61
57
  element.props.childProps = { size: 'large' }
62
58
  const params = { tag: 'fragment', props: {} }
63
- await set.call(element, params)
59
+ set.call(element, params)
64
60
  expect(params.props.childProps).toEqual({ size: 'large' })
65
61
  expect(params.props.ignoreChildProps).toBe(true)
66
62
  })
67
63
 
68
64
  // 8. Event Blocking
69
- it('preserves state when beforeUpdate returns false', async () => {
65
+ it('preserves state when beforeUpdate returns false', () => {
70
66
  ref.__noChildrenDifference = true
71
67
  const originalState = { ...element.state }
72
68
 
73
69
  // Simulate beforeUpdate rejection by not changing state
74
- await set.call(element, { state: { shouldChange: true } })
70
+ set.call(element, { state: { shouldChange: true } })
75
71
  expect(element.state).toEqual(originalState)
76
72
  })
77
73
 
78
74
  // 9. DOM Node Handling
79
- it('updates node reference when provided in params', async () => {
75
+ it('updates node reference when provided in params', () => {
80
76
  const newNode = document.createElement('section')
81
- await set.call(element, { node: newNode })
77
+ set.call(element, { node: newNode })
82
78
  expect(element.node.tagName).toBe('DIV')
83
79
  })
84
80
 
85
81
  // 11. Context Component Resolution
86
- it('resolves context components in params', async () => {
82
+ it('resolves context components in params', () => {
87
83
  element.context.components = { Header: {} }
88
- await set.call(element, { Header: {} })
84
+ set.call(element, { Header: {} })
89
85
  expect(element.Header).toBeUndefined()
90
86
  })
91
87
 
92
88
  // 12. Nested Property Updates
93
- it('updates nested props without mutating original', async () => {
89
+ it('updates nested props without mutating original', () => {
94
90
  const originalProps = { nested: { value: 1 } }
95
91
  element.props = originalProps
96
- await set.call(element, { props: { nested: { value: 2 } } })
92
+ set.call(element, { props: { nested: { value: 2 } } })
97
93
  expect(element.props.nested.value).toBe(1)
98
94
  expect(originalProps.nested.value).toBe(1) // No mutation
99
95
  })
100
96
 
101
97
  // 13. Empty Param Handling
102
- it('preserves existing props when params=null', async () => {
98
+ it('preserves existing props when params=null', () => {
103
99
  element.props = { preserveMe: true }
104
- await set.call(element, null)
100
+ set.call(element, null)
105
101
  expect(element.props.preserveMe).toBe(true)
106
102
  })
107
103
 
108
104
  // 14. Content Removal
109
- it('removes content correctly when calling removeContent', async () => {
105
+ it('removes content correctly when calling removeContent', () => {
110
106
  const content = document.createElement('div')
111
107
  element.content = {
112
108
  node: content,
@@ -114,18 +110,18 @@ describe('set', () => {
114
110
  remove: jest.fn()
115
111
  }
116
112
  element.node.appendChild(content)
117
- await set.call(element, { props: { new: true } })
113
+ set.call(element, { props: { new: true } })
118
114
  expect(element.content.__ref).toBeDefined()
119
115
  expect(element.node.contains(content)).toBeFalsy()
120
116
  })
121
117
 
122
118
  // 15. Lazy Loading
123
- it('handles lazy loading with requestAnimationFrame', async () => {
119
+ it('handles lazy loading with requestAnimationFrame', () => {
124
120
  jest.useFakeTimers()
125
121
  element.props = { lazyLoad: true }
126
122
  const params = { props: { test: true } }
127
123
 
128
- await set.call(element, params)
124
+ set.call(element, params)
129
125
  jest.runAllTimers()
130
126
 
131
127
  setTimeout(() => {
@@ -135,7 +131,7 @@ describe('set', () => {
135
131
  })
136
132
 
137
133
  // 17. Fragment Content
138
- it('handles fragment content removal correctly', async () => {
134
+ it('handles fragment content removal correctly', () => {
139
135
  const remove1 = jest.fn(() => Promise.resolve())
140
136
  const remove2 = jest.fn(() => Promise.resolve())
141
137
  const node1 = document.createElement('div')
@@ -155,13 +151,13 @@ describe('set', () => {
155
151
  element.node.appendChild(node1)
156
152
  element.node.appendChild(node2)
157
153
 
158
- await set.call(element, { props: { new: true } })
154
+ set.call(element, { props: { new: true } })
159
155
 
160
156
  expect(remove1).toHaveBeenCalled()
161
157
  expect(remove2).toHaveBeenCalled()
162
158
  })
163
159
 
164
- it('handles fragment content removal with children', async () => {
160
+ it('handles fragment content removal with children', () => {
165
161
  const remove1 = jest.fn()
166
162
  const remove2 = jest.fn()
167
163
  const node1 = document.createElement('div')
@@ -180,25 +176,25 @@ describe('set', () => {
180
176
  element.node.appendChild(node1)
181
177
  element.node.appendChild(node2)
182
178
 
183
- await set.call(element, { props: { new: true } })
179
+ set.call(element, { props: { new: true } })
184
180
 
185
181
  expect(remove1).toHaveBeenCalled()
186
182
  expect(remove2).toHaveBeenCalled()
187
183
  })
188
184
 
189
- it('merges element.childExtends into params when tag is fragment', async () => {
185
+ it('merges element.childExtends into params when tag is fragment', () => {
190
186
  element.tag = 'fragment'
191
187
  element.childExtends = { button: 'PrimaryButton' }
192
188
  const params = { tag: 'fragment', props: {} }
193
- await set.call(element, params)
189
+ set.call(element, params)
194
190
  expect(params.childExtends).toEqual(element.childExtends)
195
191
  })
196
192
 
197
- it('copies element.props.childProps into params for fragments', async () => {
193
+ it('copies element.props.childProps into params for fragments', () => {
198
194
  element.tag = 'fragment'
199
195
  element.props.childProps = { size: 'large' }
200
196
  const params = { tag: 'fragment', props: {} }
201
- await set.call(element, params)
197
+ set.call(element, params)
202
198
  expect(params.props.childProps).toEqual(element.props.childProps)
203
199
  })
204
200
  })
@@ -15,11 +15,11 @@ describe('throughExecProps', () => {
15
15
  }
16
16
  })
17
17
 
18
- it('should cache and execute define-prefixed function props', async () => {
18
+ it('should cache and execute define-prefixed function props', () => {
19
19
  element.props.isActive = () => true
20
20
  element.props.hasFeature = (el, state) => state.test === 'state'
21
21
 
22
- await throughExecProps(element)
22
+ throughExecProps(element)
23
23
 
24
24
  expect(element.props.isActive).toBe(true)
25
25
  expect(element.props.hasFeature).toBe(true)
@@ -29,48 +29,48 @@ describe('throughExecProps', () => {
29
29
  })
30
30
  })
31
31
 
32
- it('should execute cached functions from previous runs', async () => {
32
+ it('should execute cached functions from previous runs', () => {
33
33
  ref.__execProps.value = () => 'cached'
34
34
  element.props.value = 'current'
35
35
 
36
- await throughExecProps(element)
36
+ throughExecProps(element)
37
37
 
38
38
  expect(element.props.value).toBe('cached')
39
39
  })
40
40
 
41
- it('should leave non-function props unchanged', async () => {
41
+ it('should leave non-function props unchanged', () => {
42
42
  element.props.title = 'static text'
43
43
  element.props.disabled = false
44
44
 
45
- await throughExecProps(element)
45
+ throughExecProps(element)
46
46
 
47
47
  expect(element.props.title).toBe('static text')
48
48
  expect(element.props.disabled).toBe(false)
49
49
  expect(ref.__execProps).toEqual({})
50
50
  })
51
51
 
52
- it('should handle mixed define-prefixed and regular props', async () => {
52
+ it('should handle mixed define-prefixed and regular props', () => {
53
53
  element.props.useHelper = () => 'helper'
54
54
  element.props.color = 'blue'
55
55
 
56
- await throughExecProps(element)
56
+ throughExecProps(element)
57
57
 
58
58
  expect(element.props.useHelper).toBe('helper')
59
59
  expect(element.props.color).toBe('blue')
60
60
  expect(ref.__execProps).toHaveProperty('useHelper')
61
61
  })
62
62
 
63
- it('should preserve existing cache entries', async () => {
63
+ it('should preserve existing cache entries', () => {
64
64
  ref.__execProps.existing = () => 'prior'
65
65
  element.props.existing = 'new'
66
66
 
67
- await throughExecProps(element)
67
+ throughExecProps(element)
68
68
 
69
69
  expect(element.props.existing).toBe('prior')
70
70
  expect(ref.__execProps.existing).toBeInstanceOf(Function)
71
71
  })
72
72
 
73
- it('should pass correct execution context', async () => {
73
+ it('should pass correct execution context', () => {
74
74
  element.props.checkContext = function (el, state, context) {
75
75
  return (
76
76
  this === element &&
@@ -79,7 +79,7 @@ describe('throughExecProps', () => {
79
79
  )
80
80
  }
81
81
 
82
- await throughExecProps(element)
82
+ throughExecProps(element)
83
83
 
84
84
  expect(typeof element.props.checkContext).toBe('function')
85
85
  })
@@ -16,47 +16,47 @@ describe('throughInitialDefine', () => {
16
16
  }
17
17
  })
18
18
 
19
- it('should merge local and global define objects', async () => {
19
+ it('should merge local and global define objects', () => {
20
20
  element.define = { localProp: () => 'local' }
21
21
  element.context.define = { globalProp: () => 'global' }
22
22
 
23
- await throughInitialDefine(element)
23
+ throughInitialDefine(element)
24
24
 
25
25
  expect(element.localProp).toBe('local')
26
26
  expect(element.globalProp).toBe('global')
27
27
  })
28
28
 
29
- it('should cache and execute define functions', async () => {
29
+ it('should cache and execute define functions', () => {
30
30
  element.define.testProp = value => 'defined value'
31
31
  element.testProp = () => 'initial value'
32
32
 
33
- await throughInitialDefine(element)
33
+ throughInitialDefine(element)
34
34
 
35
35
  expect(element.testProp).toBe('defined value')
36
36
  expect(ref.__exec.testProp).toBeInstanceOf(Function)
37
37
  expect(ref.__defineCache.testProp).toBe('initial value')
38
38
  })
39
39
 
40
- it('should skip execution for method properties', async () => {
40
+ it('should skip execution for method properties', () => {
41
41
  element.define.update = value => 'should not execute'
42
42
  element.update = () => 'built-in method'
43
43
 
44
- await throughInitialDefine(element)
44
+ throughInitialDefine(element)
45
45
 
46
46
  expect(ref.__exec).not.toHaveProperty('update')
47
47
  expect(ref.__defineCache).not.toHaveProperty('update')
48
48
  })
49
49
 
50
- it('should handle parse method in execution result', async () => {
50
+ it('should handle parse method in execution result', () => {
51
51
  element.define.testProp = () => ({ parse: () => 'parsed value' })
52
52
  element.testProp = () => 'initial value'
53
53
 
54
- await throughInitialDefine(element)
54
+ throughInitialDefine(element)
55
55
 
56
56
  expect(ref.__defineCache.testProp).toBe('initial value')
57
57
  })
58
58
 
59
- it('should pass correct arguments to define functions', async () => {
59
+ it('should pass correct arguments to define functions', () => {
60
60
  element.define.testProp = (value, el, state, context) => ({
61
61
  valueMatch: value === 'initial value',
62
62
  elMatch: el === element,
@@ -65,7 +65,7 @@ describe('throughInitialDefine', () => {
65
65
  })
66
66
  element.testProp = 'initial value'
67
67
 
68
- await throughInitialDefine(element)
68
+ throughInitialDefine(element)
69
69
 
70
70
  expect(element.testProp).toEqual({
71
71
  valueMatch: true,
@@ -75,17 +75,17 @@ describe('throughInitialDefine', () => {
75
75
  })
76
76
  })
77
77
 
78
- it('should handle non-function element properties', async () => {
78
+ it('should handle non-function element properties', () => {
79
79
  element.define.testProp = value => 'defined value'
80
80
  element.testProp = 'non-function value'
81
81
 
82
- await throughInitialDefine(element)
82
+ throughInitialDefine(element)
83
83
 
84
84
  expect(element.testProp).toBe('defined value')
85
85
  })
86
86
 
87
- it('should handle empty define objects', async () => {
88
- await throughInitialDefine(element)
87
+ it('should handle empty define objects', () => {
88
+ throughInitialDefine(element)
89
89
 
90
90
  expect(element).toEqual({
91
91
  ...element,
@@ -93,11 +93,11 @@ describe('throughInitialDefine', () => {
93
93
  })
94
94
  })
95
95
 
96
- it('should handle null or undefined define properties', async () => {
96
+ it('should handle null or undefined define properties', () => {
97
97
  element.define.testProp = () => null
98
98
  element.testProp = 'initial value'
99
99
 
100
- await throughInitialDefine(element)
100
+ throughInitialDefine(element)
101
101
 
102
102
  expect(element.testProp).toBe('initial value')
103
103
  })
@@ -14,63 +14,63 @@ describe('throughInitialExec', () => {
14
14
  }
15
15
  })
16
16
 
17
- it('should process non-method functions and update element properties', async () => {
18
- await throughInitialExec(element)
17
+ it('should process non-method functions and update element properties', () => {
18
+ throughInitialExec(element)
19
19
 
20
20
  expect(element.customFn).toBe('executed')
21
21
  expect(ref.__exec.customFn).toBeInstanceOf(Function)
22
22
  })
23
23
 
24
- it('should skip excluded parameters', async () => {
24
+ it('should skip excluded parameters', () => {
25
25
  element.excludedFn = () => 'should not execute'
26
- await throughInitialExec(element, { excludedFn: true })
26
+ throughInitialExec(element, { excludedFn: true })
27
27
 
28
28
  expect(element.excludedFn).toBeInstanceOf(Function)
29
29
  expect(ref.__exec).not.toHaveProperty('excludedFn')
30
30
  })
31
31
 
32
- it('should skip methods from METHODS array', async () => {
32
+ it('should skip methods from METHODS array', () => {
33
33
  element.update = () => 'built-in method'
34
- await throughInitialExec(element)
34
+ throughInitialExec(element)
35
35
 
36
36
  expect(element.update).toBeInstanceOf(Function)
37
37
  expect(ref.__exec).not.toHaveProperty('update')
38
38
  })
39
39
 
40
- it('should skip methods from context.methods', async () => {
40
+ it('should skip methods from context.methods', () => {
41
41
  element.context.methods = { contextMethod: true }
42
42
  element.contextMethod = () => 'context method'
43
- await throughInitialExec(element)
43
+ throughInitialExec(element)
44
44
 
45
45
  expect(element.contextMethod).toBeInstanceOf(Function)
46
46
  expect(ref.__exec).not.toHaveProperty('contextMethod')
47
47
  })
48
48
 
49
- it('should leave non-function properties unchanged', async () => {
49
+ it('should leave non-function properties unchanged', () => {
50
50
  element.stringProp = 'text'
51
- await throughInitialExec(element)
51
+ throughInitialExec(element)
52
52
 
53
53
  expect(element.stringProp).toBe('text')
54
54
  expect(ref.__exec).not.toHaveProperty('stringProp')
55
55
  })
56
56
 
57
- it('should store original functions in __exec', async () => {
57
+ it('should store original functions in __exec', () => {
58
58
  const originalFn = () => 'original'
59
59
  element.testFn = originalFn
60
- await throughInitialExec(element)
60
+ throughInitialExec(element)
61
61
 
62
62
  expect(ref.__exec.testFn).toBe(originalFn)
63
63
  expect(element.testFn).toBe('original')
64
64
  })
65
65
 
66
- it('should execute functions with correct arguments', async () => {
66
+ it('should execute functions with correct arguments', () => {
67
67
  element.argChecker = (el, state, context) => ({
68
68
  elIsElement: el === element,
69
69
  stateMatch: state === element.state,
70
70
  contextMatch: context === element.context
71
71
  })
72
72
 
73
- await throughInitialExec(element)
73
+ throughInitialExec(element)
74
74
 
75
75
  expect(element.argChecker).toEqual({
76
76
  elIsElement: true,
@@ -79,10 +79,10 @@ describe('throughInitialExec', () => {
79
79
  })
80
80
  })
81
81
 
82
- it('should handle empty exclude object', async () => {
82
+ it('should handle empty exclude object', () => {
83
83
  element.fn1 = () => 'one'
84
84
  element.fn2 = () => 'two'
85
- await throughInitialExec(element, {})
85
+ throughInitialExec(element, {})
86
86
 
87
87
  expect(element.fn1).toBe('one')
88
88
  expect(element.fn2).toBe('two')
@@ -16,54 +16,54 @@ describe('throughUpdatedDefine', () => {
16
16
  }
17
17
  })
18
18
 
19
- it('should merge local and global define objects', async () => {
19
+ it('should merge local and global define objects', () => {
20
20
  element.define = { localProp: () => 'local' }
21
21
  element.context.define = { globalProp: () => 'global' }
22
22
 
23
- await throughUpdatedDefine(element)
23
+ throughUpdatedDefine(element)
24
24
 
25
25
  expect(element.localProp).toBe('local')
26
26
  expect(element.globalProp).toBe('global')
27
27
  })
28
28
 
29
- it('should update element properties using cached exec functions', async () => {
29
+ it('should update element properties using cached exec functions', () => {
30
30
  ref.__exec.testProp = () => 'cached value'
31
31
  element.define.testProp = cached => `updated ${cached}`
32
32
 
33
- await throughUpdatedDefine(element)
33
+ throughUpdatedDefine(element)
34
34
 
35
35
  expect(element.testProp).toBe('updated cached value')
36
36
  expect(ref.__defineCache.testProp).toBe('cached value')
37
37
  })
38
38
 
39
- it('should handle non-function cached values', async () => {
39
+ it('should handle non-function cached values', () => {
40
40
  ref.__defineCache.testProp = 'static value'
41
41
  element.define.testProp = cached => `updated ${cached}`
42
42
 
43
- await throughUpdatedDefine(element)
43
+ throughUpdatedDefine(element)
44
44
 
45
45
  expect(element.testProp).toBe('updated static value')
46
46
  })
47
47
 
48
- it('should skip updates for undefined or null results', async () => {
48
+ it('should skip updates for undefined or null results', () => {
49
49
  ref.__exec.testProp = () => 'cached value'
50
50
  element.define.testProp = () => null
51
51
  element.testProp = 'original value'
52
52
 
53
- await throughUpdatedDefine(element)
53
+ throughUpdatedDefine(element)
54
54
 
55
55
  expect(element.testProp).toBe('original value')
56
56
  })
57
57
 
58
- it('should handle empty define objects', async () => {
58
+ it('should handle empty define objects', () => {
59
59
  const originalElement = { ...element }
60
60
 
61
- await throughUpdatedDefine(element)
61
+ throughUpdatedDefine(element)
62
62
 
63
63
  expect(element).toEqual(originalElement)
64
64
  })
65
65
 
66
- it('should pass correct arguments to define functions', async () => {
66
+ it('should pass correct arguments to define functions', () => {
67
67
  element.define.testProp = (cached, el, state, context) => ({
68
68
  cachedMatch: cached === 'cached value',
69
69
  elMatch: el === element,
@@ -72,7 +72,7 @@ describe('throughUpdatedDefine', () => {
72
72
  })
73
73
  ref.__defineCache.testProp = 'cached value'
74
74
 
75
- await throughUpdatedDefine(element)
75
+ throughUpdatedDefine(element)
76
76
 
77
77
  expect(element.testProp).toEqual({
78
78
  cachedMatch: true,
@@ -82,10 +82,10 @@ describe('throughUpdatedDefine', () => {
82
82
  })
83
83
  })
84
84
 
85
- it('should return an empty changes object', async () => {
85
+ it('should return an empty changes object', () => {
86
86
  element.define.testProp = () => 'updated value'
87
87
 
88
- const changes = await throughUpdatedDefine(element)
88
+ const changes = throughUpdatedDefine(element)
89
89
 
90
90
  expect(changes).toEqual({})
91
91
  })
@@ -15,45 +15,45 @@ describe('throughUpdatedExec', () => {
15
15
  }
16
16
  })
17
17
 
18
- it('should skip execution for params in __defineCache', () => {
18
+ it('should skip execution for params in __defineCache', async () => {
19
19
  ref.__defineCache.cachedParam = true
20
20
  ref.__exec.cachedParam = () => 'should not execute'
21
21
  element.cachedParam = 'original'
22
22
 
23
- const changes = throughUpdatedExec(element)
23
+ const changes = await throughUpdatedExec(element)
24
24
 
25
25
  expect(element.cachedParam).toBe('original')
26
26
  expect(changes).toEqual({})
27
27
  })
28
28
 
29
- it('should update element properties when newExec differs from current value', () => {
29
+ it('should update element properties when newExec differs from current value', async () => {
30
30
  ref.__exec.testParam = () => 'new value'
31
31
  element.testParam = 'old value'
32
32
 
33
- const changes = throughUpdatedExec(element)
33
+ const changes = await throughUpdatedExec(element)
34
34
 
35
35
  expect(element.testParam).toBe('new value')
36
36
  expect(changes).toEqual({ testParam: 'old value' })
37
37
  })
38
38
 
39
- it('should overwrite text property for nodes when exec returns string or number', () => {
39
+ it('should overwrite text property for nodes when exec returns string or number', async () => {
40
40
  const node = { node: true, text: 'old text' }
41
41
  ref.__exec.testParam = () => 'new text'
42
42
  element.testParam = node
43
43
 
44
- const changes = throughUpdatedExec(element)
44
+ const changes = await throughUpdatedExec(element)
45
45
 
46
46
  expect(element.testParam.text).toBe('new text')
47
47
  expect(changes).toEqual({})
48
48
  })
49
49
 
50
- it('should handle component naming matches and overwrite with context component', () => {
50
+ it('should handle component naming matches and overwrite with context component', async () => {
51
51
  const contextComponent = { extends: 'Component', prop: 'value' }
52
52
  element.context.components = { TestComponent: contextComponent }
53
53
  ref.__exec.TestComponent = () => contextComponent
54
54
  element.TestComponent = { oldProp: 'oldValue' }
55
55
 
56
- const changes = throughUpdatedExec(element)
56
+ const changes = await throughUpdatedExec(element)
57
57
 
58
58
  expect(element.TestComponent).toEqual({
59
59
  oldProp: 'oldValue',
@@ -62,44 +62,45 @@ describe('throughUpdatedExec', () => {
62
62
  expect(changes).toEqual({})
63
63
  })
64
64
 
65
- it('should not update element properties when newExec matches current value', () => {
65
+ it('should not update element properties when newExec matches current value', async () => {
66
66
  ref.__exec.testParam = () => 'same value'
67
67
  element.testParam = 'same value'
68
68
 
69
- const changes = throughUpdatedExec(element)
69
+ const changes = await throughUpdatedExec(element)
70
70
 
71
71
  expect(element.testParam).toBe('same value')
72
72
  expect(changes).toEqual({})
73
73
  })
74
74
 
75
- it('should handle non-string/non-number exec returns for non-node properties', () => {
75
+ it('should handle non-string/non-number exec returns for non-node properties', async () => {
76
76
  const newValue = { complex: 'object' }
77
77
  ref.__exec.testParam = () => newValue
78
78
  element.testParam = 'old value'
79
79
 
80
- const changes = throughUpdatedExec(element)
80
+ const changes = await throughUpdatedExec(element)
81
81
 
82
82
  expect(element.testParam).toBe(newValue)
83
83
  expect(changes).toEqual({ testParam: 'old value' })
84
84
  })
85
85
 
86
- it('should return an empty changes object when no updates occur', () => {
86
+ it('should return an empty changes object when no updates occur', async () => {
87
87
  ref.__exec.testParam = () => 'same value'
88
88
  element.testParam = 'same value'
89
89
 
90
- const changes = throughUpdatedExec(element)
90
+ const changes = await throughUpdatedExec(element)
91
91
 
92
92
  expect(changes).toEqual({})
93
93
  })
94
94
 
95
- it('should handle multiple properties and return correct changes', () => {
95
+ it('should handle multiple properties and return correct changes', async () => {
96
96
  ref.__exec.param1 = () => 'new value 1'
97
97
  ref.__exec.param2 = () => 'new value 2'
98
98
  element.param1 = 'old value 1'
99
99
  element.param2 = 'old value 2'
100
100
 
101
- const changes = throughUpdatedExec(element)
101
+ const changes = await throughUpdatedExec(element)
102
102
 
103
+ console.log(element)
103
104
  expect(element.param1).toBe('new value 1')
104
105
  expect(element.param2).toBe('new value 2')
105
106
  expect(changes).toEqual({