aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2013-09-25 21:18:57 +0200
committerFelix Nagel <info@felixnagel.com>2013-09-25 21:18:57 +0200
commitde4e863552b75aca84d0c5a380243142c6e9baf2 (patch)
tree9fe159d8fde8ca72e4e4777dc2e6f116b0a28096 /tests
parent4ddd14fe43fd0539b4d886db6a4c874c993e8739 (diff)
parent134fcafddac25b8e81160718fec59c39e7c76c59 (diff)
downloadjquery-ui-de4e863552b75aca84d0c5a380243142c6e9baf2.tar.gz
jquery-ui-de4e863552b75aca84d0c5a380243142c6e9baf2.zip
Merge branch 'selectmenu' of github.com:jquery/jquery-ui into selectmenu
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/spinner/spinner_methods.js32
-rw-r--r--tests/unit/widget/widget_core.js13
2 files changed, 44 insertions, 1 deletions
diff --git a/tests/unit/spinner/spinner_methods.js b/tests/unit/spinner/spinner_methods.js
index 4f44a73ae..41c991be3 100644
--- a/tests/unit/spinner/spinner_methods.js
+++ b/tests/unit/spinner/spinner_methods.js
@@ -73,6 +73,38 @@ test( "enable", function() {
equal( 2, element.val(), "keyboard - value changes on key UP" );
});
+test( "isValid", function() {
+ expect( 8 );
+ var element = $( "#spin" ).spinner({
+ min: 0,
+ max: 10,
+ step: 2
+ }),
+ spinner = element.spinner( "instance" );
+ ok( !spinner.isValid(), "initial state is invalid" );
+
+ element.val( "this is not a number" );
+ ok( !spinner.isValid(), "text string is not valid" );
+
+ element.val( "0" );
+ ok( spinner.isValid(), "min value is valid" );
+
+ element.val( "10" );
+ ok( spinner.isValid(), "max value is valid" );
+
+ element.val( "4" );
+ ok( spinner.isValid(), "inbetween step is valid" );
+
+ element.val( "-1" );
+ ok( !spinner.isValid(), "below min is invalid" );
+
+ element.val( "11" );
+ ok( !spinner.isValid(), "above max is invalid" );
+
+ element.val( "1" );
+ ok( !spinner.isValid(), "step mismatch is invalid" );
+});
+
test( "pageDown", function() {
expect( 4 );
var element = $( "#spin" ).val( -12 ).spinner({
diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js
index 3db79ec06..ec4c85874 100644
--- a/tests/unit/widget/widget_core.js
+++ b/tests/unit/widget/widget_core.js
@@ -1409,7 +1409,7 @@ asyncTest( "_delay", function() {
});
test( "$.widget.bridge()", function() {
- expect( 10 );
+ expect( 14 );
var instance, ret,
elem = $( "<div>" );
@@ -1427,6 +1427,9 @@ test( "$.widget.bridge()", function() {
},
getter: function() {
return "qux";
+ },
+ option: function( options ) {
+ deepEqual( options, {} );
}
});
@@ -1444,6 +1447,14 @@ test( "$.widget.bridge()", function() {
ret = elem.testWidget( "getter" );
equal( ret, "qux", "getter returns value" );
+
+ elem.testWidget();
+ ok( true, "_init is optional" );
+
+ TestWidget.prototype._init = function() {
+ ok( "_init", "_init now exists, so its called" );
+ };
+ elem.testWidget();
});
test( "$.widget.bridge() - widgetFullName", function() {