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

Add back support for IE 11

This commit is contained in:
Johann-S
2019-03-16 16:10:23 +02:00
committed by XhmikosR
parent f7c1b1e683
commit 08679ac0b5
10 changed files with 214 additions and 106 deletions

View File

@@ -30,6 +30,13 @@ const browsers = {
browser: 'Edge',
browser_version: 'latest'
},
ie11Win10: {
base: 'BrowserStack',
os: 'Windows',
os_version: '10',
browser: 'IE',
browser_version: '11.0'
},
chromeWin10: {
base: 'BrowserStack',
os: 'Windows',

View File

@@ -79,8 +79,9 @@ if (bundle) {
conf.detectBrowsers = detectBrowsers
files = files.concat([
jqueryFile,
'js/tests/unit/tests-polyfills.js',
'dist/js/bootstrap.js',
'js/tests/unit/*.js'
'js/tests/unit/!(tests-polyfills).js'
])
} else if (browserStack) {
conf.hostname = ip.address()
@@ -97,6 +98,7 @@ if (bundle) {
reporters.push('BrowserStack')
files = files.concat([
jqueryFile,
'js/tests/unit/tests-polyfills.js',
'js/coverage/dist/util/util.js',
'js/coverage/dist/util/sanitizer.js',
'js/coverage/dist/dom/polyfill.js',
@@ -107,7 +109,7 @@ if (bundle) {
'js/coverage/dist/dom/!(polyfill).js',
'js/coverage/dist/tooltip.js',
'js/coverage/dist/!(util|index|tooltip).js', // include all of our js/dist files except util.js, index.js and tooltip.js
'js/tests/unit/*.js',
'js/tests/unit/!(tests-polyfills).js',
'js/tests/unit/dom/*.js',
'js/tests/unit/util/*.js'
])
@@ -121,6 +123,7 @@ if (bundle) {
)
files = files.concat([
jqueryFile,
'js/tests/unit/tests-polyfills.js',
'js/coverage/dist/util/util.js',
'js/coverage/dist/util/sanitizer.js',
'js/coverage/dist/dom/polyfill.js',
@@ -131,7 +134,7 @@ if (bundle) {
'js/coverage/dist/dom/!(polyfill).js',
'js/coverage/dist/tooltip.js',
'js/coverage/dist/!(util|index|tooltip).js', // include all of our js/dist files except util.js, index.js and tooltip.js
'js/tests/unit/*.js',
'js/tests/unit/!(tests-polyfills).js',
'js/tests/unit/dom/*.js',
'js/tests/unit/util/*.js'
])

View File

@@ -731,7 +731,14 @@ $(function () {
})
QUnit.test('should enforce focus', function (assert) {
assert.expect(2)
var isIE11 = Boolean(window.MSInputMethodContext) && Boolean(document.documentMode)
if (isIE11) {
assert.expect(1)
} else {
assert.expect(2)
}
var done = assert.async()
var $modal = $([
@@ -759,14 +766,18 @@ $(function () {
done()
}
document.addEventListener('focusin', focusInListener)
if (isIE11) {
done()
} else {
document.addEventListener('focusin', focusInListener)
var focusInEvent = new Event('focusin')
Object.defineProperty(focusInEvent, 'target', {
value: $('#qunit-fixture')[0]
})
var focusInEvent = new Event('focusin')
Object.defineProperty(focusInEvent, 'target', {
value: $('#qunit-fixture')[0]
})
document.dispatchEvent(focusInEvent)
document.dispatchEvent(focusInEvent)
}
})
.bootstrapModal('show')
})

View File

@@ -0,0 +1,28 @@
// Polyfills for our unit tests
(function () {
'use strict'
// Event constructor shim
if (!window.Event || typeof window.Event !== 'function') {
var origEvent = window.Event
window.Event = function (inType, params) {
params = params || {}
var e = document.createEvent('Event')
e.initEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable))
return e
}
window.Event.prototype = origEvent.prototype
}
if (typeof window.CustomEvent !== 'function') {
window.CustomEvent = function (event, params) {
params = params || { bubbles: false, cancelable: false, detail: null }
var evt = document.createEvent('CustomEvent')
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail)
return evt
}
CustomEvent.prototype = window.Event.prototype
}
})()