Skip to content

Commit fcdaf9b

Browse files
committed
ReactiveRaven#64 testing in all variants ReactiveRaven#67 jq1.9.1 slower in grunt
1 parent f4719ab commit fcdaf9b

13 files changed

+10237
-106
lines changed

libs/jquery/jquery-1.8.2.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libs/jquery/jquery-1.9.1.js

+9,597
Large diffs are not rendered by default.

libs/jquery/jquery-1.9.1.min.js

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libs/jquery/jquery-migrate.1.2.0.js

+523
Large diffs are not rendered by default.

src/jqBootstrapValidation.js

+13-10
Original file line numberDiff line numberDiff line change
@@ -1139,22 +1139,25 @@
11391139

11401140
var getValue = function ($this) {
11411141
// Extract the value we're talking about
1142-
var value = $this.val();
1142+
var value = null;
11431143
var type = $this.attr("type");
1144-
var parent = null;
1145-
var hasParent = !!(parent = $this.parents("form").first()) || !!(parent = $this.parents(".control-group").first());
11461144
if (type === "checkbox") {
11471145
value = ($this.is(":checked") ? value : "");
1148-
if (hasParent) {
1149-
value = parent.find("input[type='checkbox'][name='" + $this.attr("name") + "']:checked").map(function (i, el) { return $(el).val(); }).toArray().join(",");
1146+
var checkboxParent = $this.parents("form").first() || $this.parents(".control-group").first();
1147+
if (checkboxParent) {
1148+
value = checkboxParent.find("input[name='" + $this.attr("name") + "']:checked").map(function (i, el) { return $(el).val(); }).toArray().join(",");
11501149
}
11511150
}
1152-
if (type === "radio") {
1153-
value = ($('input[name="' + $this.attr("name") + '"]:checked').length > 0 ? value : "");
1154-
if (hasParent) {
1155-
value = parent.find("input[type='radio'][name='" + $this.attr("name") + "']:checked").map(function (i, el) { return $(el).val(); }).toArray().join(",");
1151+
else if (type === "radio") {
1152+
value = ($('input[name="' + $this.attr("name") + '"]:checked').length > 0 ? $this.val() : "");
1153+
var radioParent = $this.parents("form").first() || $this.parents(".control-group").first();
1154+
if (radioParent) {
1155+
value = radioParent.find("input[name='" + $this.attr("name") + "']:checked").map(function (i, el) { return $(el).val(); }).toArray().join(",");
11561156
}
11571157
}
1158+
else {
1159+
value = $this.val();
1160+
}
11581161
return value;
11591162
};
11601163

@@ -1194,4 +1197,4 @@ $.fn.jqBootstrapValidation = function( method ) {
11941197
$(":input").not("[type=image],[type=submit]").jqBootstrapValidation.apply(this,arguments);
11951198
};
11961199

1197-
})( jQuery );
1200+
})( jQuery );

test/issues/39/39.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
<meta charset="utf-8">
55
<title>jqBootstrapValidation Test Suite</title>
66
<!-- Load local jQuery. This can be overridden with a ?jquery=___ param. -->
7-
<script src="../../../libs/jquery/jquery.js"></script>
7+
<script src="../../../libs/jquery/jquery-1.9.1.js"></script>
8+
<script>
9+
jQuery.migrateMute = true;
10+
</script>
11+
<script src="../../../libs/jquery/jquery-migrate.1.2.0.js"></script>
812
<!-- Load local QUnit (grunt requires v1.0.0 or newer). -->
913
<link rel="stylesheet" href="../../../libs/qunit/qunit.css" media="screen">
1014
<script src="../../../libs/qunit/qunit.js"></script>
@@ -50,10 +54,6 @@
5054
);
5155
}
5256
</script>
53-
<!-- Removing access to jQuery and $. But it'll still be available as _$, if
54-
you REALLY want to mess around with jQuery in the console. REMEMBER WE
55-
ARE TESTING YOUR PLUGIN HERE -->
56-
<script>window._$ = jQuery.noConflict(true);</script>
5757
</head>
5858
<body>
5959
<h1 id="qunit-header">jqBootstrapValidation Test Suite</h1>

