mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-16 02:24:19 +02:00
Rename variables
This commit is contained in:
@@ -1,32 +1,32 @@
|
||||
const fixtureId = 'fixture'
|
||||
|
||||
export const getFixture = () => {
|
||||
let fixtureEl = document.getElementById(fixtureId)
|
||||
let fixtureElement = document.getElementById(fixtureId)
|
||||
|
||||
if (!fixtureEl) {
|
||||
fixtureEl = document.createElement('div')
|
||||
fixtureEl.setAttribute('id', fixtureId)
|
||||
fixtureEl.style.position = 'absolute'
|
||||
fixtureEl.style.top = '-10000px'
|
||||
fixtureEl.style.left = '-10000px'
|
||||
fixtureEl.style.width = '10000px'
|
||||
fixtureEl.style.height = '10000px'
|
||||
document.body.append(fixtureEl)
|
||||
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 fixtureEl
|
||||
return fixtureElement
|
||||
}
|
||||
|
||||
export const clearFixture = () => {
|
||||
const fixtureEl = getFixture()
|
||||
const fixtureElement = getFixture()
|
||||
|
||||
fixtureEl.innerHTML = ''
|
||||
fixtureElement.innerHTML = ''
|
||||
}
|
||||
|
||||
export const createEvent = (eventName, params = {}) => {
|
||||
export const createEvent = (eventName, parameters = {}) => {
|
||||
const event = document.createEvent('Event')
|
||||
|
||||
event.initEvent(eventName, Boolean(params.bubbles), Boolean(params.cancelable))
|
||||
event.initEvent(eventName, Boolean(parameters.bubbles), Boolean(parameters.cancelable))
|
||||
return event
|
||||
}
|
||||
|
||||
@@ -34,8 +34,8 @@ export const jQueryMock = {
|
||||
elements: undefined,
|
||||
fn: {},
|
||||
each(fn) {
|
||||
for (const el of this.elements) {
|
||||
fn.call(el)
|
||||
for (const element of this.elements) {
|
||||
fn.call(element)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,8 +43,8 @@ export const jQueryMock = {
|
||||
export const clearBodyAndDocument = () => {
|
||||
const attributes = ['data-bs-padding-right', 'style']
|
||||
|
||||
for (const attr of attributes) {
|
||||
document.documentElement.removeAttribute(attr)
|
||||
document.body.removeAttribute(attr)
|
||||
for (const attribute of attributes) {
|
||||
document.documentElement.removeAttribute(attribute)
|
||||
document.body.removeAttribute(attribute)
|
||||
}
|
||||
}
|
||||
|
@@ -50,7 +50,7 @@ const detectBrowsers = {
|
||||
}
|
||||
}
|
||||
|
||||
const conf = {
|
||||
const config = {
|
||||
basePath: '../..',
|
||||
port: 9876,
|
||||
colors: true,
|
||||
@@ -101,8 +101,8 @@ const conf = {
|
||||
}
|
||||
|
||||
if (BROWSERSTACK) {
|
||||
conf.hostname = ip.address()
|
||||
conf.browserStack = {
|
||||
config.hostname = ip.address()
|
||||
config.browserStack = {
|
||||
username: ENV.BROWSER_STACK_USERNAME,
|
||||
accessKey: ENV.BROWSER_STACK_ACCESS_KEY,
|
||||
build: `bootstrap-${ENV.GITHUB_SHA ? ENV.GITHUB_SHA.slice(0, 7) + '-' : ''}${new Date().toISOString()}`,
|
||||
@@ -110,8 +110,8 @@ if (BROWSERSTACK) {
|
||||
retryLimit: 2
|
||||
}
|
||||
plugins.push('karma-browserstack-launcher', 'karma-jasmine-html-reporter')
|
||||
conf.customLaunchers = browsers
|
||||
conf.browsers = Object.keys(browsers)
|
||||
config.customLaunchers = browsers
|
||||
config.browsers = Object.keys(browsers)
|
||||
reporters.push('BrowserStack', 'kjhtml')
|
||||
} else if (JQUERY_TEST) {
|
||||
frameworks.push('detectBrowsers')
|
||||
@@ -120,8 +120,8 @@ if (BROWSERSTACK) {
|
||||
'karma-firefox-launcher',
|
||||
'karma-detect-browsers'
|
||||
)
|
||||
conf.detectBrowsers = detectBrowsers
|
||||
conf.files = [
|
||||
config.detectBrowsers = detectBrowsers
|
||||
config.files = [
|
||||
'node_modules/jquery/dist/jquery.slim.min.js',
|
||||
{
|
||||
pattern: 'js/tests/unit/jquery.spec.js',
|
||||
@@ -137,8 +137,8 @@ if (BROWSERSTACK) {
|
||||
'karma-coverage-istanbul-reporter'
|
||||
)
|
||||
reporters.push('coverage-istanbul')
|
||||
conf.detectBrowsers = detectBrowsers
|
||||
conf.coverageIstanbulReporter = {
|
||||
config.detectBrowsers = detectBrowsers
|
||||
config.coverageIstanbulReporter = {
|
||||
dir: path.resolve(__dirname, '../coverage/'),
|
||||
reports: ['lcov', 'text-summary'],
|
||||
thresholds: {
|
||||
@@ -153,19 +153,19 @@ if (BROWSERSTACK) {
|
||||
}
|
||||
|
||||
if (DEBUG) {
|
||||
conf.hostname = ip.address()
|
||||
config.hostname = ip.address()
|
||||
plugins.push('karma-jasmine-html-reporter')
|
||||
reporters.push('kjhtml')
|
||||
conf.singleRun = false
|
||||
conf.autoWatch = true
|
||||
config.singleRun = false
|
||||
config.autoWatch = true
|
||||
}
|
||||
}
|
||||
|
||||
conf.frameworks = frameworks
|
||||
conf.plugins = plugins
|
||||
conf.reporters = reporters
|
||||
config.frameworks = frameworks
|
||||
config.plugins = plugins
|
||||
config.reporters = reporters
|
||||
|
||||
module.exports = karmaConfig => {
|
||||
conf.logLevel = karmaConfig.LOG_ERROR
|
||||
karmaConfig.set(conf)
|
||||
config.logLevel = karmaConfig.LOG_ERROR
|
||||
karmaConfig.set(config)
|
||||
}
|
||||
|
Reference in New Issue
Block a user