mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-06-08 17:22:31 +03:00
fix(event-handler): remove the use of our event handler in unit test
This commit is contained in:
+22
-22
@@ -583,7 +583,7 @@ $(function () {
|
||||
done()
|
||||
}, 200)
|
||||
|
||||
EventHandler.trigger($tooltip[0], 'mouseover')
|
||||
$tooltip[0].dispatchEvent(new Event('mouseover'))
|
||||
})
|
||||
|
||||
QUnit.test('should not show tooltip if leave event occurs before delay expires', function (assert) {
|
||||
@@ -598,7 +598,7 @@ $(function () {
|
||||
|
||||
setTimeout(function () {
|
||||
assert.ok(!$('.tooltip').is('.fade.show'), '100ms: tooltip not faded active')
|
||||
EventHandler.trigger($tooltip[0], 'mouseout')
|
||||
$tooltip[0].dispatchEvent(new Event('mouseout'))
|
||||
}, 100)
|
||||
|
||||
setTimeout(function () {
|
||||
@@ -606,7 +606,7 @@ $(function () {
|
||||
done()
|
||||
}, 200)
|
||||
|
||||
EventHandler.trigger($tooltip[0], 'mouseover')
|
||||
$tooltip[0].dispatchEvent(new Event('mouseover'))
|
||||
})
|
||||
|
||||
QUnit.test('should not hide tooltip if leave event occurs and enter event occurs within the hide delay', function (assert) {
|
||||
@@ -624,11 +624,11 @@ $(function () {
|
||||
|
||||
setTimeout(function () {
|
||||
assert.ok($('.tooltip').is('.fade.show'), '1ms: tooltip faded active')
|
||||
EventHandler.trigger($tooltip[0], 'mouseout')
|
||||
$tooltip[0].dispatchEvent(new Event('mouseout'))
|
||||
|
||||
setTimeout(function () {
|
||||
assert.ok($('.tooltip').is('.fade.show'), '100ms: tooltip still faded active')
|
||||
EventHandler.trigger($tooltip[0], 'mouseover')
|
||||
$tooltip[0].dispatchEvent(new Event('mouseover'))
|
||||
}, 100)
|
||||
|
||||
setTimeout(function () {
|
||||
@@ -637,7 +637,7 @@ $(function () {
|
||||
}, 200)
|
||||
}, 0)
|
||||
|
||||
EventHandler.trigger($tooltip[0], 'mouseover')
|
||||
$tooltip[0].dispatchEvent(new Event('mouseover'))
|
||||
})
|
||||
|
||||
QUnit.test('should not show tooltip if leave event occurs before delay expires', function (assert) {
|
||||
@@ -652,7 +652,7 @@ $(function () {
|
||||
|
||||
setTimeout(function () {
|
||||
assert.ok(!$('.tooltip').is('.fade.show'), '100ms: tooltip not faded active')
|
||||
EventHandler.trigger($tooltip[0], 'mouseout')
|
||||
$tooltip[0].dispatchEvent(new Event('mouseout'))
|
||||
}, 100)
|
||||
|
||||
setTimeout(function () {
|
||||
@@ -660,7 +660,7 @@ $(function () {
|
||||
done()
|
||||
}, 200)
|
||||
|
||||
EventHandler.trigger($tooltip[0], 'mouseover')
|
||||
$tooltip[0].dispatchEvent(new Event('mouseover'))
|
||||
})
|
||||
|
||||
QUnit.test('should not show tooltip if leave event occurs before delay expires, even if hide delay is 0', function (assert) {
|
||||
@@ -678,7 +678,7 @@ $(function () {
|
||||
|
||||
setTimeout(function () {
|
||||
assert.ok(!$('.tooltip').is('.fade.show'), '100ms: tooltip not faded active')
|
||||
EventHandler.trigger($tooltip[0], 'mouseout')
|
||||
$tooltip[0].dispatchEvent(new Event('mouseout'))
|
||||
}, 100)
|
||||
|
||||
setTimeout(function () {
|
||||
@@ -686,7 +686,7 @@ $(function () {
|
||||
done()
|
||||
}, 250)
|
||||
|
||||
EventHandler.trigger($tooltip[0], 'mouseover')
|
||||
$tooltip[0].dispatchEvent(new Event('mouseover'))
|
||||
})
|
||||
|
||||
QUnit.test('should wait 200ms before hiding the tooltip', function (assert) {
|
||||
@@ -705,7 +705,7 @@ $(function () {
|
||||
setTimeout(function () {
|
||||
assert.ok($(Tooltip._getInstance($tooltip[0]).tip).is('.fade.show'), '1ms: tooltip faded active')
|
||||
|
||||
EventHandler.trigger($tooltip[0], 'mouseout')
|
||||
$tooltip[0].dispatchEvent(new Event('mouseout'))
|
||||
|
||||
setTimeout(function () {
|
||||
assert.ok($(Tooltip._getInstance($tooltip[0]).tip).is('.fade.show'), '100ms: tooltip still faded active')
|
||||
@@ -717,7 +717,7 @@ $(function () {
|
||||
}, 200)
|
||||
}, 0)
|
||||
|
||||
EventHandler.trigger($tooltip[0], 'mouseover')
|
||||
$tooltip[0].dispatchEvent(new Event('mouseover'))
|
||||
})
|
||||
|
||||
QUnit.test('should not reload the tooltip on subsequent mouseenter events', function (assert) {
|
||||
@@ -742,11 +742,11 @@ $(function () {
|
||||
title: titleHtml
|
||||
})
|
||||
|
||||
EventHandler.trigger($('#tt-outer')[0], 'mouseover')
|
||||
$('#tt-outer')[0].dispatchEvent(new Event('mouseover'))
|
||||
|
||||
var currentUid = $('#tt-content').text()
|
||||
|
||||
EventHandler.trigger($('#tt-outer')[0], 'mouseover')
|
||||
$('#tt-outer')[0].dispatchEvent(new Event('mouseover'))
|
||||
assert.strictEqual(currentUid, $('#tt-content').text())
|
||||
})
|
||||
|
||||
@@ -774,16 +774,16 @@ $(function () {
|
||||
|
||||
var obj = Tooltip._getInstance($tooltip[0])
|
||||
|
||||
EventHandler.trigger($('#tt-outer')[0], 'mouseover')
|
||||
$('#tt-outer')[0].dispatchEvent(new Event('mouseover'))
|
||||
|
||||
var currentUid = $('#tt-content').text()
|
||||
|
||||
EventHandler.trigger($('#tt-outer')[0], 'mouseout')
|
||||
$('#tt-outer')[0].dispatchEvent(new Event('mouseout'))
|
||||
assert.strictEqual(currentUid, $('#tt-content').text())
|
||||
|
||||
assert.ok(obj._hoverState === 'out', 'the tooltip hoverState should be set to "out"')
|
||||
|
||||
EventHandler.trigger($('#tt-outer')[0], 'mouseover')
|
||||
$('#tt-outer')[0].dispatchEvent(new Event('mouseover'))
|
||||
assert.ok(obj._hoverState === 'show', 'the tooltip hoverState should be set to "show"')
|
||||
|
||||
assert.strictEqual(currentUid, $('#tt-content').text())
|
||||
@@ -839,7 +839,7 @@ $(function () {
|
||||
|
||||
$.each(tests, function (idx, triggers) {
|
||||
for (var i = 0, len = triggers.length; i < len; i++) {
|
||||
EventHandler.trigger($el[0], triggers[i])
|
||||
$el[0].dispatchEvent(new Event(triggers[i]))
|
||||
assert.equal(i < len - 1, showingTooltip())
|
||||
}
|
||||
})
|
||||
@@ -861,13 +861,13 @@ $(function () {
|
||||
return $tooltip.hasClass('show') || tooltip._hoverState === 'show'
|
||||
}
|
||||
|
||||
EventHandler.trigger($el[0], 'click')
|
||||
$el[0].click()
|
||||
assert.ok(showingTooltip(), 'tooltip is faded in')
|
||||
|
||||
$el.bootstrapTooltip('hide')
|
||||
assert.ok(!showingTooltip(), 'tooltip was faded out')
|
||||
|
||||
EventHandler.trigger($el[0], 'click')
|
||||
$el[0].click()
|
||||
assert.ok(showingTooltip(), 'tooltip is faded in again')
|
||||
})
|
||||
|
||||
@@ -987,11 +987,11 @@ $(function () {
|
||||
})
|
||||
|
||||
$trigger.bootstrapTooltip('disable')
|
||||
EventHandler.trigger($trigger[0], 'click')
|
||||
$trigger[0].click()
|
||||
setTimeout(function () {
|
||||
assert.strictEqual($('.tooltip').length === 0, true)
|
||||
$trigger.bootstrapTooltip('enable')
|
||||
EventHandler.trigger($trigger[0], 'click')
|
||||
$trigger[0].click()
|
||||
}, 200)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user