test/issues/39/test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
module('jqBootstrapValidation', {
2929
setup: function() {
30-
$("#qunit-fixture").append($("\
30+
$("#qunit-fixture").append("\
3131
<form class='form-horizontal' novalidate>\
3232
<div class='control-group'>\
3333
<label class='control-label'>Email address</label>\
@@ -45,7 +45,7 @@
4545
</button>\
4646
</div>\
4747
</form>\
48-
"));
48+
");
4949
attachJqbv();
5050
this.elems = $("#qunit-fixture").children();
5151
},
@@ -56,7 +56,7 @@
5656

5757
module('required field', {
5858
setup: function() {
59-
$("#qunit-fixture").append($("\
59+
$("#qunit-fixture").append("\
6060
<form class='form-horizontal' novalidate>\
6161
<div class='control-group'>\
6262
<label class='control-label'>Email address</label>\
@@ -74,7 +74,7 @@
7474
</button>\
7575
</div>\
7676
</form>\
77-
"));
77+
");
7878
attachJqbv();
7979
},
8080
teardown: function() {

test/issues/50/50.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
<meta charset="utf-8">
55
<title>jqBootstrapValidation Test Suite</title>
66
<!-- Load local jQuery. This can be overridden with a ?jquery=___ param. -->
7-
<script src="../../../libs/jquery/jquery.js"></script>
7+
<script src="../../../libs/jquery/jquery-1.9.1.js"></script>
8+
<script>
9+
jQuery.migrateMute = true;
10+
</script>
11+
<script src="../../../libs/jquery/jquery-migrate.1.2.0.js"></script>
812
<!-- Load local QUnit (grunt requires v1.0.0 or newer). -->
913
<link rel="stylesheet" href="../../../libs/qunit/qunit.css" media="screen">
1014
<script src="../../../libs/qunit/qunit.js"></script>
@@ -50,10 +54,6 @@
5054
);
5155
}
5256
</script>
53-
<!-- Removing access to jQuery and $. But it'll still be available as _$, if
54-
you REALLY want to mess around with jQuery in the console. REMEMBER WE
55-
ARE TESTING YOUR PLUGIN HERE -->
56-
<script>window._$ = jQuery.noConflict(true);</script>
5757
</head>
5858
<body>
5959
<h1 id="qunit-header">jqBootstrapValidation Test Suite</h1>

test/issues/50/test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
module('jqBootstrapValidation', {
2929
setup: function() {
30-
$("#qunit-fixture").append($("\
30+
$("#qunit-fixture").append("\
3131
<form class='form-horizontal' novalidate>\
3232
<div class='control-group'>\
3333
<label class='control-label'>Email address</label>\
@@ -45,7 +45,7 @@
4545
</button>\
4646
</div>\
4747
</form>\
48-
"));
48+
");
4949
attachJqbv();
5050
this.elems = $("#qunit-fixture").children();
5151
},
@@ -56,7 +56,7 @@
5656

5757
module('required field', {
5858
setup: function() {
59-
$("#qunit-fixture").append($("\
59+
$("#qunit-fixture").append("\
6060
<form class='form-horizontal' novalidate>\
6161
<div class='control-group'>\
6262
<label class='control-label'>Email address</label>\
@@ -74,7 +74,7 @@
7474
</button>\
7575
</div>\
7676
</form>\
77-
"));
77+
");
7878
attachJqbv();
7979
},
8080
teardown: function() {

test/issues/67/67.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
<meta charset="utf-8">
55
<title>jqBootstrapValidation Test Suite</title>
66
<!-- Load local jQuery. This can be overridden with a ?jquery=___ param. -->
7-
<script src="../../../libs/jquery/jquery.js"></script>
7+
<script src="../../../libs/jquery/jquery-1.9.1.js"></script>
8+
<script>
9+
jQuery.migrateMute = true;
10+
</script>
11+
<script src="../../../libs/jquery/jquery-migrate.1.2.0.js"></script>
812
<!-- Load local QUnit (grunt requires v1.0.0 or newer). -->
913
<link rel="stylesheet" href="../../../libs/qunit/qunit.css" media="screen">
1014
<script src="../../../libs/qunit/qunit.js"></script>
@@ -50,10 +54,6 @@
5054
);
5155
}
5256
</script>
53-
<!-- Removing access to jQuery and $. But it'll still be available as _$, if
54-
you REALLY want to mess around with jQuery in the console. REMEMBER WE
55-
ARE TESTING YOUR PLUGIN HERE -->
56-
<script>window._$ = jQuery.noConflict(true);</script>
5757
</head>
5858
<body>
5959
<h1 id="qunit-header">jqBootstrapValidation Test Suite</h1>

test/issues/67/test.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
module('jqBootstrapValidation', {
2929
setup: function() {
30-
$("#qunit-fixture").append($("\
30+
$("#qunit-fixture").append("\
3131
<form class='form-horizontal' novalidate>\
3232
<div class='control-group'>\
3333
<label class='control-label'>Email address</label>\
@@ -45,7 +45,7 @@
4545
</button>\
4646
</div>\
4747
</form>\
48-
"));
48+
");
4949
attachJqbv();
5050
this.elems = $("#qunit-fixture").children();
5151
},
@@ -69,12 +69,13 @@
6969
$form.trigger("submit");
7070
var elapsed = new Date() - start;
7171
var inputCount = $("#qunit-fixture form").find("textarea,input,select").not("[type=submit]").length;
72-
var timeAllowed = 20 * inputCount;
72+
var timeAllowed = 25 * inputCount; // runs much slower in Grunt than a real browser, should aim for 30% of budget in browser.
7373
var percent = Math.floor((elapsed / timeAllowed) * 100) + "%";
7474
ok(
7575
elapsed < timeAllowed,
7676
"Should run submit checks in less than " + timeAllowed + "ms - took " + elapsed + "ms; " + percent + " of budget."
7777
);
78+
console.log("Should run submit checks in less than " + timeAllowed + "ms - took " + elapsed + "ms; " + percent + " of budget.");
7879
});
7980

8081
}(jQuery));

test/jqBootstrapValidation.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
<meta charset="utf-8">
55
<title>jqBootstrapValidation Test Suite</title>
66
<!-- Load local jQuery. This can be overridden with a ?jquery=___ param. -->
7-
<script src="../libs/jquery-loader.js"></script>
7+
<script src="../libs/jquery/jquery-1.9.1.js"></script>
8+
<script>
9+
jQuery.migrateMute = true;
10+
</script>
11+
<script src="../libs/jquery/jquery-migrate.1.2.0.js"></script>
812
<!-- Load local QUnit (grunt requires v1.0.0 or newer). -->
913
<link rel="stylesheet" href="../libs/qunit/qunit.css" media="screen">
1014
<script src="../libs/qunit/qunit.js"></script>
@@ -50,10 +54,6 @@
5054
);
5155
}
5256
</script>
53-
<!-- Removing access to jQuery and $. But it'll still be available as _$, if
54-
you REALLY want to mess around with jQuery in the console. REMEMBER WE
55-
ARE TESTING YOUR PLUGIN HERE -->
56-
<script>window._$ = jQuery.noConflict(true);</script>
5757
</head>
5858
<body>
5959
<h1 id="qunit-header">jqBootstrapValidation Test Suite</h1>

0 commit comments

Comments
 (0)