Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js/tests
diff options
context:
space:
mode:
authorJohann-S <johann.servoire@gmail.com>2019-03-16 17:10:23 +0300
committerXhmikosR <xhmikosr@gmail.com>2019-03-18 02:11:05 +0300
commit08679ac0b5f34e1a1f1766be460e51bc1aa8d82a (patch)
tree2cef1cf8f17668c56b410c4c3e32a55bd4853af9 /js/tests
parentf7c1b1e683976ee780faadddc4edc70b477aa01f (diff)
Add back support for IE 11
Diffstat (limited to 'js/tests')
-rw-r--r--js/tests/browsers.js7
-rw-r--r--js/tests/karma.conf.js9
-rw-r--r--js/tests/unit/modal.js25
-rw-r--r--js/tests/unit/tests-polyfills.js28
4 files changed, 59 insertions, 10 deletions
diff --git a/js/tests/browsers.js b/js/tests/browsers.js
index 859f9505cc..a0d43da864 100644
--- a/js/tests/browsers.js
+++ b/js/tests/browsers.js
@@ -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',
diff --git a/js/tests/karma.conf.js b/js/tests/karma.conf.js
index 122d95753b..16f07cbf1a 100644
--- a/js/tests/karma.conf.js
+++ b/js/tests/karma.conf.js
@@ -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'
])
diff --git a/js/tests/unit/modal.js b/js/tests/unit/modal.js
index 87d778b868..82b37f2367 100644
--- a/js/tests/unit/modal.js
+++ b/js/tests/unit/modal.js
@@ -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')
})
diff --git a/js/tests/unit/tests-polyfills.js b/js/tests/unit/tests-polyfills.js
new file mode 100644
index 0000000000..4f2583e0db
--- /dev/null
+++ b/js/tests/unit/tests-polyfills.js
@@ -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
+ }
+})()