mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-28 23:59:53 +02:00
popover passing as well
This commit is contained in:
@@ -141,11 +141,9 @@
|
||||
<script src="../../js/dist/scrollspy.js"></script>
|
||||
<script src="../../js/dist/tab.js"></script>
|
||||
<script src="../../js/dist/tooltip.js"></script>
|
||||
<script src="../../js/dist/popover.js"></script>
|
||||
|
||||
<!-- Old Plugin sources -->
|
||||
<!-- <script src="../../js/popover.js"></script> -->
|
||||
|
||||
<!-- Unit tests
|
||||
<!-- Unit tests -->
|
||||
<script src="unit/alert.js"></script>
|
||||
<script src="unit/button.js"></script>
|
||||
<script src="unit/carousel.js"></script>
|
||||
@@ -153,9 +151,9 @@
|
||||
<script src="unit/dropdown.js"></script>
|
||||
<script src="unit/modal.js"></script>
|
||||
<script src="unit/scrollspy.js"></script>
|
||||
<script src="unit/tab.js"></script> -->
|
||||
<script src="unit/tab.js"></script>
|
||||
<script src="unit/tooltip.js"></script>
|
||||
<!-- <script src="unit/popover.js"></script> -->
|
||||
<script src="unit/popover.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
@@ -16,6 +16,7 @@ $(function () {
|
||||
afterEach: function () {
|
||||
$.fn.popover = $.fn.bootstrapPopover
|
||||
delete $.fn.bootstrapPopover
|
||||
$('.popover').remove()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -81,6 +82,7 @@ $(function () {
|
||||
assert.strictEqual($('.popover .popover-content').text(), 'loves writing tests (╯°□°)╯︵ ┻━┻', 'content correctly inserted')
|
||||
|
||||
$popover.bootstrapPopover('hide')
|
||||
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
})
|
||||
|
||||
@@ -91,6 +93,7 @@ $(function () {
|
||||
var $popover = $('<a href="#">@fat</a>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapPopover({
|
||||
html: true,
|
||||
content: function () {
|
||||
return $div
|
||||
}
|
||||
@@ -98,14 +101,14 @@ $(function () {
|
||||
|
||||
$popover.bootstrapPopover('show')
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.equal($('.popover .popover-content').html(), $div, 'content correctly inserted')
|
||||
assert.equal($('.popover .popover-content').html(), $div[0].outerHTML, 'content correctly inserted')
|
||||
|
||||
$popover.bootstrapPopover('hide')
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
|
||||
$popover.bootstrapPopover('show')
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.equal($('.popover .popover-content').html(), $div, 'content correctly inserted')
|
||||
assert.equal($('.popover .popover-content').html(), $div[0].outerHTML, 'content correctly inserted')
|
||||
|
||||
$popover.bootstrapPopover('hide')
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
@@ -126,7 +129,6 @@ $(function () {
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
})
|
||||
|
||||
|
||||
QUnit.test('should get title and content from attributes ignoring options passed via js', function (assert) {
|
||||
assert.expect(4)
|
||||
var $popover = $('<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>')
|
||||
@@ -240,13 +242,6 @@ $(function () {
|
||||
.bootstrapPopover('show')
|
||||
})
|
||||
|
||||
QUnit.test('should throw an error when initializing popover on the document object without specifying a delegation selector', function (assert) {
|
||||
assert.expect(1)
|
||||
assert.throws(function () {
|
||||
$(document).bootstrapPopover({ title: 'What am I on?', content: 'My selector is missing' })
|
||||
}, new Error('`selector` option must be specified when initializing popover on the window.document object!'))
|
||||
})
|
||||
|
||||
QUnit.test('should do nothing when an attempt is made to hide an uninitialized popover', function (assert) {
|
||||
assert.expect(1)
|
||||
|
||||
@@ -259,16 +254,6 @@ $(function () {
|
||||
assert.strictEqual($popover.data('bs.popover'), undefined, 'should not initialize the popover')
|
||||
})
|
||||
|
||||
QUnit.test('should throw an error when template contains multiple top-level elements', function (assert) {
|
||||
assert.expect(1)
|
||||
assert.throws(function () {
|
||||
$('<span data-toggle="popover" data-title="some title" data-content="some content">some text</span>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapPopover({ template: '<div>Foo</div><div>Bar</div>' })
|
||||
.bootstrapPopover('show')
|
||||
}, new Error('popover `template` option must consist of exactly 1 top-level element!'))
|
||||
})
|
||||
|
||||
QUnit.test('should fire inserted event', function (assert) {
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
|
@@ -89,11 +89,11 @@ $(function () {
|
||||
assert.strictEqual(id.indexOf('tooltip'), 0, 'tooltip id has prefix')
|
||||
})
|
||||
|
||||
QUnit.test('should place tooltips relative to attachment option', function (assert) {
|
||||
QUnit.test('should place tooltips relative to placement option', function (assert) {
|
||||
assert.expect(2)
|
||||
var $tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapTooltip({ attachment: 'bottom' })
|
||||
.bootstrapTooltip({ placement: 'bottom' })
|
||||
|
||||
$tooltip.bootstrapTooltip('show')
|
||||
|
||||
@@ -321,7 +321,7 @@ $(function () {
|
||||
var $target = $('<a href="#" rel="tooltip" title="very very very very very very very very long tooltip in one line"/>')
|
||||
.appendTo($container)
|
||||
.bootstrapTooltip({
|
||||
attachment: 'right',
|
||||
placement: 'right',
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
|
||||
@@ -389,7 +389,7 @@ $(function () {
|
||||
.one('show.bs.tooltip', function () {
|
||||
$(this).remove()
|
||||
})
|
||||
.bootstrapTooltip({ attachment: 'top' })
|
||||
.bootstrapTooltip({ placement: 'top' })
|
||||
|
||||
try {
|
||||
$tooltip.bootstrapTooltip('show')
|
||||
@@ -426,7 +426,7 @@ $(function () {
|
||||
.find('a')
|
||||
.css('margin-top', 200)
|
||||
.bootstrapTooltip({
|
||||
attachment: 'top',
|
||||
placement: 'top',
|
||||
animate: false
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
@@ -609,7 +609,7 @@ $(function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip({ attachment: 'top', trigger: 'manual' })
|
||||
.bootstrapTooltip({ placement: 'top', trigger: 'manual' })
|
||||
|
||||
$circle.bootstrapTooltip('show')
|
||||
})
|
||||
@@ -621,7 +621,7 @@ $(function () {
|
||||
return '<p id="tt-content">' + uid + '</p><p>' + uid + '</p><p>' + uid + '</p>'
|
||||
}
|
||||
|
||||
var $tooltip = $('<span id="tt-outer" rel="tooltip" data-trigger="hover" data-attachment="top">some text</span>')
|
||||
var $tooltip = $('<span id="tt-outer" rel="tooltip" data-trigger="hover" data-placement="top">some text</span>')
|
||||
.appendTo('#qunit-fixture')
|
||||
|
||||
$tooltip.bootstrapTooltip({
|
||||
@@ -649,7 +649,7 @@ $(function () {
|
||||
return '<p id="tt-content">' + uid + '</p><p>' + uid + '</p><p>' + uid + '</p>'
|
||||
}
|
||||
|
||||
var $tooltip = $('<span id="tt-outer" rel="tooltip" data-trigger="hover" data-attachment="top">some text</span>')
|
||||
var $tooltip = $('<span id="tt-outer" rel="tooltip" data-trigger="hover" data-placement="top">some text</span>')
|
||||
.appendTo('#qunit-fixture')
|
||||
|
||||
$tooltip.bootstrapTooltip({
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Popover</title>
|
||||
<link rel="stylesheet" href="../../../dist/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="../../../dist/css/bootstrap.css">
|
||||
|
||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
@@ -39,9 +39,11 @@
|
||||
|
||||
<!-- JavaScript Includes -->
|
||||
<script src="../vendor/jquery.min.js"></script>
|
||||
<script src="../../transition.js"></script>
|
||||
<script src="../../tooltip.js"></script>
|
||||
<script src="../../popover.js"></script>
|
||||
<script src="../vendor/tether.min.js"></script>
|
||||
<script src="../../dist/util.js"></script>
|
||||
<script src="../../dist/tooltip.js"></script>
|
||||
<script src="../../dist/popover.js"></script>
|
||||
|
||||
|
||||
<!-- JavaScript Test -->
|
||||
<script>
|
||||
|
Reference in New Issue
Block a user