mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-17 09:52:29 +01:00
upgrade to v4 stable
This commit is contained in:
parent
7f08061eca
commit
9744886519
@ -22,7 +22,6 @@ const VERSION = '4.3.1'
|
||||
const DATA_KEY = 'bs.carousel'
|
||||
const EVENT_KEY = `.${DATA_KEY}`
|
||||
const DATA_API_KEY = '.data-api'
|
||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
||||
const ARROW_LEFT_KEYCODE = 37 // KeyboardEvent.which value for left arrow key
|
||||
const ARROW_RIGHT_KEYCODE = 39 // KeyboardEvent.which value for right arrow key
|
||||
const TOUCHEVENT_COMPAT_WAIT = 500 // Time for mouse compat events to fire after touch
|
||||
@ -527,6 +526,7 @@ class Carousel {
|
||||
|
||||
if (!data) {
|
||||
data = new Carousel(element, _config)
|
||||
Data.setData(element, DATA_KEY, data)
|
||||
}
|
||||
|
||||
if (typeof config === 'number') {
|
||||
@ -602,13 +602,18 @@ EventHandler.on(window, Event.LOAD_DATA_API, () => {
|
||||
* ------------------------------------------------------------------------
|
||||
* jQuery
|
||||
* ------------------------------------------------------------------------
|
||||
* add .carousel to jQuery only if jQuery is present
|
||||
*/
|
||||
|
||||
$.fn[NAME] = Carousel._jQueryInterface
|
||||
$.fn[NAME].Constructor = Carousel
|
||||
$.fn[NAME].noConflict = () => {
|
||||
if (typeof window.$ !== 'undefined' || typeof window.jQuery !== 'undefined') {
|
||||
const $ = window.$ || window.jQuery
|
||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
||||
$.fn[NAME] = Carousel._jQueryInterface
|
||||
$.fn[NAME].Constructor = Carousel
|
||||
$.fn[NAME].noConflict = () => {
|
||||
$.fn[NAME] = JQUERY_NO_CONFLICT
|
||||
return Carousel._jQueryInterface
|
||||
}
|
||||
}
|
||||
|
||||
export default Carousel
|
||||
|
@ -142,7 +142,11 @@ class Collapse {
|
||||
}
|
||||
|
||||
if (actives) {
|
||||
activesData = Data.getData(actives[0], DATA_KEY)
|
||||
const tempActiveData = actives.filter((elem) => {
|
||||
const container = SelectorEngine.findOne(this._selector)
|
||||
return !container.contains(elem)
|
||||
})
|
||||
activesData = tempActiveData[0] ? Data.getData(tempActiveData[0], DATA_KEY) : null
|
||||
if (activesData && activesData._isTransitioning) {
|
||||
return
|
||||
}
|
||||
@ -154,7 +158,12 @@ class Collapse {
|
||||
}
|
||||
|
||||
if (actives) {
|
||||
actives.forEach((elemActive) => Collapse._collapseInterface(elemActive, 'hide'))
|
||||
actives.forEach((elemActive) => {
|
||||
const container = SelectorEngine.findOne(this._selector)
|
||||
if (!container.contains(elemActive)) {
|
||||
Collapse._collapseInterface(elemActive, 'hide')
|
||||
}
|
||||
})
|
||||
if (!activesData) {
|
||||
Data.setData(actives[0], DATA_KEY, null)
|
||||
}
|
||||
|
@ -570,17 +570,19 @@ $(function () {
|
||||
var $triggerTwo = $('#linkTriggerTwo')
|
||||
var $collapseOne = $('#collapseOne')
|
||||
var $collapseTwo = $('#collapseTwo')
|
||||
|
||||
$collapseOne.on('shown.bs.collapse', function () {
|
||||
assert.ok($collapseOne.hasClass('show'), '#collapseOne is shown')
|
||||
assert.ok(!$collapseTwo.hasClass('show'), '#collapseTwo is not shown')
|
||||
|
||||
$collapseTwo.on('shown.bs.collapse', function () {
|
||||
assert.ok(!$collapseOne.hasClass('show'), '#collapseOne is not shown')
|
||||
assert.ok($collapseTwo.hasClass('show'), '#collapseTwo is shown')
|
||||
done()
|
||||
})
|
||||
$triggerTwo.trigger($.Event('click'))
|
||||
EventHandler.trigger($triggerTwo[0], 'click')
|
||||
})
|
||||
$trigger.trigger($.Event('click'))
|
||||
EventHandler.trigger($trigger[0], 'click')
|
||||
})
|
||||
|
||||
QUnit.test('should allow accordion to target multiple elements', function (assert) {
|
||||
@ -612,7 +614,7 @@ $(function () {
|
||||
assert.ok($collapseOneTwo.hasClass('show'), '#collapseOneTwo is shown')
|
||||
assert.ok(!$collapseTwoOne.hasClass('show'), '#collapseTwoOne is not shown')
|
||||
assert.ok(!$collapseTwoTwo.hasClass('show'), '#collapseTwoTwo is not shown')
|
||||
$triggerTwo.trigger($.Event('click'))
|
||||
EventHandler.trigger($triggerTwo[0], 'click')
|
||||
}
|
||||
|
||||
function secondTest() {
|
||||
@ -655,7 +657,7 @@ $(function () {
|
||||
}
|
||||
})
|
||||
|
||||
$trigger.trigger($.Event('click'))
|
||||
EventHandler.trigger($trigger[0], 'click')
|
||||
})
|
||||
|
||||
QUnit.test('should collapse accordion children but not nested accordion children', function (assert) {
|
||||
|
@ -88,7 +88,7 @@ $(function () {
|
||||
assert.ok(!$dropdown.parent('.dropdown').hasClass('position-static'), '"position-static" class not added')
|
||||
done()
|
||||
})
|
||||
$dropdown.trigger('click')
|
||||
EventHandler.trigger($dropdown[0], 'click')
|
||||
})
|
||||
|
||||
QUnit.test('should add class position-static to dropdown if boundary not scrollParent', function (assert) {
|
||||
@ -110,7 +110,7 @@ $(function () {
|
||||
assert.ok($dropdown.parent('.dropdown').hasClass('position-static'), '"position-static" class added')
|
||||
done()
|
||||
})
|
||||
$dropdown.trigger('click')
|
||||
EventHandler.trigger($dropdown[0], 'click')
|
||||
})
|
||||
|
||||
QUnit.test('should set aria-expanded="true" on target when dropdown menu is shown', function (assert) {
|
||||
@ -834,7 +834,7 @@ $(function () {
|
||||
})
|
||||
|
||||
QUnit.test('should ignore space key events for <input>s within dropdown, and accept up, down and escape', function (assert) {
|
||||
assert.expect(6)
|
||||
assert.expect(7)
|
||||
var done = assert.async()
|
||||
|
||||
var dropdownHTML =
|
||||
@ -907,7 +907,7 @@ $(function () {
|
||||
})
|
||||
|
||||
QUnit.test('should ignore space key events for <textarea>s within dropdown, and accept up, down and escape', function (assert) {
|
||||
assert.expect(6)
|
||||
assert.expect(7)
|
||||
var done = assert.async()
|
||||
|
||||
var dropdownHTML =
|
||||
@ -1006,7 +1006,7 @@ $(function () {
|
||||
done()
|
||||
})
|
||||
|
||||
$dropdown.trigger('click')
|
||||
EventHandler.trigger($dropdown[0], 'click')
|
||||
})
|
||||
|
||||
QUnit.test('should call Popper.js and detect navbar on update', function (assert) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user