@knowark/componarkjs 1.10.2 → 1.10.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.
@@ -201,6 +201,32 @@ describe('Component', () => {
201
201
  expect(component.data.value).toEqual('E')
202
202
  })
203
203
 
204
+ it('binds multiple handlers to the same event', async () => {
205
+ container.innerHTML = `
206
+ <mock-component>
207
+ <input type="text"
208
+ listen
209
+ on-input="{{ data.value = data }}"
210
+ on-input-1="{{ data.value1 = data }}"
211
+ on-input-2="{{ data.value2 = data }}"
212
+ on-input-3="{{ data.value3 = data }}"
213
+ ></input>
214
+ </mock-component>
215
+ `
216
+
217
+ const component = container.querySelector('mock-component')
218
+ const input = component.select('input')
219
+
220
+ input.dispatchEvent(
221
+ new globalThis.InputEvent('input', { bubbles: true, data: 'E' })
222
+ )
223
+
224
+ expect(component.data.value).toEqual('E')
225
+ expect(component.data.value1).toEqual('E')
226
+ expect(component.data.value2).toEqual('E')
227
+ expect(component.data.value3).toEqual('E')
228
+ })
229
+
204
230
  it('binds to the target.value event property by default', async () => {
205
231
  container.innerHTML = `
206
232
  <mock-component>
@@ -50,7 +50,8 @@ export function listen (self) {
50
50
  }
51
51
  }
52
52
 
53
- const eventName = attribute.name.replace('on-', '').trim()
53
+ const eventName = (
54
+ attribute.name.replace('on-', '').replace(/-\d+$/, '').trim())
54
55
  element.addEventListener(eventName, catchingHandler.bind(self))
55
56
  element.removeAttribute(binding)
56
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowark/componarkjs",
3
- "version": "1.10.2",
3
+ "version": "1.10.3",
4
4
  "author": "Knowark",
5
5
  "description": "Knowark's Web Components Library",
6
6
  "license": "ISC",