aboutsummaryrefslogtreecommitdiff
path: root/js/tests
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2014-03-09 22:01:38 -0700
committerMark Otto <[email protected]>2014-03-09 22:01:38 -0700
commitccb17f110de8e90773a6ebfda9e35306d625dc78 (patch)
treead1bc7e6bc41eb9805b6a2531c5c37df7a92cb87 /js/tests
parentbdd7651e323a93a4e3d207463451dd374b0a70fa (diff)
parentb1f71e5292017aca978fabb74d256989e1eeea07 (diff)
downloadbootstrap-ccb17f110de8e90773a6ebfda9e35306d625dc78.tar.xz
bootstrap-ccb17f110de8e90773a6ebfda9e35306d625dc78.zip
Merge branch 'master' into fix-8869
Diffstat (limited to 'js/tests')
-rw-r--r--js/tests/index.html28
-rw-r--r--js/tests/unit/tooltip.js25
2 files changed, 38 insertions, 15 deletions
diff --git a/js/tests/index.html b/js/tests/index.html
index 60f543abf..c6d3d27af 100644
--- a/js/tests/index.html
+++ b/js/tests/index.html
@@ -11,8 +11,32 @@
<script src="vendor/qunit.js"></script>
<script>
// See https://github.com/axemclion/grunt-saucelabs#test-result-details-with-qunit
- QUnit.done(function (results) {
- window.global_test_results = results
+ var log = []
+ QUnit.done = function (test_results) {
+ var tests = log.map(function (details) {
+ return {
+ name: details.name,
+ result: details.result,
+ expected: details.expected,
+ actual: details.actual,
+ source: details.source
+ }
+ })
+ test_results.tests = tests
+
+ // Delaying results a bit because in real-world scenario you won't get them immediately
+ setTimeout(function () {
+ window.global_test_results = test_results
+ }, 2000)
+ }
+
+ QUnit.testStart(function (testDetails) {
+ QUnit.log = function (details) {
+ if (!details.result) {
+ details.name = testDetails.name
+ log.push(details)
+ }
+ }
})
</script>
diff --git a/js/tests/unit/tooltip.js b/js/tests/unit/tooltip.js
index c3af7d82e..9df234236 100644
--- a/js/tests/unit/tooltip.js
+++ b/js/tests/unit/tooltip.js
@@ -273,8 +273,7 @@ $(function () {
test('should show tooltip with delegate selector on click', function () {
var div = $('<div><a href="#" rel="tooltip" title="Another tooltip"></a></div>')
var tooltip = div.appendTo('#qunit-fixture')
- .tooltip({ selector: 'a[rel=tooltip]',
- trigger: 'click' })
+ .tooltip({ selector: 'a[rel=tooltip]', trigger: 'click' })
div.find('a').trigger('click')
ok($('.tooltip').is('.fade.in'), 'tooltip is faded in')
})
@@ -392,21 +391,21 @@ $(function () {
test('tooltips should be placed dynamically, with the dynamic placement option', function () {
$.support.transition = false
var ttContainer = $('<div id="dynamic-tt-test"/>').css({
- 'height' : 400,
- 'overflow' : 'hidden',
- 'position' : 'absolute',
- 'top' : 0,
- 'left' : 0,
- 'width' : 600
- })
- .appendTo('body')
+ height : 400,
+ overflow : 'hidden',
+ position : 'absolute',
+ top : 0,
+ left : 0,
+ width : 600
+ })
+ .appendTo('body')
var topTooltip = $('<div style="display: inline-block; position: absolute; left: 0; top: 0;" rel="tooltip" title="Top tooltip">Top Dynamic Tooltip</div>')
.appendTo('#dynamic-tt-test')
.tooltip({placement: 'auto'})
.tooltip('show')
- ok($('.tooltip').is('.bottom'), 'top positioned tooltip is dynamically positioned bottom')
+ ok($('.tooltip').is('.bottom'), 'top positioned tooltip is dynamically positioned bottom')
topTooltip.tooltip('hide')
@@ -415,7 +414,7 @@ $(function () {
.tooltip({placement: 'right auto'})
.tooltip('show')
- ok($('.tooltip').is('.left'), 'right positioned tooltip is dynamically positioned left')
+ ok($('.tooltip').is('.left'), 'right positioned tooltip is dynamically positioned left')
rightTooltip.tooltip('hide')
var leftTooltip = $('<div style="display: inline-block; position: absolute; left: 0;" rel="tooltip" title="Left tooltip">Left Dynamic Tooltip</div>')
@@ -423,7 +422,7 @@ $(function () {
.tooltip({placement: 'auto left'})
.tooltip('show')
- ok($('.tooltip').is('.right'), 'left positioned tooltip is dynamically positioned right')
+ ok($('.tooltip').is('.right'), 'left positioned tooltip is dynamically positioned right')
leftTooltip.tooltip('hide')
ttContainer.remove()