1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00

new qunit

This commit is contained in:
fat 2014-01-16 13:33:09 -08:00
parent bc074d5488
commit 2f76821a4d
9 changed files with 1804 additions and 1139 deletions

View file

@ -127,6 +127,7 @@
var data = $this.data('bs.collapse') var data = $this.data('bs.collapse')
var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
if (!data && options.toggle && option == 'show') option = !option
if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
if (typeof option == 'string') data[option]() if (typeof option == 'string') data[option]()
}) })

View file

@ -17,7 +17,7 @@
</script> </script>
<!-- plugin sources --> <!-- plugin sources -->
<script src="../../js/transition.js"></script> <script>$.support.transition = false</script>
<script src="../../js/alert.js"></script> <script src="../../js/alert.js"></script>
<script src="../../js/button.js"></script> <script src="../../js/button.js"></script>
<script src="../../js/carousel.js"></script> <script src="../../js/carousel.js"></script>
@ -47,10 +47,7 @@
</head> </head>
<body> <body>
<div> <div>
<h1 id="qunit-header">Bootstrap Plugin Test Suite</h1> <div id="qunit"></div>
<h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture"></div> <div id="qunit-fixture"></div>
</div> </div>
</body> </body>

View file

@ -157,16 +157,15 @@ $(function () {
test('should trigger hide event once when clicking outside of modal-content', function () { test('should trigger hide event once when clicking outside of modal-content', function () {
stop() stop()
$.support.transition = false $.support.transition = false
var div = $('<div id="modal-test"><div class="contents"></div></div>')
var triggered var triggered
var div = $('<div id="modal-test"><div class="contents"></div></div>')
div div
.bind('shown.bs.modal', function () { .bind('shown.bs.modal', function () {
triggered = 0 triggered = 0
$('#modal-test').click() $('#modal-test').click()
}) })
.one('hidden.bs.modal', function () {
div.modal('show')
})
.bind('hide.bs.modal', function () { .bind('hide.bs.modal', function () {
triggered += 1 triggered += 1
ok(triggered === 1, 'modal hide triggered once') ok(triggered === 1, 'modal hide triggered once')

View file

@ -73,11 +73,14 @@ $(function () {
'</ul>' '</ul>'
$(dropHTML).find('ul>li:first a').tab('show').end() $(dropHTML).find('ul>li:first a').tab('show').end()
.find('ul>li:last a').on('show', function (event) { .find('ul>li:last a')
.on('show.bs.tab', function (event) {
equal(event.relatedTarget.hash, '#1-1') equal(event.relatedTarget.hash, '#1-1')
}).on('shown', function (event) { })
.on('show.bs.tab', function (event) {
equal(event.relatedTarget.hash, '#1-1') equal(event.relatedTarget.hash, '#1-1')
}).tab('show') })
.tab('show')
}) })
}) })

View file

@ -387,6 +387,8 @@ $(function () {
}) })
test('tooltips should be placed dynamically, with the dynamic placement option', function () { test('tooltips should be placed dynamically, with the dynamic placement option', function () {
$(document.body).scrollTop(0) // force to top of page
$.support.transition = false $.support.transition = false
var ttContainer = $('<div id="dynamic-tt-test"/>').css({ var ttContainer = $('<div id="dynamic-tt-test"/>').css({
'height' : 400, 'height' : 400,
@ -402,7 +404,6 @@ $(function () {
.tooltip({placement: 'auto'}) .tooltip({placement: 'auto'})
.tooltip('show') .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') topTooltip.tooltip('hide')

View file

@ -1,13 +0,0 @@
$(function () {
module('transition')
test('should be defined on jquery support object', function () {
ok($.support.transition !== undefined, 'transition object is defined')
})
test('should provide an end object', function () {
ok($.support.transition ? $.support.transition.end : true, 'end string is defined')
})
})

View file

@ -1,11 +1,12 @@
/** /*!
* QUnit 1.0.0 - A JavaScript Unit Testing Framework * QUnit 1.13.0
* http://qunitjs.com/
* *
* http://docs.jquery.com/QUnit * Copyright 2013 jQuery Foundation and other contributors
* Released under the MIT license
* http://jquery.org/license
* *
* Copyright (c) 2011 John Resig, Jörn Zaefferer * Date: 2014-01-04T17:09Z
* Dual licensed under the MIT (MIT-LICENSE.txt)
* or GPL (GPL-LICENSE.txt) licenses.
*/ */
/** Font Family and Sizes */ /** Font Family and Sizes */
@ -20,7 +21,7 @@
/** Resets */ /** Resets */
#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult { #qunit-tests, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter {
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
@ -38,10 +39,10 @@
line-height: 1em; line-height: 1em;
font-weight: normal; font-weight: normal;
border-radius: 15px 15px 0 0; border-radius: 5px 5px 0 0;
-moz-border-radius: 15px 15px 0 0; -moz-border-radius: 5px 5px 0 0;
-webkit-border-top-right-radius: 15px; -webkit-border-top-right-radius: 5px;
-webkit-border-top-left-radius: 15px; -webkit-border-top-left-radius: 5px;
} }
#qunit-header a { #qunit-header a {
@ -54,6 +55,11 @@
color: #fff; color: #fff;
} }
#qunit-testrunner-toolbar label {
display: inline-block;
padding: 0 .5em 0 .1em;
}
#qunit-banner { #qunit-banner {
height: 5px; height: 5px;
} }
@ -62,6 +68,7 @@
padding: 0.5em 0 0.5em 2em; padding: 0.5em 0 0.5em 2em;
color: #5E740B; color: #5E740B;
background-color: #eee; background-color: #eee;
overflow: hidden;
} }
#qunit-userAgent { #qunit-userAgent {
@ -71,6 +78,9 @@
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px; text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
} }
#qunit-modulefilter-container {
float: right;
}
/** Tests: Pass/Fail */ /** Tests: Pass/Fail */
@ -102,19 +112,24 @@
color: #000; color: #000;
} }
#qunit-tests ol { #qunit-tests li .runtime {
float: right;
font-size: smaller;
}
.qunit-assert-list {
margin-top: 0.5em; margin-top: 0.5em;
padding: 0.5em; padding: 0.5em;
background-color: #fff; background-color: #fff;
border-radius: 15px; border-radius: 5px;
-moz-border-radius: 15px; -moz-border-radius: 5px;
-webkit-border-radius: 15px; -webkit-border-radius: 5px;
}
box-shadow: inset 0px 2px 13px #999; .qunit-collapsed {
-moz-box-shadow: inset 0px 2px 13px #999; display: none;
-webkit-box-shadow: inset 0px 2px 13px #999;
} }
#qunit-tests table { #qunit-tests table {
@ -157,8 +172,7 @@
#qunit-tests b.failed { color: #710909; } #qunit-tests b.failed { color: #710909; }
#qunit-tests li li { #qunit-tests li li {
margin: 0.5em; padding: 5px;
padding: 0.4em 0.5em 0.4em 0.5em;
background-color: #fff; background-color: #fff;
border-bottom: none; border-bottom: none;
list-style-position: inside; list-style-position: inside;
@ -167,9 +181,9 @@
/*** Passing Styles */ /*** Passing Styles */
#qunit-tests li li.pass { #qunit-tests li li.pass {
color: #5E740B; color: #3c510c;
background-color: #fff; background-color: #fff;
border-left: 26px solid #C6E746; border-left: 10px solid #C6E746;
} }
#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; } #qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
@ -185,15 +199,15 @@
#qunit-tests li li.fail { #qunit-tests li li.fail {
color: #710909; color: #710909;
background-color: #fff; background-color: #fff;
border-left: 26px solid #EE5757; border-left: 10px solid #EE5757;
white-space: pre; white-space: pre;
} }
#qunit-tests > li:last-child { #qunit-tests > li:last-child {
border-radius: 0 0 15px 15px; border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 15px 15px; -moz-border-radius: 0 0 5px 5px;
-webkit-border-bottom-right-radius: 15px; -webkit-border-bottom-right-radius: 5px;
-webkit-border-bottom-left-radius: 15px; -webkit-border-bottom-left-radius: 5px;
} }
#qunit-tests .fail { color: #000000; background-color: #EE5757; } #qunit-tests .fail { color: #000000; background-color: #EE5757; }
@ -216,6 +230,9 @@
border-bottom: 1px solid white; border-bottom: 1px solid white;
} }
#qunit-testresult .module-name {
font-weight: bold;
}
/** Fixture */ /** Fixture */
@ -223,4 +240,6 @@
position: absolute; position: absolute;
top: -10000px; top: -10000px;
left: -10000px; left: -10000px;
width: 1000px;
height: 1000px;
} }

2764
js/tests/vendor/qunit.js vendored

File diff suppressed because it is too large Load diff