]> source.dussan.org Git - jquery-ui.git/commitdiff
Widget: Tests code cleanup
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Mon, 12 Sep 2011 21:23:54 +0000 (23:23 +0200)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Mon, 12 Sep 2011 21:23:54 +0000 (23:23 +0200)
tests/unit/widget/widget_core.js
tests/unit/widget/widget_extend.js

index 41ae8ffb458e6a9e11eb04c38409a0d4efe21486..0c41425395d4a5836bca7ce297816a39a862ac71 100644 (file)
@@ -571,23 +571,23 @@ test( ".widget() - overriden", function() {
 
 test( "._bind() to element (default)", function() {
        expect( 12 );
-       var self;
+       var that;
        $.widget( "ui.testWidget", {
                _create: function() {
-                       self = this;
+                       that = this;
                        this._bind({
                                keyup: this.keyup,
                                keydown: "keydown"
                        });
                },
                keyup: function( event ) {
-                       equals( self, this );
-                       equals( self.element[0], event.currentTarget );
+                       equals( that, this );
+                       equals( that.element[0], event.currentTarget );
                        equals( "keyup", event.type );
                },
                keydown: function( event ) {
-                       equals( self, this );
-                       equals( self.element[0], event.currentTarget );
+                       equals( that, this );
+                       equals( that.element[0], event.currentTarget );
                        equals( "keydown", event.type );
                }
        });
@@ -611,23 +611,23 @@ test( "._bind() to element (default)", function() {
 
 test( "._bind() to descendent", function() {
        expect( 12 );
-       var self;
+       var that;
        $.widget( "ui.testWidget", {
                _create: function() {
-                       self = this;
+                       that = this;
                        this._bind( this.element.find( "strong" ), {
                                keyup: this.keyup,
                                keydown: "keydown"
                        });
                },
                keyup: function( event ) {
-                       equals( self, this );
-                       equals( self.element.find( "strong" )[0], event.currentTarget );
+                       equals( that, this );
+                       equals( that.element.find( "strong" )[0], event.currentTarget );
                        equals( "keyup", event.type );
                },
                keydown: function(event) {
-                       equals( self, this );
-                       equals( self.element.find( "strong" )[0], event.currentTarget );
+                       equals( that, this );
+                       equals( that.element.find( "strong" )[0], event.currentTarget );
                        equals( "keydown", event.type );
                }
        });
@@ -987,31 +987,31 @@ test( "._trigger() - instance as element", function() {
                        $( "#widget" ).testWidget().remove();
                });
        });
-       
+
        test( "auto-destroy - .remove() on parent", function() {
                shouldDestroy( true, function() {
                        $( "#widget" ).testWidget().parent().remove();
                });
        });
-       
+
        test( "auto-destroy - .remove() on child", function() {
                shouldDestroy( false, function() {
                        $( "#widget" ).testWidget().children().remove();
                });
        });
-       
+
        test( "auto-destroy - .empty()", function() {
                shouldDestroy( false, function() {
                        $( "#widget" ).testWidget().empty();
                });
        });
-       
+
        test( "auto-destroy - .empty() on parent", function() {
                shouldDestroy( true, function() {
                        $( "#widget" ).testWidget().parent().empty();
                });
        });
-       
+
        test( "auto-destroy - .detach()", function() {
                shouldDestroy( false, function() {
                        $( "#widget" ).testWidget().detach();
index fb78ecfb709a3c7791284f819bbc5ba48c04d19b..90e686e18efc57b45e7ded627f1a04ca2a000aa6 100644 (file)
@@ -6,7 +6,6 @@ test( "$.widget.extend()", function() {
                optionsCopy = { xnumber2: 1, xstring2: "x", xxx: "newstring" },
                merged = { xnumber1: 5, xnumber2: 1, xstring1: "peter", xstring2: "x", xxx: "newstring" },
                deep1 = { foo: { bar: true } },
-               deep1copy = { foo: { bar: true } },
                deep2 = { foo: { baz: true }, foo2: document },
                deep2copy = { foo: { baz: true }, foo2: document },
                deepmerged = { foo: { bar: true, baz: true }, foo2: document },
@@ -93,10 +92,10 @@ test( "$.widget.extend()", function() {
        deepEqual( defaults, defaultsCopy, "Check if not modified: options1 must not be modified" );
        deepEqual( options1, options1Copy, "Check if not modified: options1 must not be modified" );
        deepEqual( options2, options2Copy, "Check if not modified: options2 must not be modified" );
-       
+
        var input = {
                key: [ 1, 2, 3 ]
-       }
+       };
        var output = $.widget.extend( {}, input );
        deepEqual( input, output, "don't clone arrays" );
        input.key[0] = 10;