Commit eca8ff38 authored by XhmikosR's avatar XhmikosR

Use single quotes consistently.

parent ed63dfd8
/* jshint node: true */ /* jshint node: true */
module.exports = function (grunt) { module.exports = function (grunt) {
"use strict"; 'use strict';
// Force use of Unix newlines // Force use of Unix newlines
grunt.util.linefeed = '\n'; grunt.util.linefeed = '\n';
...@@ -135,7 +135,7 @@ module.exports = function (grunt) { ...@@ -135,7 +135,7 @@ module.exports = function (grunt) {
copy: { copy: {
fonts: { fonts: {
expand: true, expand: true,
src: ["fonts/*"], src: ['fonts/*'],
dest: 'dist/' dest: 'dist/'
} }
}, },
...@@ -164,12 +164,12 @@ module.exports = function (grunt) { ...@@ -164,12 +164,12 @@ module.exports = function (grunt) {
options: { options: {
reset: true, reset: true,
relaxerror: [ relaxerror: [
"Bad value X-UA-Compatible for attribute http-equiv on element meta.", 'Bad value X-UA-Compatible for attribute http-equiv on element meta.',
"Element img is missing required attribute src." 'Element img is missing required attribute src.'
] ]
}, },
files: { files: {
src: ["_gh_pages/**/*.html"] src: ['_gh_pages/**/*.html']
} }
}, },
......
...@@ -26,7 +26,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" ...@@ -26,7 +26,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery"
* ======================================================================== */ * ======================================================================== */
+function ($) { "use strict"; +function ($) { 'use strict';
// CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
// ============================================================ // ============================================================
...@@ -83,7 +83,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" ...@@ -83,7 +83,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery"
* ======================================================================== */ * ======================================================================== */
+function ($) { "use strict"; +function ($) { 'use strict';
// ALERT CLASS DEFINITION // ALERT CLASS DEFINITION
// ====================== // ======================
...@@ -182,7 +182,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" ...@@ -182,7 +182,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery"
* ======================================================================== */ * ======================================================================== */
+function ($) { "use strict"; +function ($) { 'use strict';
// BUTTON PUBLIC CLASS DEFINITION // BUTTON PUBLIC CLASS DEFINITION
// ============================== // ==============================
...@@ -298,7 +298,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" ...@@ -298,7 +298,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery"
* ======================================================================== */ * ======================================================================== */
+function ($) { "use strict"; +function ($) { 'use strict';
// CAROUSEL CLASS DEFINITION // CAROUSEL CLASS DEFINITION
// ========================= // =========================
...@@ -516,7 +516,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" ...@@ -516,7 +516,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery"
* ======================================================================== */ * ======================================================================== */
+function ($) { "use strict"; +function ($) { 'use strict';
// COLLAPSE PUBLIC CLASS DEFINITION // COLLAPSE PUBLIC CLASS DEFINITION
// ================================ // ================================
...@@ -696,7 +696,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" ...@@ -696,7 +696,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery"
* ======================================================================== */ * ======================================================================== */
+function ($) { "use strict"; +function ($) { 'use strict';
// DROPDOWN CLASS DEFINITION // DROPDOWN CLASS DEFINITION
// ========================= // =========================
...@@ -851,7 +851,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" ...@@ -851,7 +851,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery"
* ======================================================================== */ * ======================================================================== */
+function ($) { "use strict"; +function ($) { 'use strict';
// MODAL CLASS DEFINITION // MODAL CLASS DEFINITION
// ====================== // ======================
...@@ -1099,7 +1099,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" ...@@ -1099,7 +1099,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery"
* ======================================================================== */ * ======================================================================== */
+function ($) { "use strict"; +function ($) { 'use strict';
// TOOLTIP PUBLIC CLASS DEFINITION // TOOLTIP PUBLIC CLASS DEFINITION
// =============================== // ===============================
...@@ -1324,7 +1324,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" ...@@ -1324,7 +1324,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery"
} }
Tooltip.prototype.replaceArrow = function (delta, dimension, position) { Tooltip.prototype.replaceArrow = function (delta, dimension, position) {
this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '') this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + '%') : '')
} }
Tooltip.prototype.setContent = function () { Tooltip.prototype.setContent = function () {
...@@ -1485,7 +1485,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" ...@@ -1485,7 +1485,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery"
* ======================================================================== */ * ======================================================================== */
+function ($) { "use strict"; +function ($) { 'use strict';
// POPOVER PUBLIC CLASS DEFINITION // POPOVER PUBLIC CLASS DEFINITION
// =============================== // ===============================
...@@ -1603,7 +1603,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" ...@@ -1603,7 +1603,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery"
* ======================================================================== */ * ======================================================================== */
+function ($) { "use strict"; +function ($) { 'use strict';
// SCROLLSPY CLASS DEFINITION // SCROLLSPY CLASS DEFINITION
// ========================== // ==========================
...@@ -1762,7 +1762,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" ...@@ -1762,7 +1762,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery"
* ======================================================================== */ * ======================================================================== */
+function ($) { "use strict"; +function ($) { 'use strict';
// TAB CLASS DEFINITION // TAB CLASS DEFINITION
// ==================== // ====================
...@@ -1898,7 +1898,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery" ...@@ -1898,7 +1898,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery"
* ======================================================================== */ * ======================================================================== */
+function ($) { "use strict"; +function ($) { 'use strict';
// AFFIX CLASS DEFINITION // AFFIX CLASS DEFINITION
// ====================== // ======================
......
...@@ -18,13 +18,13 @@ ...@@ -18,13 +18,13 @@
// //
// See Getting Started docs for more information // See Getting Started docs for more information
if (navigator.userAgent.match(/IEMobile\/10\.0/)) { if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
var msViewportStyle = document.createElement("style"); var msViewportStyle = document.createElement('style');
msViewportStyle.appendChild( msViewportStyle.appendChild(
document.createTextNode( document.createTextNode(
"@-ms-viewport{width:auto!important}" '@-ms-viewport{width:auto!important}'
) )
); );
document.getElementsByTagName("head")[0]. document.getElementsByTagName('head')[0].
appendChild(msViewportStyle); appendChild(msViewportStyle);
} }
...@@ -73,20 +73,20 @@ ...@@ -73,20 +73,20 @@
// tooltip demo // tooltip demo
$('.tooltip-demo').tooltip({ $('.tooltip-demo').tooltip({
selector: "[data-toggle=tooltip]", selector: '[data-toggle=tooltip]',
container: "body" container: 'body'
}) })
$('.tooltip-test').tooltip() $('.tooltip-test').tooltip()
$('.popover-test').popover() $('.popover-test').popover()
$('.bs-docs-navbar').tooltip({ $('.bs-docs-navbar').tooltip({
selector: "a[data-toggle=tooltip]", selector: 'a[data-toggle=tooltip]',
container: ".bs-docs-navbar .nav" container: '.bs-docs-navbar .nav'
}) })
// popover demo // popover demo
$("[data-toggle=popover]") $('[data-toggle=popover]')
.popover() .popover()
// button state demo // button state demo
......
...@@ -35,18 +35,18 @@ window.onload = function () { // wait for load in a dumb way because B-0 ...@@ -35,18 +35,18 @@ window.onload = function () { // wait for load in a dumb way because B-0
} }
function getQueryParam(key) { function getQueryParam(key) {
key = key.replace(/[*+?^$.\[\]{}()|\\\/]/g, "\\$&"); // escape RegEx meta chars key = key.replace(/[*+?^$.\[\]{}()|\\\/]/g, '\\$&'); // escape RegEx meta chars
var match = location.search.match(new RegExp("[?&]" + key + "=([^&]+)(&|$)")); var match = location.search.match(new RegExp('[?&]' + key + '=([^&]+)(&|$)'));
return match && decodeURIComponent(match[1].replace(/\+/g, " ")); return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
} }
function createGist(configJson) { function createGist(configJson) {
var data = { var data = {
"description": "Bootstrap Customizer Config", 'description': 'Bootstrap Customizer Config',
"public": true, 'public': true,
"files": { 'files': {
"config.json": { 'config.json': {
"content": configJson 'content': configJson
} }
} }
} }
...@@ -57,7 +57,7 @@ window.onload = function () { // wait for load in a dumb way because B-0 ...@@ -57,7 +57,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
data: JSON.stringify(data) data: JSON.stringify(data)
}) })
.success(function (result) { .success(function (result) {
var origin = window.location.protocol + "//" + window.location.host var origin = window.location.protocol + '//' + window.location.host
history.replaceState(false, document.title, origin + window.location.pathname + '?id=' + result.id) history.replaceState(false, document.title, origin + window.location.pathname + '?id=' + result.id)
}) })
.error(function (err) { .error(function (err) {
...@@ -144,10 +144,10 @@ window.onload = function () { // wait for load in a dumb way because B-0 ...@@ -144,10 +144,10 @@ window.onload = function () { // wait for load in a dumb way because B-0
} }
if (config) { if (config) {
zip.file("config.json", config) zip.file('config.json', config)
} }
var content = zip.generate({ type: "blob" }) var content = zip.generate({ type: 'blob' })
complete(content) complete(content)
} }
...@@ -311,22 +311,22 @@ window.onload = function () { // wait for load in a dumb way because B-0 ...@@ -311,22 +311,22 @@ window.onload = function () { // wait for load in a dumb way because B-0
generateZip(generateCSS(), generateJavascript(), generateFonts(), configJson, function (blob) { generateZip(generateCSS(), generateJavascript(), generateFonts(), configJson, function (blob) {
$compileBtn.removeAttr('disabled') $compileBtn.removeAttr('disabled')
saveAs(blob, "bootstrap.zip") saveAs(blob, 'bootstrap.zip')
createGist(configJson) createGist(configJson)
}) })
}) })
// browser support alerts // browser support alerts
if (!window.URL && navigator.userAgent.toLowerCase().indexOf('safari') != -1) { if (!window.URL && navigator.userAgent.toLowerCase().indexOf('safari') != -1) {
showCallout("Looks like you're using safari, which sadly doesn't have the best support\ showCallout('Looks like you\'re using safari, which sadly doesn\'t have the best support\
for HTML5 blobs. Because of this your file will be downloaded with the name <code>\"untitled\"</code>.\ for HTML5 blobs. Because of this your file will be downloaded with the name <code>"untitled"</code>.\
However, if you check your downloads folder, just rename this <code>\"untitled\"</code> file\ However, if you check your downloads folder, just rename this <code>"untitled"</code> file\
to <code>\"bootstrap.zip\"</code> and you should be good to go!") to <code>"bootstrap.zip"</code> and you should be good to go!')
} else if (!window.URL && !window.webkitURL) { } else if (!window.URL && !window.webkitURL) {
$('.bs-docs-section, .bs-sidebar').css('display', 'none') $('.bs-docs-section, .bs-sidebar').css('display', 'none')
showCallout("Looks like your current browser doesn't support the Bootstrap Customizer. Please take a second\ showCallout('Looks like your current browser doesn\'t support the Bootstrap Customizer. Please take a second\
to <a href=\"https://www.google.com/intl/en/chrome/browser/\"> upgrade to a more modern browser</a>.", true) to <a href="https://www.google.com/intl/en/chrome/browser/"> upgrade to a more modern browser</a>.', true)
} }
parseUrl() parseUrl()
......
...@@ -10,5 +10,6 @@ ...@@ -10,5 +10,6 @@
"expr" : true, "expr" : true,
"laxbreak" : true, "laxbreak" : true,
"laxcomma" : true, "laxcomma" : true,
"quotmark" : "single",
"validthis": true "validthis": true
} }
\ No newline at end of file
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* ======================================================================== */ * ======================================================================== */
+function ($) { "use strict"; +function ($) { 'use strict';
// AFFIX CLASS DEFINITION // AFFIX CLASS DEFINITION
// ====================== // ======================
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* ======================================================================== */ * ======================================================================== */
+function ($) { "use strict"; +function ($) { 'use strict';
// ALERT CLASS DEFINITION // ALERT CLASS DEFINITION
// ====================== // ======================
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* ======================================================================== */ * ======================================================================== */
+function ($) { "use strict"; +function ($) { 'use strict';
// BUTTON PUBLIC CLASS DEFINITION // BUTTON PUBLIC CLASS DEFINITION
// ============================== // ==============================
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* ======================================================================== */ * ======================================================================== */
+function ($) { "use strict"; +function ($) { 'use strict';
// CAROUSEL CLASS DEFINITION // CAROUSEL CLASS DEFINITION
// ========================= // =========================
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* ======================================================================== */ * ======================================================================== */
+function ($) { "use strict"; +function ($) { 'use strict';
// COLLAPSE PUBLIC CLASS DEFINITION // COLLAPSE PUBLIC CLASS DEFINITION
// ================================ // ================================
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* ======================================================================== */ * ======================================================================== */
+function ($) { "use strict"; +function ($) { 'use strict';
// DROPDOWN CLASS DEFINITION // DROPDOWN CLASS DEFINITION
// ========================= // =========================
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* ======================================================================== */ * ======================================================================== */
+function ($) { "use strict"; +function ($) { 'use strict';
// MODAL CLASS DEFINITION // MODAL CLASS DEFINITION
// ====================== // ======================
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* ======================================================================== */ * ======================================================================== */
+function ($) { "use strict"; +function ($) { 'use strict';
// POPOVER PUBLIC CLASS DEFINITION // POPOVER PUBLIC CLASS DEFINITION
// =============================== // ===============================
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* ======================================================================== */ * ======================================================================== */
+function ($) { "use strict"; +function ($) { 'use strict';
// SCROLLSPY CLASS DEFINITION // SCROLLSPY CLASS DEFINITION
// ========================== // ==========================
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* ======================================================================== */ * ======================================================================== */
+function ($) { "use strict"; +function ($) { 'use strict';
// TAB CLASS DEFINITION // TAB CLASS DEFINITION
// ==================== // ====================
......
$(function () { $(function () {
module("affix") module('affix')
test("should provide no conflict", function () { test('should provide no conflict', function () {
var affix = $.fn.affix.noConflict() var affix = $.fn.affix.noConflict()
ok(!$.fn.affix, 'affix was set back to undefined (org value)') ok(!$.fn.affix, 'affix was set back to undefined (org value)')
$.fn.affix = affix $.fn.affix = affix
}) })
test("should be defined on jquery object", function () { test('should be defined on jquery object', function () {
ok($(document.body).affix, 'affix method is defined') ok($(document.body).affix, 'affix method is defined')
}) })
test("should return element", function () { test('should return element', function () {
ok($(document.body).affix()[0] == document.body, 'document.body returned') ok($(document.body).affix()[0] == document.body, 'document.body returned')
}) })
test("should exit early if element is not visible", function () { test('should exit early if element is not visible', function () {
var $affix = $('<div style="display: none"></div>').affix() var $affix = $('<div style="display: none"></div>').affix()
$affix.data('bs.affix').checkPosition() $affix.data('bs.affix').checkPosition()
ok(!$affix.hasClass('affix'), 'affix class was not added') ok(!$affix.hasClass('affix'), 'affix class was not added')
......
$(function () { $(function () {
module("alert") module('alert')
test("should provide no conflict", function () { test('should provide no conflict', function () {
var alert = $.fn.alert.noConflict() var alert = $.fn.alert.noConflict()
ok(!$.fn.alert, 'alert was set back to undefined (org value)') ok(!$.fn.alert, 'alert was set back to undefined (org value)')
$.fn.alert = alert $.fn.alert = alert
}) })
test("should be defined on jquery object", function () { test('should be defined on jquery object', function () {
ok($(document.body).alert, 'alert method is defined') ok($(document.body).alert, 'alert method is defined')
}) })
test("should return element", function () { test('should return element', function () {
ok($(document.body).alert()[0] == document.body, 'document.body returned') ok($(document.body).alert()[0] == document.body, 'document.body returned')
}) })
test("should fade element out on clicking .close", function () { test('should fade element out on clicking .close', function () {
var alertHTML = '<div class="alert-message warning fade in">' var alertHTML = '<div class="alert-message warning fade in">'
+ '<a class="close" href="#" data-dismiss="alert">×</a>' + '<a class="close" href="#" data-dismiss="alert">×</a>'
+ '<p><strong>Holy guacamole!</strong> Best check yo self, you\'re not looking too good.</p>' + '<p><strong>Holy guacamole!</strong> Best check yo self, you\'re not looking too good.</p>'
...@@ -28,7 +28,7 @@ $(function () { ...@@ -28,7 +28,7 @@ $(function () {
ok(!alert.hasClass('in'), 'remove .in class on .close click') ok(!alert.hasClass('in'), 'remove .in class on .close click')
}) })
test("should remove element when clicking .close", function () { test('should remove element when clicking .close', function () {
$.support.transition = false $.support.transition = false
var alertHTML = '<div class="alert-message warning fade in">' var alertHTML = '<div class="alert-message warning fade in">'
...@@ -44,7 +44,7 @@ $(function () { ...@@ -44,7 +44,7 @@ $(function () {
ok(!$('#qunit-fixture').find('.alert-message').length, 'element removed from dom') ok(!$('#qunit-fixture').find('.alert-message').length, 'element removed from dom')
}) })
test("should not fire closed when close is prevented", function () { test('should not fire closed when close is prevented', function () {
$.support.transition = false $.support.transition = false
stop(); stop();
$('<div class="alert"/>') $('<div class="alert"/>')
......
$(function () { $(function () {
module("button") module('button')
test("should provide no conflict", function () { test('should provide no conflict', function () {
var button = $.fn.button.noConflict() var button = $.fn.button.noConflict()
ok(!$.fn.button, 'button was set back to undefined (org value)') ok(!$.fn.button, 'button was set back to undefined (org value)')
$.fn.button = button $.fn.button = button
}) })
test("should be defined on jquery object", function () { test('should be defined on jquery object', function () {
ok($(document.body).button, 'button method is defined') ok($(document.body).button, 'button method is defined')
}) })
test("should return element", function () { test('should return element', function () {
ok($(document.body).button()[0] == document.body, 'document.body returned') ok($(document.body).button()[0] == document.body, 'document.body returned')
}) })
test("should return set state to loading", function () { test('should return set state to loading', function () {
var btn = $('<button class="btn" data-loading-text="fat">mdo</button>') var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
equal(btn.html(), 'mdo', 'btn text equals mdo') equal(btn.html(), 'mdo', 'btn text equals mdo')
btn.button('loading') btn.button('loading')
...@@ -29,7 +29,7 @@ $(function () { ...@@ -29,7 +29,7 @@ $(function () {
}, 0) }, 0)
}) })
test("should return reset state", function () { test('should return reset state', function () {
var btn = $('<button class="btn" data-loading-text="fat">mdo</button>') var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
equal(btn.html(), 'mdo', 'btn text equals mdo') equal(btn.html(), 'mdo', 'btn text equals mdo')
btn.button('loading') btn.button('loading')
...@@ -51,14 +51,14 @@ $(function () { ...@@ -51,14 +51,14 @@ $(function () {
}) })
test("should toggle active", function () { test('should toggle active', function () {
var btn = $('<button class="btn">mdo</button>') var btn = $('<button class="btn">mdo</button>')
ok(!btn.hasClass('active'), 'btn does not have active class') ok(!btn.hasClass('active'), 'btn does not have active class')
btn.button('toggle') btn.button('toggle')
ok(btn.hasClass('active'), 'btn has class active') ok(btn.hasClass('active'), 'btn has class active')
}) })
test("should toggle active when btn children are clicked", function () { test('should toggle active when btn children are clicked', function () {
var btn = $('<button class="btn" data-toggle="button">mdo</button>') var btn = $('<button class="btn" data-toggle="button">mdo</button>')
, inner = $('<i></i>') , inner = $('<i></i>')
btn btn
...@@ -69,7 +69,7 @@ $(function () { ...@@ -69,7 +69,7 @@ $(function () {
ok(btn.hasClass('active'), 'btn has class active') ok(btn.hasClass('active'), 'btn has class active')
}) })
test("should toggle active when btn children are clicked within btn-group", function () { test('should toggle active when btn children are clicked within btn-group', function () {
var btngroup = $('<div class="btn-group" data-toggle="buttons"></div>') var btngroup = $('<div class="btn-group" data-toggle="buttons"></div>')
, btn = $('<button class="btn">fat</button>') , btn = $('<button class="btn">fat</button>')
, inner = $('<i></i>') , inner = $('<i></i>')
...@@ -81,7 +81,7 @@ $(function () { ...@@ -81,7 +81,7 @@ $(function () {
ok(btn.hasClass('active'), 'btn has class active') ok(btn.hasClass('active'), 'btn has class active')
}) })
test("should check for closest matching toggle", function () { test('should check for closest matching toggle', function () {
var group = '<div class="btn-group" data-toggle="buttons">' + var group = '<div class="btn-group" data-toggle="buttons">' +
'<label class="btn btn-primary active">' + '<label class="btn btn-primary active">' +
'<input type="radio" name="options" id="option1" checked="true"> Option 1' + '<input type="radio" name="options" id="option1" checked="true"> Option 1' +
......
$(function () { $(function () {
module("carousel") module('carousel')
test("should provide no conflict", function () { test('should provide no conflict', function () {
var carousel = $.fn.carousel.noConflict() var carousel = $.fn.carousel.noConflict()
ok(!$.fn.carousel, 'carousel was set back to undefined (org value)') ok(!$.fn.carousel, 'carousel was set back to undefined (org value)')
$.fn.carousel = carousel $.fn.carousel = carousel
}) })
test("should be defined on jquery object", function () { test('should be defined on jquery object', function () {
ok($(document.body).carousel, 'carousel method is defined') ok($(document.body).carousel, 'carousel method is defined')
}) })
test("should return element", function () { test('should return element', function () {
ok($(document.body).carousel()[0] == document.body, 'document.body returned') ok($(document.body).carousel()[0] == document.body, 'document.body returned')
}) })
test("should not fire sliden when slide is prevented", function () { test('should not fire sliden when slide is prevented', function () {
$.support.transition = false $.support.transition = false
stop() stop()
$('<div class="carousel"/>') $('<div class="carousel"/>')
...@@ -31,7 +31,7 @@ $(function () { ...@@ -31,7 +31,7 @@ $(function () {
.carousel('next') .carousel('next')
}) })
test("should fire slide event with direction", function () { test('should fire slide event with direction', function () {
var template = '<div id="myCarousel" class="carousel slide"><div class="carousel-inner"><div class="item active"><img alt=""><div class="carousel-caption"><h4>{{_i}}First Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div><div class="item"><img alt=""><div class="carousel-caption"><h4>{{_i}}Second Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div><div class="item"><img alt=""><div class="carousel-caption"><h4>{{_i}}Third Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div></div><a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a><a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a></div>' var template = '<div id="myCarousel" class="carousel slide"><div class="carousel-inner"><div class="item active"><img alt=""><div class="carousel-caption"><h4>{{_i}}First Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div><div class="item"><img alt=""><div class="carousel-caption"><h4>{{_i}}Second Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div><div class="item"><img alt=""><div class="carousel-caption"><h4>{{_i}}Third Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div></div><a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a><a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a></div>'
$.support.transition = false $.support.transition = false
stop() stop()
...@@ -43,7 +43,7 @@ $(function () { ...@@ -43,7 +43,7 @@ $(function () {
}).carousel('next') }).carousel('next')
}) })
test("should fire slide event with relatedTarget", function () { test('should fire slide event with relatedTarget', function () {
var template = '<div id="myCarousel" class="carousel slide"><div class="carousel-inner"><div class="item active"><img alt=""><div class="carousel-caption"><h4>{{_i}}First Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div><div class="item"><img alt=""><div class="carousel-caption"><h4>{{_i}}Second Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div><div class="item"><img alt=""><div class="carousel-caption"><h4>{{_i}}Third Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div></div><a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a><a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a></div>' var template = '<div id="myCarousel" class="carousel slide"><div class="carousel-inner"><div class="item active"><img alt=""><div class="carousel-caption"><h4>{{_i}}First Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div><div class="item"><img alt=""><div class="carousel-caption"><h4>{{_i}}Second Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div><div class="item"><img alt=""><div class="carousel-caption"><h4>{{_i}}Third Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div></div><a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a><a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a></div>'
$.support.transition = false $.support.transition = false
stop() stop()
...@@ -57,31 +57,31 @@ $(function () { ...@@ -57,31 +57,31 @@ $(function () {
.carousel('next') .carousel('next')
}) })
test("should set interval from data attribute", 4, function () { test('should set interval from data attribute', 4, function () {
var template = $('<div id="myCarousel" class="carousel slide"> <div class="carousel-inner"> <div class="item active"> <img alt=""> <div class="carousel-caption"> <h4>{{_i}}First Thumbnail label{{/i}}</h4> <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p> </div> </div> <div class="item"> <img alt=""> <div class="carousel-caption"> <h4>{{_i}}Second Thumbnail label{{/i}}</h4> <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p> </div> </div> <div class="item"> <img alt=""> <div class="carousel-caption"> <h4>{{_i}}Third Thumbnail label{{/i}}</h4> <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p> </div> </div> </div> <a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a> <a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a> </div>'); var template = $('<div id="myCarousel" class="carousel slide"> <div class="carousel-inner"> <div class="item active"> <img alt=""> <div class="carousel-caption"> <h4>{{_i}}First Thumbnail label{{/i}}</h4> <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p> </div> </div> <div class="item"> <img alt=""> <div class="carousel-caption"> <h4>{{_i}}Second Thumbnail label{{/i}}</h4> <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p> </div> </div> <div class="item"> <img alt=""> <div class="carousel-caption"> <h4>{{_i}}Third Thumbnail label{{/i}}</h4> <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p> </div> </div> </div> <a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a> <a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a> </div>');
template.attr("data-interval", 1814); template.attr('data-interval', 1814);
template.appendTo("body"); template.appendTo('body');
$('[data-slide]').first().click(); $('[data-slide]').first().click();
ok($('#myCarousel').data('bs.carousel').options.interval == 1814); ok($('#myCarousel').data('bs.carousel').options.interval == 1814);
$('#myCarousel').remove(); $('#myCarousel').remove();
template.appendTo("body").attr("data-modal", "foobar"); template.appendTo('body').attr('data-modal', 'foobar');
$('[data-slide]').first().click(); $('[data-slide]').first().click();
ok($('#myCarousel').data('bs.carousel').options.interval == 1814, "even if there is an data-modal attribute set"); ok($('#myCarousel').data('bs.carousel').options.interval == 1814, 'even if there is an data-modal attribute set');
$('#myCarousel').remove(); $('#myCarousel').remove();
template.appendTo("body"); template.appendTo('body');
$('[data-slide]').first().click(); $('[data-slide]').first().click();
$('#myCarousel').attr('data-interval', 1860); $('#myCarousel').attr('data-interval', 1860);
$('[data-slide]').first().click(); $('[data-slide]').first().click();
ok($('#myCarousel').data('bs.carousel').options.interval == 1814, "attributes should be read only on intitialization"); ok($('#myCarousel').data('bs.carousel').options.interval == 1814, 'attributes should be read only on intitialization');
$('#myCarousel').remove(); $('#myCarousel').remove();
template.attr("data-interval", false); template.attr('data-interval', false);
template.appendTo("body"); template.appendTo('body');
$('#myCarousel').carousel(1); $('#myCarousel').carousel(1);
ok($('#myCarousel').data('bs.carousel').options.interval === false, "data attribute has higher priority than default options"); ok($('#myCarousel').data('bs.carousel').options.interval === false, 'data attribute has higher priority than default options');
$('#myCarousel').remove(); $('#myCarousel').remove();
}) })
}) })
$(function () { $(function () {
module("collapse") module('collapse')
test("should provide no conflict", function () { test('should provide no conflict', function () {
var collapse = $.fn.collapse.noConflict() var collapse = $.fn.collapse.noConflict()
ok(!$.fn.collapse, 'collapse was set back to undefined (org value)') ok(!$.fn.collapse, 'collapse was set back to undefined (org value)')
$.fn.collapse = collapse $.fn.collapse = collapse
}) })
test("should be defined on jquery object", function () { test('should be defined on jquery object', function () {
ok($(document.body).collapse, 'collapse method is defined') ok($(document.body).collapse, 'collapse method is defined')
}) })
test("should return element", function () { test('should return element', function () {
ok($(document.body).collapse()[0] == document.body, 'document.body returned') ok($(document.body).collapse()[0] == document.body, 'document.body returned')
}) })
test("should show a collapsed element", function () { test('should show a collapsed element', function () {
var el = $('<div class="collapse"></div>').collapse('show') var el = $('<div class="collapse"></div>').collapse('show')
ok(el.hasClass('in'), 'has class in') ok(el.hasClass('in'), 'has class in')
ok(/height/.test(el.attr('style')), 'has height set') ok(/height/.test(el.attr('style')), 'has height set')
}) })
test("should hide a collapsed element", function () { test('should hide a collapsed element', function () {
var el = $('<div class="collapse"></div>').collapse('hide') var el = $('<div class="collapse"></div>').collapse('hide')
ok(!el.hasClass('in'), 'does not have class in') ok(!el.hasClass('in'), 'does not have class in')
ok(/height/.test(el.attr('style')), 'has height set') ok(/height/.test(el.attr('style')), 'has height set')
}) })
test("should not fire shown when show is prevented", function () { test('should not fire shown when show is prevented', function () {
$.support.transition = false $.support.transition = false
stop() stop()
$('<div class="collapse"/>') $('<div class="collapse"/>')
...@@ -43,7 +43,7 @@ $(function () { ...@@ -43,7 +43,7 @@ $(function () {
.collapse('show') .collapse('show')
}) })
test("should reset style to auto after finishing opening collapse", function () { test('should reset style to auto after finishing opening collapse', function () {
$.support.transition = false $.support.transition = false
stop() stop()
$('<div class="collapse" style="height: 0px"/>') $('<div class="collapse" style="height: 0px"/>')
...@@ -57,7 +57,7 @@ $(function () { ...@@ -57,7 +57,7 @@ $(function () {
.collapse('show') .collapse('show')
}) })
test("should add active class to target when collapse shown", function () { test('should add active class to target when collapse shown', function () {
$.support.transition = false $.support.transition = false
stop() stop()
...@@ -74,7 +74,7 @@ $(function () { ...@@ -74,7 +74,7 @@ $(function () {
target.click() target.click()
}) })
test("should remove active class to target when collapse hidden", function () { test('should remove active class to target when collapse hidden', function () {
$.support.transition = false $.support.transition = false
stop() stop()
...@@ -91,7 +91,7 @@ $(function () { ...@@ -91,7 +91,7 @@ $(function () {
target.click() target.click()
}) })
test("should remove active class from inactive accordion targets", function () { test('should remove active class from inactive accordion targets', function () {
$.support.transition = false $.support.transition = false
stop() stop()
...@@ -126,7 +126,7 @@ $(function () { ...@@ -126,7 +126,7 @@ $(function () {
target3.click() target3.click()
}) })
test("should allow dots in data-parent", function () { test('should allow dots in data-parent', function () {
$.support.transition = false $.support.transition = false
stop() stop()
......
$(function () { $(function () {
module("dropdowns") module('dropdowns')
test("should provide no conflict", function () { test('should provide no conflict', function () {
var dropdown = $.fn.dropdown.noConflict() var dropdown = $.fn.dropdown.noConflict()
ok(!$.fn.dropdown, 'dropdown was set back to undefined (org value)') ok(!$.fn.dropdown, 'dropdown was set back to undefined (org value)')
$.fn.dropdown = dropdown $.fn.dropdown = dropdown
}) })
test("should be defined on jquery object", function () { test('should be defined on jquery object', function () {
ok($(document.body).dropdown, 'dropdown method is defined') ok($(document.body).dropdown, 'dropdown method is defined')
}) })
test("should return element", function () { test('should return element', function () {
var el = $("<div />") var el = $('<div />')
ok(el.dropdown()[0] === el[0], 'same element returned') ok(el.dropdown()[0] === el[0], 'same element returned')
}) })
test("should not open dropdown if target is disabled", function () { test('should not open dropdown if target is disabled', function () {
var dropdownHTML = '<ul class="tabs">' var dropdownHTML = '<ul class="tabs">'
+ '<li class="dropdown">' + '<li class="dropdown">'
+ '<button disabled href="#" class="btn dropdown-toggle" data-toggle="dropdown">Dropdown</button>' + '<button disabled href="#" class="btn dropdown-toggle" data-toggle="dropdown">Dropdown</button>'
...@@ -34,7 +34,7 @@ $(function () { ...@@ -34,7 +34,7 @@ $(function () {
ok(!dropdown.parent('.dropdown').hasClass('open'), 'open class added on click') ok(!dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
}) })
test("should not open dropdown if target is disabled", function () { test('should not open dropdown if target is disabled', function () {
var dropdownHTML = '<ul class="tabs">' var dropdownHTML = '<ul class="tabs">'
+ '<li class="dropdown">' + '<li class="dropdown">'
+ '<button href="#" class="btn dropdown-toggle disabled" data-toggle="dropdown">Dropdown</button>' + '<button href="#" class="btn dropdown-toggle disabled" data-toggle="dropdown">Dropdown</button>'
...@@ -51,7 +51,7 @@ $(function () { ...@@ -51,7 +51,7 @@ $(function () {
ok(!dropdown.parent('.dropdown').hasClass('open'), 'open class added on click') ok(!dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
}) })
test("should add class open to menu if clicked", function () { test('should add class open to menu if clicked', function () {
var dropdownHTML = '<ul class="tabs">' var dropdownHTML = '<ul class="tabs">'
+ '<li class="dropdown">' + '<li class="dropdown">'
+ '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>' + '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
...@@ -68,7 +68,7 @@ $(function () { ...@@ -68,7 +68,7 @@ $(function () {
ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click') ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
}) })
test("should test if element has a # before assuming it's a selector", function () { test('should test if element has a # before assuming it\'s a selector', function () {
var dropdownHTML = '<ul class="tabs">' var dropdownHTML = '<ul class="tabs">'
+ '<li class="dropdown">' + '<li class="dropdown">'
+ '<a href="/foo/" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>' + '<a href="/foo/" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
...@@ -86,7 +86,7 @@ $(function () { ...@@ -86,7 +86,7 @@ $(function () {
}) })
test("should remove open class if body clicked", function () { test('should remove open class if body clicked', function () {
var dropdownHTML = '<ul class="tabs">' var dropdownHTML = '<ul class="tabs">'
+ '<li class="dropdown">' + '<li class="dropdown">'
+ '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>' + '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
...@@ -110,7 +110,7 @@ $(function () { ...@@ -110,7 +110,7 @@ $(function () {
dropdown.remove() dropdown.remove()
}) })
test("should remove open class if body clicked, with multiple drop downs", function () { test('should remove open class if body clicked, with multiple drop downs', function () {
var dropdownHTML = var dropdownHTML =
'<ul class="nav">' '<ul class="nav">'
+ ' <li><a href="#menu1">Menu 1</a></li>' + ' <li><a href="#menu1">Menu 1</a></li>'
...@@ -132,24 +132,24 @@ $(function () { ...@@ -132,24 +132,24 @@ $(function () {
, first = dropdowns.first() , first = dropdowns.first()
, last = dropdowns.last() , last = dropdowns.last()
ok(dropdowns.length == 2, "Should be two dropdowns") ok(dropdowns.length == 2, 'Should be two dropdowns')
first.click() first.click()
ok(first.parents('.open').length == 1, 'open class added on click') ok(first.parents('.open').length == 1, 'open class added on click')
ok($('#qunit-fixture .open').length == 1, 'only one object is open') ok($('#qunit-fixture .open').length == 1, 'only one object is open')
$('body').click() $('body').click()
ok($("#qunit-fixture .open").length === 0, 'open class removed') ok($('#qunit-fixture .open').length === 0, 'open class removed')
last.click() last.click()
ok(last.parent('.open').length == 1, 'open class added on click') ok(last.parent('.open').length == 1, 'open class added on click')
ok($('#qunit-fixture .open').length == 1, 'only one object is open') ok($('#qunit-fixture .open').length == 1, 'only one object is open')
$('body').click() $('body').click()
ok($("#qunit-fixture .open").length === 0, 'open class removed') ok($('#qunit-fixture .open').length === 0, 'open class removed')
$("#qunit-fixture").html("") $('#qunit-fixture').html('')
}) })
test("should fire show and hide event", function () { test('should fire show and hide event', function () {
var dropdownHTML = '<ul class="tabs">' var dropdownHTML = '<ul class="tabs">'
+ '<li class="dropdown">' + '<li class="dropdown">'
+ '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>' + '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
...@@ -183,7 +183,7 @@ $(function () { ...@@ -183,7 +183,7 @@ $(function () {
}) })
test("should fire shown and hiden event", function () { test('should fire shown and hiden event', function () {
var dropdownHTML = '<ul class="tabs">' var dropdownHTML = '<ul class="tabs">'
+ '<li class="dropdown">' + '<li class="dropdown">'
+ '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>' + '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* grunt-contrib-qunit * grunt-contrib-qunit
* http://gruntjs.com/ * http://gruntjs.com/
* *
* Copyright (c) 2013 "Cowboy" Ben Alman, contributors * Copyright (c) 2013 'Cowboy' Ben Alman, contributors
* Licensed under the MIT license. * Licensed under the MIT license.
*/ */
...@@ -46,23 +46,23 @@ ...@@ -46,23 +46,23 @@
QUnit.begin = function () { QUnit.begin = function () {
sendMessage('qunit.begin') sendMessage('qunit.begin')
console.log("Starting test suite") console.log('Starting test suite')
console.log("================================================\n") console.log('================================================\n')
} }
QUnit.moduleDone = function (opts) { QUnit.moduleDone = function (opts) {
if (opts.failed === 0) { if (opts.failed === 0) {
console.log("\r\u2714 All tests passed in '" + opts.name + "' module") console.log('\r\u2714 All tests passed in "' + opts.name + '" module')
} else { } else {
console.log("\u2716 " + opts.failed + " tests failed in '" + opts.name + "' module") console.log('\u2716 ' + opts.failed + ' tests failed in "' + opts.name + '" module')
} }
sendMessage('qunit.moduleDone', opts.name, opts.failed, opts.passed, opts.total) sendMessage('qunit.moduleDone', opts.name, opts.failed, opts.passed, opts.total)
} }
QUnit.done = function (opts) { QUnit.done = function (opts) {
console.log("\n================================================") console.log('\n================================================')
console.log("Tests completed in " + opts.runtime + " milliseconds") console.log('Tests completed in ' + opts.runtime + ' milliseconds')
console.log(opts.passed + " tests of " + opts.total + " passed, " + opts.failed + " failed.") console.log(opts.passed + ' tests of ' + opts.total + ' passed, ' + opts.failed + ' failed.')
sendMessage('qunit.done', opts.failed, opts.passed, opts.total, opts.runtime) sendMessage('qunit.done', opts.failed, opts.passed, opts.total, opts.runtime)
} }
......
$(function () { $(function () {
module("popover") module('popover')
test("should provide no conflict", function () { test('should provide no conflict', function () {
var popover = $.fn.popover.noConflict() var popover = $.fn.popover.noConflict()
ok(!$.fn.popover, 'popover was set back to undefined (org value)') ok(!$.fn.popover, 'popover was set back to undefined (org value)')
$.fn.popover = popover $.fn.popover = popover
}) })
test("should be defined on jquery object", function () { test('should be defined on jquery object', function () {
var div = $('<div></div>') var div = $('<div></div>')
ok(div.popover, 'popover method is defined') ok(div.popover, 'popover method is defined')
}) })
test("should return element", function () { test('should return element', function () {
var div = $('<div></div>') var div = $('<div></div>')
ok(div.popover() == div, 'document.body returned') ok(div.popover() == div, 'document.body returned')
}) })
test("should render popover element", function () { test('should render popover element', function () {
$.support.transition = false $.support.transition = false
var popover = $('<a href="#" title="mdo" data-content="http://twitter.com/mdo">@mdo</a>') var popover = $('<a href="#" title="mdo" data-content="http://twitter.com/mdo">@mdo</a>')
.appendTo('#qunit-fixture') .appendTo('#qunit-fixture')
...@@ -26,10 +26,10 @@ $(function () { ...@@ -26,10 +26,10 @@ $(function () {
ok($('.popover').length, 'popover was inserted') ok($('.popover').length, 'popover was inserted')
popover.popover('hide') popover.popover('hide')
ok(!$(".popover").length, 'popover removed') ok(!$('.popover').length, 'popover removed')
}) })
test("should store popover instance in popover data object", function () { test('should store popover instance in popover data object', function () {
$.support.transition = false $.support.transition = false
var popover = $('<a href="#" title="mdo" data-content="http://twitter.com/mdo">@mdo</a>') var popover = $('<a href="#" title="mdo" data-content="http://twitter.com/mdo">@mdo</a>')
.popover() .popover()
...@@ -37,7 +37,7 @@ $(function () { ...@@ -37,7 +37,7 @@ $(function () {
ok(!!popover.data('bs.popover'), 'popover instance exists') ok(!!popover.data('bs.popover'), 'popover instance exists')
}) })
test("should get title and content from options", function () { test('should get title and content from options', function () {
$.support.transition = false $.support.transition = false
var popover = $('<a href="#">@fat</a>') var popover = $('<a href="#">@fat</a>')
.appendTo('#qunit-fixture') .appendTo('#qunit-fixture')
...@@ -61,7 +61,7 @@ $(function () { ...@@ -61,7 +61,7 @@ $(function () {
$('#qunit-fixture').empty() $('#qunit-fixture').empty()
}) })
test("should get title and content from attributes", function () { test('should get title and content from attributes', function () {
$.support.transition = false $.support.transition = false
var popover = $('<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>') var popover = $('<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>')
.appendTo('#qunit-fixture') .appendTo('#qunit-fixture')
...@@ -70,7 +70,7 @@ $(function () { ...@@ -70,7 +70,7 @@ $(function () {
ok($('.popover').length, 'popover was inserted') ok($('.popover').length, 'popover was inserted')
equal($('.popover .popover-title').text(), '@mdo', 'title correctly inserted') equal($('.popover .popover-title').text(), '@mdo', 'title correctly inserted')
equal($('.popover .popover-content').text(), "loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻", 'content correctly inserted') equal($('.popover .popover-content').text(), 'loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻', 'content correctly inserted')
popover.popover('hide') popover.popover('hide')
ok(!$('.popover').length, 'popover was removed') ok(!$('.popover').length, 'popover was removed')
...@@ -78,7 +78,7 @@ $(function () { ...@@ -78,7 +78,7 @@ $(function () {
}) })
test("should get title and content from attributes #2", function () { test('should get title and content from attributes #2', function () {
$.support.transition = false $.support.transition = false
var popover = $('<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>') var popover = $('<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>')
.appendTo('#qunit-fixture') .appendTo('#qunit-fixture')
...@@ -90,14 +90,14 @@ $(function () { ...@@ -90,14 +90,14 @@ $(function () {
ok($('.popover').length, 'popover was inserted') ok($('.popover').length, 'popover was inserted')
equal($('.popover .popover-title').text(), '@mdo', 'title correctly inserted') equal($('.popover .popover-title').text(), '@mdo', 'title correctly inserted')
equal($('.popover .popover-content').text(), "loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻", 'content correctly inserted') equal($('.popover .popover-content').text(), 'loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻', 'content correctly inserted')
popover.popover('hide') popover.popover('hide')
ok(!$('.popover').length, 'popover was removed') ok(!$('.popover').length, 'popover was removed')
$('#qunit-fixture').empty() $('#qunit-fixture').empty()
}) })
test("should respect custom classes", function () { test('should respect custom classes', function () {
$.support.transition = false $.support.transition = false
var popover = $('<a href="#">@fat</a>') var popover = $('<a href="#">@fat</a>')
.appendTo('#qunit-fixture') .appendTo('#qunit-fixture')
...@@ -117,7 +117,7 @@ $(function () { ...@@ -117,7 +117,7 @@ $(function () {
$('#qunit-fixture').empty() $('#qunit-fixture').empty()
}) })
test("should destroy popover", function () { test('should destroy popover', function () {
var popover = $('<div/>').popover({trigger: 'hover'}).on('click.foo', function () {}) var popover = $('<div/>').popover({trigger: 'hover'}).on('click.foo', function () {})
ok(popover.data('bs.popover'), 'popover has data') ok(popover.data('bs.popover'), 'popover has data')
ok($._data(popover[0], 'events').mouseover && $._data(popover[0], 'events').mouseout, 'popover has hover event') ok($._data(popover[0], 'events').mouseover && $._data(popover[0], 'events').mouseout, 'popover has hover event')
......
$(function () { $(function () {
module("scrollspy") module('scrollspy')
test("should provide no conflict", function () { test('should provide no conflict', function () {
var scrollspy = $.fn.scrollspy.noConflict() var scrollspy = $.fn.scrollspy.noConflict()
ok(!$.fn.scrollspy, 'scrollspy was set back to undefined (org value)') ok(!$.fn.scrollspy, 'scrollspy was set back to undefined (org value)')
$.fn.scrollspy = scrollspy $.fn.scrollspy = scrollspy
}) })
test("should be defined on jquery object", function () { test('should be defined on jquery object', function () {
ok($(document.body).scrollspy, 'scrollspy method is defined') ok($(document.body).scrollspy, 'scrollspy method is defined')
}) })
test("should return element", function () { test('should return element', function () {
ok($(document.body).scrollspy()[0] == document.body, 'document.body returned') ok($(document.body).scrollspy()[0] == document.body, 'document.body returned')
}) })
test("should switch active class on scroll", function () { test('should switch active class on scroll', function () {
var sectionHTML = '<div id="masthead"></div>' var sectionHTML = '<div id="masthead"></div>'
, $section = $(sectionHTML).append('#qunit-fixture') , $section = $(sectionHTML).append('#qunit-fixture')
, topbarHTML = '<div class="topbar">' , topbarHTML = '<div class="topbar">'
......
$(function () { $(function () {
module("tabs") module('tabs')
test("should provide no conflict", function () { test('should provide no conflict', function () {
var tab = $.fn.tab.noConflict() var tab = $.fn.tab.noConflict()
ok(!$.fn.tab, 'tab was set back to undefined (org value)') ok(!$.fn.tab, 'tab was set back to undefined (org value)')
$.fn.tab = tab $.fn.tab = tab
}) })
test("should be defined on jquery object", function () { test('should be defined on jquery object', function () {
ok($(document.body).tab, 'tabs method is defined') ok($(document.body).tab, 'tabs method is defined')
}) })
test("should return element", function () { test('should return element', function () {
ok($(document.body).tab()[0] == document.body, 'document.body returned') ok($(document.body).tab()[0] == document.body, 'document.body returned')
}) })
test("should activate element by tab id", function () { test('should activate element by tab id', function () {
var tabsHTML = var tabsHTML =
'<ul class="tabs">' '<ul class="tabs">'
+ '<li><a href="#home">Home</a></li>' + '<li><a href="#home">Home</a></li>'
+ '<li><a href="#profile">Profile</a></li>' + '<li><a href="#profile">Profile</a></li>'
+ '</ul>' + '</ul>'
$('<ul><li id="home"></li><li id="profile"></li></ul>').appendTo("#qunit-fixture") $('<ul><li id="home"></li><li id="profile"></li></ul>').appendTo('#qunit-fixture')
$(tabsHTML).find('li:last a').tab('show') $(tabsHTML).find('li:last a').tab('show')
equal($("#qunit-fixture").find('.active').attr('id'), "profile") equal($('#qunit-fixture').find('.active').attr('id'), 'profile')
$(tabsHTML).find('li:first a').tab('show') $(tabsHTML).find('li:first a').tab('show')
equal($("#qunit-fixture").find('.active').attr('id'), "home") equal($('#qunit-fixture').find('.active').attr('id'), 'home')
}) })
test("should activate element by tab id", function () { test('should activate element by tab id', function () {
var pillsHTML = var pillsHTML =
'<ul class="pills">' '<ul class="pills">'
+ '<li><a href="#home">Home</a></li>' + '<li><a href="#home">Home</a></li>'
+ '<li><a href="#profile">Profile</a></li>' + '<li><a href="#profile">Profile</a></li>'
+ '</ul>' + '</ul>'
$('<ul><li id="home"></li><li id="profile"></li></ul>').appendTo("#qunit-fixture") $('<ul><li id="home"></li><li id="profile"></li></ul>').appendTo('#qunit-fixture')
$(pillsHTML).find('li:last a').tab('show') $(pillsHTML).find('li:last a').tab('show')
equal($("#qunit-fixture").find('.active').attr('id'), "profile") equal($('#qunit-fixture').find('.active').attr('id'), 'profile')
$(pillsHTML).find('li:first a').tab('show') $(pillsHTML).find('li:first a').tab('show')
equal($("#qunit-fixture").find('.active').attr('id'), "home") equal($('#qunit-fixture').find('.active').attr('id'), 'home')
}) })
test("should not fire closed when close is prevented", function () { test('should not fire closed when close is prevented', function () {
$.support.transition = false $.support.transition = false
stop(); stop();
$('<div class="tab"/>') $('<div class="tab"/>')
...@@ -64,7 +64,7 @@ $(function () { ...@@ -64,7 +64,7 @@ $(function () {
.tab('show') .tab('show')
}) })
test("show and shown events should reference correct relatedTarget", function () { test('show and shown events should reference correct relatedTarget', function () {
var dropHTML = var dropHTML =
'<ul class="drop">' '<ul class="drop">'
+ '<li class="dropdown"><a data-toggle="dropdown" href="#">1</a>' + '<li class="dropdown"><a data-toggle="dropdown" href="#">1</a>'
...@@ -77,9 +77,9 @@ $(function () { ...@@ -77,9 +77,9 @@ $(function () {
$(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', function (event) {
equal(event.relatedTarget.hash, "#1-1") equal(event.relatedTarget.hash, '#1-1')
}).on('shown', function (event) { }).on('shown', function (event) {
equal(event.relatedTarget.hash, "#1-1") equal(event.relatedTarget.hash, '#1-1')
}).tab('show') }).tab('show')
}) })
......
This diff is collapsed.
$(function () { $(function () {
module("transition") module('transition')
test("should be defined on jquery support object", function () { test('should be defined on jquery support object', function () {
ok($.support.transition !== undefined, 'transition object is defined') ok($.support.transition !== undefined, 'transition object is defined')
}) })
test("should provide an end object", function () { test('should provide an end object', function () {
ok($.support.transition ? $.support.transition.end : true, 'end string is defined') ok($.support.transition ? $.support.transition.end : true, 'end string is defined')
}) })
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* ======================================================================== */ * ======================================================================== */
+function ($) { "use strict"; +function ($) { 'use strict';
// TOOLTIP PUBLIC CLASS DEFINITION // TOOLTIP PUBLIC CLASS DEFINITION
// =============================== // ===============================
...@@ -244,7 +244,7 @@ ...@@ -244,7 +244,7 @@
} }
Tooltip.prototype.replaceArrow = function (delta, dimension, position) { Tooltip.prototype.replaceArrow = function (delta, dimension, position) {
this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '') this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + '%') : '')
} }
Tooltip.prototype.setContent = function () { Tooltip.prototype.setContent = function () {
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* ======================================================================== */ * ======================================================================== */
+function ($) { "use strict"; +function ($) { 'use strict';
// CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
// ============================================================ // ============================================================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment