Adding upstream version 5.2.3+dfsg.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
b80f12a01d
commit
bc475d7d0d
617 changed files with 89471 additions and 0 deletions
47
js/tests/helpers/fixture.js
Normal file
47
js/tests/helpers/fixture.js
Normal file
|
@ -0,0 +1,47 @@
|
|||
const fixtureId = 'fixture'
|
||||
|
||||
export const getFixture = () => {
|
||||
let fixtureElement = document.getElementById(fixtureId)
|
||||
|
||||
if (!fixtureElement) {
|
||||
fixtureElement = document.createElement('div')
|
||||
fixtureElement.setAttribute('id', fixtureId)
|
||||
fixtureElement.style.position = 'absolute'
|
||||
fixtureElement.style.top = '-10000px'
|
||||
fixtureElement.style.left = '-10000px'
|
||||
fixtureElement.style.width = '10000px'
|
||||
fixtureElement.style.height = '10000px'
|
||||
document.body.append(fixtureElement)
|
||||
}
|
||||
|
||||
return fixtureElement
|
||||
}
|
||||
|
||||
export const clearFixture = () => {
|
||||
const fixtureElement = getFixture()
|
||||
|
||||
fixtureElement.innerHTML = ''
|
||||
}
|
||||
|
||||
export const createEvent = (eventName, parameters = {}) => {
|
||||
return new Event(eventName, parameters)
|
||||
}
|
||||
|
||||
export const jQueryMock = {
|
||||
elements: undefined,
|
||||
fn: {},
|
||||
each(fn) {
|
||||
for (const element of this.elements) {
|
||||
fn.call(element)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const clearBodyAndDocument = () => {
|
||||
const attributes = ['data-bs-padding-right', 'style']
|
||||
|
||||
for (const attribute of attributes) {
|
||||
document.documentElement.removeAttribute(attribute)
|
||||
document.body.removeAttribute(attribute)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue