Skip to content

Commit a2fdf41

Browse files
committed
Add test for multiple actions across LF
1 parent c07f507 commit a2fdf41

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

test/bind.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,22 @@ describe('bind', () => {
106106
expect(calls).to.have.nested.property('[1][0].type', 'submit')
107107
})
108108

109+
it('can bind multiple actions', () => {
110+
const instance = document.createElement('bind-test-element')
111+
chai.spy.on(instance, 'foo')
112+
chai.spy.on(instance, 'bar')
113+
const el = document.createElement('div')
114+
el.setAttribute('data-action', `click:bind-test-element#foo\nclick:bind-test-element#bar`)
115+
instance.appendChild(el)
116+
bind(instance)
117+
expect(instance.foo).to.have.not.been.called()
118+
el.dispatchEvent(new CustomEvent('click'))
119+
expect(instance.foo).to.have.been.called.exactly(1)
120+
expect(instance.bar).to.have.been.called.exactly(1)
121+
expect(instance.foo.__spy.calls).to.have.nested.property('[0][0].type', 'click')
122+
expect(instance.bar.__spy.calls).to.have.nested.property('[0][0].type', 'click')
123+
})
124+
109125
it('can bind multiple elements to the same event', () => {
110126
const instance = document.createElement('bind-test-element')
111127
chai.spy.on(instance, 'foo')

0 commit comments

Comments
 (0)