mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-19 20:02:34 +02:00
add build tool for js + rename twipsy to tooltip + lots of little doc cleanup
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
<script src="../../js/bootstrap-modal.js"></script>
|
||||
<script src="../../js/bootstrap-scrollspy.js"></script>
|
||||
<script src="../../js/bootstrap-tab.js"></script>
|
||||
<script src="../../js/bootstrap-twipsy.js"></script>
|
||||
<script src="../../js/bootstrap-tooltip.js"></script>
|
||||
<script src="../../js/bootstrap-popover.js"></script>
|
||||
<script src="../../js/bootstrap-typeahead.js"></script>
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<script src="unit/bootstrap-modal.js"></script>
|
||||
<script src="unit/bootstrap-scrollspy.js"></script>
|
||||
<script src="unit/bootstrap-tab.js"></script>
|
||||
<script src="unit/bootstrap-twipsy.js"></script>
|
||||
<script src="unit/bootstrap-tooltip.js"></script>
|
||||
<script src="unit/bootstrap-popover.js"></script>
|
||||
<script src="unit/bootstrap-typeahead.js"></script>
|
||||
|
||||
|
48
js/tests/unit/bootstrap-twipsy.js
vendored
48
js/tests/unit/bootstrap-twipsy.js
vendored
@@ -1,62 +1,62 @@
|
||||
$(function () {
|
||||
|
||||
module("bootstrap-twipsy")
|
||||
module("bootstrap-tooltip")
|
||||
|
||||
test("should be defined on jquery object", function () {
|
||||
var div = $("<div></div>")
|
||||
ok(div.twipsy, 'popover method is defined')
|
||||
ok(div.tooltip, 'popover method is defined')
|
||||
})
|
||||
|
||||
test("should return element", function () {
|
||||
var div = $("<div></div>")
|
||||
ok(div.twipsy() == div, 'document.body returned')
|
||||
ok(div.tooltip() == div, 'document.body returned')
|
||||
})
|
||||
|
||||
test("should expose default settings", function () {
|
||||
ok(!!$.fn.twipsy.defaults, 'defaults is defined')
|
||||
ok(!!$.fn.tooltip.defaults, 'defaults is defined')
|
||||
})
|
||||
|
||||
test("should remove title attribute", function () {
|
||||
var twipsy = $('<a href="#" rel="twipsy" title="Another twipsy"></a>').twipsy()
|
||||
ok(!twipsy.attr('title'), 'title tag was removed')
|
||||
var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>').tooltip()
|
||||
ok(!tooltip.attr('title'), 'title tag was removed')
|
||||
})
|
||||
|
||||
test("should add data attribute for referencing original title", function () {
|
||||
var twipsy = $('<a href="#" rel="twipsy" title="Another twipsy"></a>').twipsy()
|
||||
equals(twipsy.attr('data-original-title'), 'Another twipsy', 'original title preserved in data attribute')
|
||||
var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>').tooltip()
|
||||
equals(tooltip.attr('data-original-title'), 'Another tooltip', 'original title preserved in data attribute')
|
||||
})
|
||||
|
||||
test("should place tooltips relative to placement option", function () {
|
||||
$.support.transition = false
|
||||
var twipsy = $('<a href="#" rel="twipsy" title="Another twipsy"></a>')
|
||||
var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.twipsy({placement: 'bottom'})
|
||||
.twipsy('show')
|
||||
.tooltip({placement: 'bottom'})
|
||||
.tooltip('show')
|
||||
|
||||
ok($(".twipsy").hasClass('fade bottom in'), 'has correct classes applied')
|
||||
twipsy.twipsy('hide')
|
||||
ok($(".tooltip").hasClass('fade bottom in'), 'has correct classes applied')
|
||||
tooltip.tooltip('hide')
|
||||
})
|
||||
|
||||
test("should always allow html entities", function () {
|
||||
$.support.transition = false
|
||||
var twipsy = $('<a href="#" rel="twipsy" title="<b>@fat</b>"></a>')
|
||||
var tooltip = $('<a href="#" rel="tooltip" title="<b>@fat</b>"></a>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.twipsy('show')
|
||||
.tooltip('show')
|
||||
|
||||
ok($('.twipsy b').length, 'b tag was inserted')
|
||||
twipsy.twipsy('hide')
|
||||
ok(!$(".twipsy").length, 'twipsy removed')
|
||||
ok($('.tooltip b').length, 'b tag was inserted')
|
||||
tooltip.tooltip('hide')
|
||||
ok(!$(".tooltip").length, 'tooltip removed')
|
||||
})
|
||||
|
||||
test("should respect custom classes", function () {
|
||||
var twipsy = $('<a href="#" rel="twipsy" title="Another twipsy"></a>')
|
||||
var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.twipsy({ template: '<div class="twipsy some-class"><div class="twipsy-arrow"/><div class="twipsy-inner"/></div>'})
|
||||
.twipsy('show')
|
||||
.tooltip({ template: '<div class="tooltip some-class"><div class="tooltip-arrow"/><div class="tooltip-inner"/></div>'})
|
||||
.tooltip('show')
|
||||
|
||||
ok($('.twipsy').hasClass('some-class'), 'custom class is present')
|
||||
twipsy.twipsy('hide')
|
||||
ok(!$(".twipsy").length, 'twipsy removed')
|
||||
ok($('.tooltip').hasClass('some-class'), 'custom class is present')
|
||||
tooltip.tooltip('hide')
|
||||
ok(!$(".tooltip").length, 'tooltip removed')
|
||||
})
|
||||
|
||||
})
|
Reference in New Issue
Block a user