1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-12 08:34:08 +02:00

rewrite button unit tests

This commit is contained in:
Johann-S
2019-03-25 11:32:02 +01:00
parent c834895fa0
commit 891a187059
7 changed files with 318 additions and 234 deletions

View File

@@ -18,3 +18,21 @@ export const clearFixture = () => {
fixtureEl.innerHTML = ''
}
export const createEvent = (eventName, params) => {
params = params || {}
const e = document.createEvent('Event')
e.initEvent(eventName, Boolean(params.bubbles), Boolean(params.cancelable))
return e
}
export const jQueryMock = {
elements: undefined,
fn: {},
each(fn) {
this.elements.forEach(el => {
fn.call(el)
})
}
}