- Be sure you've loaded the alert plugin, or the compiled Bootstrap JavaScript.
- Add a dismiss button and the `.alert-dismissible` class, which adds extra padding to the right of the alert and positions the `.close` button.
- On the dismiss button, add the `data-dismiss="alert"` attribute, which triggers the JavaScript functionality. Be sure to use the `<button>` element with it for proper behavior across all devices.
-- To animate alerts when dismissing them, be sure to add the `.fade` and `.in` classes.
+- To animate alerts when dismissing them, be sure to add the `.fade` and `.active` classes.
You can see this in action with a live demo:
{% example html %}
-<div class="alert alert-warning alert-dismissible fade in" role="alert">
+<div class="alert alert-warning alert-dismissible fade active" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
- `.collapse` hides content
- `.collapsing` is applied during transitions
-- `.collapse.in` shows content
+- `.collapse.active` shows content
You can use a link with the `href` attribute, or a button with the `data-target` attribute. In both cases, the `data-toggle="collapse"` is required.
</h5>
</div>
- <div id="collapseOne" class="collapse in" role="tabpanel" aria-labelledby="headingOne">
+ <div id="collapseOne" class="collapse active" role="tabpanel" aria-labelledby="headingOne">
<div class="card-block">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
The collapse plugin utilizes a few classes to handle the heavy lifting:
- `.collapse` hides the content
-- `.collapse.in` shows the content
+- `.collapse.active` shows the content
- `.collapsing` is added when the transition starts, and removed when it finishes
These classes can be found in `_animation.scss`.
### Via data attributes
-Just add `data-toggle="collapse"` and a `data-target` to the element to automatically assign control of a collapsible element. The `data-target` attribute accepts a CSS selector to apply the collapse to. Be sure to add the class `collapse` to the collapsible element. If you'd like it to default open, add the additional class `in`.
+Just add `data-toggle="collapse"` and a `data-target` to the element to automatically assign control of a collapsible element. The `data-target` attribute accepts a CSS selector to apply the collapse to. Be sure to add the class `collapse` to the collapsible element. If you'd like it to default open, add the additional class `active`.
To add accordion-like group management to a collapsible control, add the data attribute `data-parent="#selector"`. Refer to the demo to see this in action.
Any single `.btn` can be turned into a dropdown toggle with some markup changes. Here's how you can put them to work with either `<button>` elements:
{% example html %}
-<div class="dropdown open">
+<div class="dropdown active">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown button
</button>
And with `<a>` elements:
{% example html %}
-<div class="dropdown open">
+<div class="dropdown active">
<a class="btn btn-secondary dropdown-toggle" href="https://example.com" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown link
</a>
Historically dropdown menu contents *had* to be links, but that's no longer the case with v4. Now you can optionally use `<button>` elements in your dropdowns instead of just `<a>`s.
{% example html %}
-<div class="dropdown open">
+<div class="dropdown active">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown
</button>
## Usage
-Via data attributes or JavaScript, the dropdown plugin toggles hidden content (dropdown menus) by toggling the `.open` class on the parent list item.
+Via data attributes or JavaScript, the dropdown plugin toggles hidden content (dropdown menus) by toggling the `.active` class on the parent list item.
On mobile devices, opening a dropdown adds a `.dropdown-backdrop` as a tap area for closing dropdown menus when tapping outside the menu, a requirement for proper iOS support. **This means that switching from an open dropdown menu to a different dropdown menu requires an extra tap on mobile.**
}
const ClassName = {
- ALERT : 'alert',
- FADE : 'fade',
- IN : 'in'
+ ALERT : 'alert',
+ FADE : 'fade',
+ ACTIVE : 'active'
}
}
_removeElement(element) {
- $(element).removeClass(ClassName.IN)
+ $(element).removeClass(ClassName.ACTIVE)
if (!Util.supportsTransitionEnd() ||
!$(element).hasClass(ClassName.FADE)) {
}
const ClassName = {
- IN : 'in',
+ ACTIVE : 'active',
COLLAPSE : 'collapse',
COLLAPSING : 'collapsing',
COLLAPSED : 'collapsed'
}
const Selector = {
- ACTIVES : '.card > .in, .card > .collapsing',
+ ACTIVES : '.card > .active, .card > .collapsing',
DATA_TOGGLE : '[data-toggle="collapse"]'
}
// public
toggle() {
- if ($(this._element).hasClass(ClassName.IN)) {
+ if ($(this._element).hasClass(ClassName.ACTIVE)) {
this.hide()
} else {
this.show()
show() {
if (this._isTransitioning ||
- $(this._element).hasClass(ClassName.IN)) {
+ $(this._element).hasClass(ClassName.ACTIVE)) {
return
}
$(this._element)
.removeClass(ClassName.COLLAPSING)
.addClass(ClassName.COLLAPSE)
- .addClass(ClassName.IN)
+ .addClass(ClassName.ACTIVE)
this._element.style[dimension] = ''
hide() {
if (this._isTransitioning ||
- !$(this._element).hasClass(ClassName.IN)) {
+ !$(this._element).hasClass(ClassName.ACTIVE)) {
return
}
$(this._element)
.addClass(ClassName.COLLAPSING)
.removeClass(ClassName.COLLAPSE)
- .removeClass(ClassName.IN)
+ .removeClass(ClassName.ACTIVE)
this._element.setAttribute('aria-expanded', false)
_addAriaAndCollapsedClass(element, triggerArray) {
if (element) {
- let isOpen = $(element).hasClass(ClassName.IN)
+ let isOpen = $(element).hasClass(ClassName.ACTIVE)
element.setAttribute('aria-expanded', isOpen)
if (triggerArray.length) {
const ClassName = {
BACKDROP : 'dropdown-backdrop',
DISABLED : 'disabled',
- OPEN : 'open'
+ ACTIVE : 'active'
}
const Selector = {
}
let parent = Dropdown._getParentFromElement(this)
- let isActive = $(parent).hasClass(ClassName.OPEN)
+ let isActive = $(parent).hasClass(ClassName.ACTIVE)
Dropdown._clearMenus()
this.focus()
this.setAttribute('aria-expanded', 'true')
- $(parent).toggleClass(ClassName.OPEN)
+ $(parent).toggleClass(ClassName.ACTIVE)
$(parent).trigger($.Event(Event.SHOWN, relatedTarget))
return false
let parent = Dropdown._getParentFromElement(toggles[i])
let relatedTarget = { relatedTarget : toggles[i] }
- if (!$(parent).hasClass(ClassName.OPEN)) {
+ if (!$(parent).hasClass(ClassName.ACTIVE)) {
continue
}
toggles[i].setAttribute('aria-expanded', 'false')
$(parent)
- .removeClass(ClassName.OPEN)
+ .removeClass(ClassName.ACTIVE)
.trigger($.Event(Event.HIDDEN, relatedTarget))
}
}
}
let parent = Dropdown._getParentFromElement(this)
- let isActive = $(parent).hasClass(ClassName.OPEN)
+ let isActive = $(parent).hasClass(ClassName.ACTIVE)
if ((!isActive && event.which !== ESCAPE_KEYCODE) ||
(isActive && event.which === ESCAPE_KEYCODE)) {
BACKDROP : 'modal-backdrop',
OPEN : 'modal-open',
FADE : 'fade',
- IN : 'in'
+ ACTIVE : 'active'
}
const Selector = {
$(document).off(Event.FOCUSIN)
- $(this._element).removeClass(ClassName.IN)
+ $(this._element).removeClass(ClassName.ACTIVE)
$(this._element).off(Event.CLICK_DISMISS)
$(this._dialog).off(Event.MOUSEDOWN_DISMISS)
Util.reflow(this._element)
}
- $(this._element).addClass(ClassName.IN)
+ $(this._element).addClass(ClassName.ACTIVE)
if (this._config.focus) {
this._enforceFocus()
Util.reflow(this._backdrop)
}
- $(this._backdrop).addClass(ClassName.IN)
+ $(this._backdrop).addClass(ClassName.ACTIVE)
if (!callback) {
return
.emulateTransitionEnd(BACKDROP_TRANSITION_DURATION)
} else if (!this._isShown && this._backdrop) {
- $(this._backdrop).removeClass(ClassName.IN)
+ $(this._backdrop).removeClass(ClassName.ACTIVE)
let callbackRemove = () => {
this._removeBackdrop()
})
const ClassName = {
- FADE : 'fade',
- IN : 'in'
+ FADE : 'fade',
+ ACTIVE : 'active'
}
const Selector = {
$tip
.removeClass(ClassName.FADE)
- .removeClass(ClassName.IN)
+ .removeClass(ClassName.ACTIVE)
this.cleanupTether()
}
}
const HoverState = {
- IN : 'in',
- OUT : 'out'
+ ACTIVE : 'active',
+ OUT : 'out'
}
const Event = {
}
const ClassName = {
- FADE : 'fade',
- IN : 'in'
+ FADE : 'fade',
+ ACTIVE : 'active'
}
const Selector = {
} else {
- if ($(this.getTipElement()).hasClass(ClassName.IN)) {
+ if ($(this.getTipElement()).hasClass(ClassName.ACTIVE)) {
this._leave(null, this)
return
}
Util.reflow(tip)
this._tether.position()
- $(tip).addClass(ClassName.IN)
+ $(tip).addClass(ClassName.ACTIVE)
let complete = () => {
let prevHoverState = this._hoverState
let tip = this.getTipElement()
let hideEvent = $.Event(this.constructor.Event.HIDE)
let complete = () => {
- if (this._hoverState !== HoverState.IN && tip.parentNode) {
+ if (this._hoverState !== HoverState.ACTIVE && tip.parentNode) {
tip.parentNode.removeChild(tip)
}
return
}
- $(tip).removeClass(ClassName.IN)
+ $(tip).removeClass(ClassName.ACTIVE)
if (Util.supportsTransitionEnd() &&
($(this.tip).hasClass(ClassName.FADE))) {
$tip
.removeClass(ClassName.FADE)
- .removeClass(ClassName.IN)
+ .removeClass(ClassName.ACTIVE)
this.cleanupTether()
}
] = true
}
- if ($(context.getTipElement()).hasClass(ClassName.IN) ||
- (context._hoverState === HoverState.IN)) {
- context._hoverState = HoverState.IN
+ if ($(context.getTipElement()).hasClass(ClassName.ACTIVE) ||
+ (context._hoverState === HoverState.ACTIVE)) {
+ context._hoverState = HoverState.ACTIVE
return
}
clearTimeout(context._timeout)
- context._hoverState = HoverState.IN
+ context._hoverState = HoverState.ACTIVE
if (!context.config.delay || !context.config.delay.show) {
context.show()
}
context._timeout = setTimeout(() => {
- if (context._hoverState === HoverState.IN) {
+ if (context._hoverState === HoverState.ACTIVE) {
context.show()
}
}, context.config.delay.show)
QUnit.test('should fade element out on clicking .close', function (assert) {
assert.expect(1)
- var alertHTML = '<div class="alert alert-danger fade in">'
+ var alertHTML = '<div class="alert alert-danger fade active">'
+ '<a class="close" href="#" data-dismiss="alert">×</a>'
+ '<p><strong>Holy guacamole!</strong> Best check yo self, you\'re not looking too good.</p>'
+ '</div>'
$alert.find('.close').trigger('click')
- assert.strictEqual($alert.hasClass('in'), false, 'remove .in class on .close click')
+ assert.strictEqual($alert.hasClass('active'), false, 'remove .active class on .close click')
})
QUnit.test('should remove element when clicking .close', function (assert) {
assert.expect(2)
- var alertHTML = '<div class="alert alert-danger fade in">'
+ var alertHTML = '<div class="alert alert-danger fade active">'
+ '<a class="close" href="#" data-dismiss="alert">×</a>'
+ '<p><strong>Holy guacamole!</strong> Best check yo self, you\'re not looking too good.</p>'
+ '</div>'
assert.expect(2)
var $el = $('<div class="collapse"/>').bootstrapCollapse('show')
- assert.ok($el.hasClass('in'), 'has class "in"')
+ assert.ok($el.hasClass('active'), 'has class "active"')
assert.ok(!/height/i.test($el.attr('style')), 'has height reset')
})
'</div>',
'<div class="panel-group" id="accordion2">',
'<div class="panel">',
- '<div id="collapse2" class="collapse in"/>',
+ '<div id="collapse2" class="collapse active"/>',
'</div>',
'</div>'
].join('')
var $el2 = $('#collapse2')
$el1.bootstrapCollapse('show')
- assert.ok($el1.hasClass('in'))
- assert.ok($el2.hasClass('in'))
+ assert.ok($el1.hasClass('active'))
+ assert.ok($el2.hasClass('active'))
})
QUnit.test('should hide a collapsed element', function (assert) {
assert.expect(1)
var $el = $('<div class="collapse"/>').bootstrapCollapse('hide')
- assert.ok(!$el.hasClass('in'), 'does not have class "in"')
+ assert.ok(!$el.hasClass('active'), 'does not have class "active"')
})
QUnit.test('should not fire shown when show is prevented', function (assert) {
var $target = $('<a role="button" data-toggle="collapse" href="#test1"/>').appendTo('#qunit-fixture')
- $('<div id="test1" class="in"/>')
+ $('<div id="test1" class="active"/>')
.appendTo('#qunit-fixture')
.on('hidden.bs.collapse', function () {
assert.ok($target.hasClass('collapsed'), 'target has collapsed class')
var $target = $('<a role="button" data-toggle="collapse" href="#test1"/>').appendTo('#qunit-fixture')
var $alt = $('<a role="button" data-toggle="collapse" href="#test1"/>').appendTo('#qunit-fixture')
- $('<div id="test1" class="in"/>')
+ $('<div id="test1" class="active"/>')
.appendTo('#qunit-fixture')
.on('hidden.bs.collapse', function () {
assert.ok($target.hasClass('collapsed'), 'target has collapsed class')
assert.expect(0)
var done = assert.async()
- var $test = $('<div id="test1" class="in"/>')
+ var $test = $('<div id="test1" class="active"/>')
.appendTo('#qunit-fixture')
.on('hide.bs.collapse', function () {
assert.ok(false)
assert.expect(1)
var done = assert.async()
- $('<div class="collapse in"></div>')
+ $('<div class="collapse active"></div>')
.appendTo('#qunit-fixture')
.on('hide.bs.collapse', function () {
assert.ok(true, 'hiding a previously-uninitialized shown collapse when the "hide" method is called')
var $target1 = $('<a role="button" data-toggle="collapse" href="#body1" data-parent="#accordion"/>').appendTo($groups.eq(0))
- $('<div id="body1" class="in"/>').appendTo($groups.eq(0))
+ $('<div id="body1" class="active"/>').appendTo($groups.eq(0))
var $target2 = $('<a class="collapsed" data-toggle="collapse" role="button" href="#body2" data-parent="#accordion"/>').appendTo($groups.eq(1))
var $target1 = $('<a role="button" data-toggle="collapse" href="#body1" data-parent=".accordion"/>').appendTo($groups.eq(0))
- $('<div id="body1" class="in"/>').appendTo($groups.eq(0))
+ $('<div id="body1" class="active"/>').appendTo($groups.eq(0))
var $target2 = $('<a class="collapsed" data-toggle="collapse" role="button" href="#body2" data-parent=".accordion"/>').appendTo($groups.eq(1))
var $target = $('<a role="button" data-toggle="collapse" href="#test1" aria-expanded="true"/>').appendTo('#qunit-fixture')
- $('<div id="test1" class="in"/>')
+ $('<div id="test1" class="active"/>')
.appendTo('#qunit-fixture')
.on('hidden.bs.collapse', function () {
assert.strictEqual($target.attr('aria-expanded'), 'false', 'aria-expanded on target is "false"')
var $target = $('<a role="button" data-toggle="collapse" href="#test1" aria-expanded="true"/>').appendTo('#qunit-fixture')
var $alt = $('<a role="button" data-toggle="collapse" href="#test1" aria-expanded="true"/>').appendTo('#qunit-fixture')
- $('<div id="test1" class="in"/>')
+ $('<div id="test1" class="active"/>')
.appendTo('#qunit-fixture')
.on('hidden.bs.collapse', function () {
assert.strictEqual($target.attr('aria-expanded'), 'false', 'aria-expanded on target is "false"')
var $target1 = $('<a role="button" data-toggle="collapse" href="#body1" data-parent="#accordion"/>').appendTo($groups.eq(0))
- $('<div id="body1" aria-expanded="true" class="in"/>').appendTo($groups.eq(0))
+ $('<div id="body1" aria-expanded="true" class="active"/>').appendTo($groups.eq(0))
var $target2 = $('<a role="button" data-toggle="collapse" href="#body2" data-parent="#accordion" class="collapsed" />').appendTo($groups.eq(1))
$target2.trigger('click')
$body2
- .toggleClass('in collapsing')
+ .toggleClass('active collapsing')
.data('bs.collapse')._isTransitioning = 1
$target1.trigger('click')
var $target = $('<a role="button" data-toggle="collapse" href="#test1"/>').appendTo('#qunit-fixture')
- $('<div id="test1" class="in"/>')
+ $('<div id="test1" class="active"/>')
.appendTo('#qunit-fixture')
.on('hidden.bs.collapse', function () {
assert.ok($target.hasClass('collapsed'))
+ '</ul>'
var $dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').bootstrapDropdown().trigger('click')
- assert.ok(!$dropdown.parent('.dropdown').hasClass('open'), '"open" class added on click')
+ assert.ok(!$dropdown.parent('.dropdown').hasClass('active'), '"active" class added on click')
})
QUnit.test('should set aria-expanded="true" on target when dropdown menu is shown', function (assert) {
+ '</ul>'
var $dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').bootstrapDropdown().trigger('click')
- assert.ok(!$dropdown.parent('.dropdown').hasClass('open'), '"open" class added on click')
+ assert.ok(!$dropdown.parent('.dropdown').hasClass('active'), '"active" class added on click')
})
- QUnit.test('should add class open to menu if clicked', function (assert) {
+ QUnit.test('should add class active to menu if clicked', function (assert) {
assert.expect(1)
var dropdownHTML = '<ul class="tabs">'
+ '<li class="dropdown">'
+ '</ul>'
var $dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').bootstrapDropdown().trigger('click')
- assert.ok($dropdown.parent('.dropdown').hasClass('open'), '"open" class added on click')
+ assert.ok($dropdown.parent('.dropdown').hasClass('active'), '"active" class added on click')
})
QUnit.test('should test if element has a # before assuming it\'s a selector', function (assert) {
+ '</ul>'
var $dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').bootstrapDropdown().trigger('click')
- assert.ok($dropdown.parent('.dropdown').hasClass('open'), '"open" class added on click')
+ assert.ok($dropdown.parent('.dropdown').hasClass('active'), '"active" class added on click')
})
- QUnit.test('should remove "open" class if body is clicked', function (assert) {
+ QUnit.test('should remove "active" class if body is clicked', function (assert) {
assert.expect(2)
var dropdownHTML = '<ul class="tabs">'
+ '<li class="dropdown">'
.bootstrapDropdown()
.trigger('click')
- assert.ok($dropdown.parent('.dropdown').hasClass('open'), '"open" class added on click')
+ assert.ok($dropdown.parent('.dropdown').hasClass('active'), '"active" class added on click')
$(document.body).trigger('click')
- assert.ok(!$dropdown.parent('.dropdown').hasClass('open'), '"open" class removed')
+ assert.ok(!$dropdown.parent('.dropdown').hasClass('active'), '"active" class removed')
})
- QUnit.test('should remove "open" class if body is clicked, with multiple dropdowns', function (assert) {
+ QUnit.test('should remove "active" class if body is clicked, with multiple dropdowns', function (assert) {
assert.expect(7)
var dropdownHTML = '<ul class="nav">'
+ '<li><a href="#menu1">Menu 1</a></li>'
assert.strictEqual($dropdowns.length, 2, 'two dropdowns')
$first.trigger('click')
- assert.strictEqual($first.parents('.open').length, 1, '"open" class added on click')
- assert.strictEqual($('#qunit-fixture .open').length, 1, 'only one dropdown is open')
+ assert.strictEqual($first.parents('.active').length, 1, '"active" class added on click')
+ assert.strictEqual($('#qunit-fixture .active').length, 1, 'only one dropdown is active')
$(document.body).trigger('click')
- assert.strictEqual($('#qunit-fixture .open').length, 0, '"open" class removed')
+ assert.strictEqual($('#qunit-fixture .active').length, 0, '"active" class removed')
$last.trigger('click')
- assert.strictEqual($last.parent('.open').length, 1, '"open" class added on click')
- assert.strictEqual($('#qunit-fixture .open').length, 1, 'only one dropdown is open')
+ assert.strictEqual($last.parent('.active').length, 1, '"active" class added on click')
+ assert.strictEqual($('#qunit-fixture .active').length, 1, 'only one dropdown is active')
$(document.body).trigger('click')
- assert.strictEqual($('#qunit-fixture .open').length, 0, '"open" class removed')
+ assert.strictEqual($('#qunit-fixture .active').length, 0, '"active" class removed')
})
QUnit.test('should fire show and hide event', function (assert) {
$('#textField').trigger('click')
- assert.ok($dropdown.parent('.btn-group').hasClass('open'), 'dropdown menu is open')
+ assert.ok($dropdown.parent('.btn-group').hasClass('active'), 'dropdown menu is active')
})
QUnit.test('should not close the dropdown if the user clicks on a textarea', function (assert) {
$('#textArea').trigger('click')
- assert.ok($dropdown.parent('.btn-group').hasClass('open'), 'dropdown menu is open')
+ assert.ok($dropdown.parent('.btn-group').hasClass('active'), 'dropdown menu is active')
})
})
$popover.bootstrapPopover('show')
$popover.bootstrapPopover('dispose')
- assert.ok(!$popover.hasClass('in'), 'popover is hidden')
+ assert.ok(!$popover.hasClass('active'), 'popover is hidden')
assert.ok(!$popover.data('popover'), 'popover does not have data')
assert.strictEqual($._data($popover[0], 'events').click[0].namespace, 'foo', 'popover still has click.foo')
assert.ok(!$._data($popover[0], 'events').mouseover && !$._data($popover[0], 'events').mouseout, 'popover does not have any events')
assert
.ok($('.tooltip')
- .is('.fade.bs-tether-element-attached-top.bs-tether-element-attached-center.in'), 'has correct classes applied')
+ .is('.fade.bs-tether-element-attached-top.bs-tether-element-attached-center.active'), 'has correct classes applied')
$tooltip.bootstrapTooltip('hide')
$tooltip.bootstrapTooltip('show')
$tooltip.bootstrapTooltip('dispose')
- assert.ok(!$tooltip.hasClass('in'), 'tooltip is hidden')
+ assert.ok(!$tooltip.hasClass('active'), 'tooltip is hidden')
assert.ok(!$._data($tooltip[0], 'bs.tooltip'), 'tooltip does not have data')
assert.strictEqual($._data($tooltip[0], 'events').click[0].namespace, 'foo', 'tooltip still has click.foo')
assert.ok(!$._data($tooltip[0], 'events').mouseover && !$._data($tooltip[0], 'events').mouseout, 'tooltip does not have hover events')
.bootstrapTooltip({ trigger: 'manual' })
.bootstrapTooltip('toggle')
- assert.ok($('.tooltip').is('.fade.in'), 'tooltip is faded in')
+ assert.ok($('.tooltip').is('.fade.active'), 'tooltip is faded active')
})
QUnit.test('should hide previously shown tooltip when toggle is called on tooltip', function (assert) {
.bootstrapTooltip('show')
$('.tooltip').bootstrapTooltip('toggle')
- assert.ok($('.tooltip').not('.fade.in'), 'tooltip was faded out')
+ assert.ok($('.tooltip').not('.fade.active'), 'tooltip was faded out')
})
QUnit.test('should place tooltips inside body when container is body', function (assert) {
.bootstrapTooltip({ delay: 150 })
setTimeout(function () {
- assert.ok(!$('.tooltip').is('.fade.in'), '100ms: tooltip is not faded in')
+ assert.ok(!$('.tooltip').is('.fade.active'), '100ms: tooltip is not faded active')
}, 100)
setTimeout(function () {
- assert.ok($('.tooltip').is('.fade.in'), '200ms: tooltip is faded in')
+ assert.ok($('.tooltip').is('.fade.active'), '200ms: tooltip is faded active')
done()
}, 200)
.bootstrapTooltip({ delay: 150 })
setTimeout(function () {
- assert.ok(!$('.tooltip').is('.fade.in'), '100ms: tooltip not faded in')
+ assert.ok(!$('.tooltip').is('.fade.active'), '100ms: tooltip not faded active')
$tooltip.trigger('mouseout')
}, 100)
setTimeout(function () {
- assert.ok(!$('.tooltip').is('.fade.in'), '200ms: tooltip not faded in')
+ assert.ok(!$('.tooltip').is('.fade.active'), '200ms: tooltip not faded active')
done()
}, 200)
.bootstrapTooltip({ delay: { show: 0, hide: 150 }})
setTimeout(function () {
- assert.ok($('.tooltip').is('.fade.in'), '1ms: tooltip faded in')
+ assert.ok($('.tooltip').is('.fade.active'), '1ms: tooltip faded active')
$tooltip.trigger('mouseout')
setTimeout(function () {
- assert.ok($('.tooltip').is('.fade.in'), '100ms: tooltip still faded in')
+ assert.ok($('.tooltip').is('.fade.active'), '100ms: tooltip still faded active')
$tooltip.trigger('mouseenter')
}, 100)
setTimeout(function () {
- assert.ok($('.tooltip').is('.fade.in'), '200ms: tooltip still faded in')
+ assert.ok($('.tooltip').is('.fade.active'), '200ms: tooltip still faded active')
done()
}, 200)
}, 0)
.bootstrapTooltip({ delay: 150 })
setTimeout(function () {
- assert.ok(!$('.tooltip').is('.fade.in'), '100ms: tooltip not faded in')
+ assert.ok(!$('.tooltip').is('.fade.active'), '100ms: tooltip not faded active')
$tooltip.trigger('mouseout')
}, 100)
setTimeout(function () {
- assert.ok(!$('.tooltip').is('.fade.in'), '200ms: tooltip not faded in')
+ assert.ok(!$('.tooltip').is('.fade.active'), '200ms: tooltip not faded active')
done()
}, 200)
.bootstrapTooltip({ delay: { show: 150, hide: 0 }})
setTimeout(function () {
- assert.ok(!$('.tooltip').is('.fade.in'), '100ms: tooltip not faded in')
+ assert.ok(!$('.tooltip').is('.fade.active'), '100ms: tooltip not faded active')
$tooltip.trigger('mouseout')
}, 100)
setTimeout(function () {
- assert.ok(!$('.tooltip').is('.fade.in'), '250ms: tooltip not faded in')
+ assert.ok(!$('.tooltip').is('.fade.active'), '250ms: tooltip not faded active')
done()
}, 250)
.bootstrapTooltip({ delay: { show: 0, hide: 150 }})
setTimeout(function () {
- assert.ok($($tooltip.data('bs.tooltip').tip).is('.fade.in'), '1ms: tooltip faded in')
+ assert.ok($($tooltip.data('bs.tooltip').tip).is('.fade.active'), '1ms: tooltip faded active')
$tooltip.trigger('mouseout')
setTimeout(function () {
- assert.ok($($tooltip.data('bs.tooltip').tip).is('.fade.in'), '100ms: tooltip still faded in')
+ assert.ok($($tooltip.data('bs.tooltip').tip).is('.fade.active'), '100ms: tooltip still faded active')
}, 100)
setTimeout(function () {
- assert.ok(!$($tooltip.data('bs.tooltip').tip).is('.in'), '200ms: tooltip removed')
+ assert.ok(!$($tooltip.data('bs.tooltip').tip).is('.active'), '200ms: tooltip removed')
done()
}, 200)
assert.ok(obj._hoverState == 'out', 'the tooltip hoverState should be set to "out"')
$('#tt-outer').trigger('mouseenter')
- assert.ok(obj._hoverState == 'in', 'the tooltip hoverState should be set to "in"')
+ assert.ok(obj._hoverState == 'active', 'the tooltip hoverState should be set to "active"')
assert.strictEqual(currentUid, $('#tt-content').text())
})
var tooltip = $el.data('bs.tooltip')
var $tooltip = $(tooltip.getTipElement())
- function showingTooltip() { return $tooltip.hasClass('in') || tooltip._hoverState == 'in' }
+ function showingTooltip() { return $tooltip.hasClass('active') || tooltip._hoverState == 'active' }
var tests = [
['mouseenter', 'mouseleave'],
<h1>Alert <small>Bootstrap Visual Test</small></h1>
- <div class="alert alert-warning fade in">
+ <div class="alert alert-warning fade active">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<strong>Holy guacamole!</strong> Best check yo self, you're not looking too good.
</div>
- <div class="alert alert-danger fade in">
+ <div class="alert alert-danger fade active">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<h4>Oh snap! You got an error!</h4>
<p>Change this and that and try again. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.</p>
</a>
</h5>
</div>
- <div id="collapseOne" class="collapse in">
+ <div id="collapseOne" class="collapse active">
<div class="card-block">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</a>
</h5>
</div>
- <div id="collapseOne" class="collapse in" role="tabpanel" aria-labelledby="headingOne">
+ <div id="collapseOne" class="collapse active" role="tabpanel" aria-labelledby="headingOne">
<div class="card-block">
Lorem ipsum
</div>
}
// Open state for the dropdown
-.open {
+.active {
// Show the menu
> .dropdown-menu {
display: block;
word-wrap: break-word;
opacity: 0;
- &.in { opacity: $tooltip-opacity; }
+ &.active { opacity: $tooltip-opacity; }
&.tooltip-top,
&.bs-tether-element-attached-bottom {