Permalink
Browse files

Mask/Timepicker: Lint fixes. Units still fail.

  • Loading branch information...
1 parent 4929eed commit 4f5a83c4699f32d8b0c4ea0bcd01d6b64938bbe3 @jzaefferer jzaefferer committed Nov 17, 2012
@@ -28,7 +28,7 @@ test( "value: able to get (and set) raw values", function() {
test( "value: able to get (and set) raw values with optional section", function() {
expect( 5 );
var input = $( "#mask1" ).val("1234").mask({
- mask: "(999) 999-9999?x9999",
+ mask: "(999) 999-9999?x9999"
});
equal( input.mask('value'), "1234", "Reading initial value" );
@@ -5,11 +5,10 @@ module( "mask: options" );
test( "clearEmpty", function() {
expect( 4 );
var input = $( "#mask1" ).val( "" ).mask({
- mask: "99/99/99",
- placeholder: "_",
- clearEmpty: true
- }),
- mask = input.data( "mask" );
+ mask: "99/99/99",
+ placeholder: "_",
+ clearEmpty: true
+ });
equal( input.val(), "", "Empty value with clearEmpty displays no mask" );
TestHelpers.focus( input );
@@ -48,7 +47,7 @@ test( "mask", function() {
test( "mask with optional input", function() {
expect( 1 );
var input = $( "#mask1" ).val( "1234" ).mask({
- mask: "(999) 999-9999?x9999",
+ mask: "(999) 999-9999?x9999"
});
equal( input.val(), "(123) 4__-____", "Initial value" );
@@ -57,7 +56,7 @@ test( "mask with optional input", function() {
test( "mask with multiple optional inputs", function() {
expect( 1 );
var input = $( "#mask1" ).val( "1234" ).mask({
- mask: "(999) 999-9999?x9?9?9?9",
+ mask: "(999) 999-9999?x9?9?9?9"
});
equal( input.val(), "(123) 4__-____", "Initial value" );
@@ -66,7 +65,7 @@ test( "mask with multiple optional inputs", function() {
test( "mask with escaped characters", function() {
expect( 1 );
var input = $( "#mask1" ).val( "1234" ).mask({
- mask: "(\\9\\9\\9)\\\\ 999-99\\a\\*\\?x9999",
+ mask: "(\\9\\9\\9)\\\\ 999-99\\a\\*\\?x9999"
});
equal( input.val(), "(999)\\ 123-4_a*?x____", "Initial value" );
@@ -75,7 +74,7 @@ test( "mask with escaped characters", function() {
test( "escaped use of custom mask with wrapper ", function() {
expect( 1 );
var input = $( "#mask1" ).val( "1" ).mask({
- mask: "9\\<xyz\\>",
+ mask: "9\\<xyz\\>"
});
equal( input.val(), "1<xyz>", "Initial value" );
@@ -90,23 +89,23 @@ test( "custom mask with wrapper and escape", function() {
if ( $.inArray(value, [ "mon", "tue", "wed", "thu", "fri", "sat", "sun" ]) ) {
return value;
} else if ( $.inArray(value, [ "m", "mo" ])) {
- return "mon";
+ return "mon";
} else if ( value === "t" ) {
- return "t";
+ return "t";
} else if ( value === "tu" ) {
- return "tue";
+ return "tue";
} else if ( value === "thu" ) {
- return "thu";
+ return "thu";
} else if ( $.inArray(value, [ "w", "we" ]) ) {
- return "wed";
+ return "wed";
} else if ( $.inArray(value, [ "f", "fr" ]) ) {
- return "fri";
+ return "fri";
} else if ( value === "s" ) {
- return "s";
+ return "s";
} else if ( value === "sa" ) {
- return "sat";
+ return "sat";
} else if ( value === "su" ) {
- return "sun";
+ return "sun";
}
},
d: /[0-9]/
@@ -1,5 +1,5 @@
-(function( $ ) {
+(function() {
module( "timepicker: core" );
-}( jQuery ) );
+}());
@@ -5,8 +5,7 @@ module( "timepicker: methods" );
test( "value - get and set value", function() {
expect( 3 );
- var i,
- input = $( "#timepicker1" ).val( "12:00:00 AM" ).timepicker();
+ var input = $( "#timepicker1" ).val( "12:00:00 AM" ).timepicker();
equal( input.timepicker( "value" ), "00:00:00", "Expected value for 12am" );
@@ -17,7 +16,7 @@ test( "value - get and set value", function() {
input.timepicker( "value", "12:34:56" );
equal( input.val(), "12:34:56 PM", "Expected val() for 12:34:56" );
-
+
});
}( jQuery ) );
View
@@ -161,7 +161,7 @@ $.widget( "ui.mask", {
return value;
},
_events: {
- focus: function( event ) {
+ focus: function() {
this.lastUnsavedValue = this.element.val();
this._paint( true );
this._caretSelect( this._seekRight( this._parseValue() ) );
@@ -171,18 +171,18 @@ $.widget( "ui.mask", {
this._justFocused = false;
}, 100);
},
- click: function( event ) {
- /* Normally, the call to handle this in the focus event handler would be
- sufficient, but Chrome fires the focus events before positioning the
- cursor based on where the user clicked (and then fires the click event). */
+ click: function() {
+ // Normally, the call to handle this in the focus event handler would be
+ // sufficient, but Chrome fires the focus events before positioning the
+ // cursor based on where the user clicked (and then fires the click event).
// We only want to move the caret on clicks that resulted in focus
if ( this._justFocused ) {
this._caretSelect( this._seekRight( this._parseValue() ) );
this._justFocused = false;
}
},
- blur: function( event ) {
+ blur: function() {
this._justFocused = false;
// because we are constantly setting the value of the input, the change event
@@ -311,7 +311,7 @@ $.widget( "ui.mask", {
}
return true;
},
- _paste: function(event) {
+ _paste: function() {
this._delay( function() {
var position = this._parseValue();
this._paint();
@@ -342,7 +342,7 @@ $.widget( "ui.mask", {
return true;
},
_removeCharacter: function( mask, index ) {
- var x, bufferObject;
+ var x, bufferObject;
for ( x = index ; x < mask.length - 1 ; x++ ) {
bufferObject = this.buffer[ x + 1 ];
@@ -361,7 +361,7 @@ $.widget( "ui.mask", {
return mask.substring( 0, index ) + mask.substring( index + 1 );
},
_parseMask: function() {
- var key, x, bufferObject, optionalPosition, builder,
+ var key, x, optionalPosition,
index = -1,
options = this.options,
mask = options.mask,
@@ -375,7 +375,7 @@ $.widget( "ui.mask", {
// search for escaped reserved characters
for ( index = 0 ; index < mask.length - 1 ; index++ ) {
if ( mask.charAt( index ) === "\\" &&
- $.inArray( mask.charAt( index + 1 ), reservedChars ) !== -1 ) {
+ $.inArray( mask.charAt( index + 1 ), reservedChars ) !== -1 ) {
// remove escape character
mask = mask.substring( 0, index ) + mask.substring( index + 1 );
@@ -193,7 +193,7 @@ $.widget( "ui.timepicker", {
return mask;
},
- _highlightField: function( field ) {
+ _highlightField: function() {
this.mask._caretSelect( this.currentField * 3 );
},
_setField: function( field ) {
@@ -267,4 +267,4 @@ $.widget( "ui.timepicker", {
}
});
-}( jQuery ));
+}( jQuery ));

0 comments on commit 4f5a83c

Please sign in to comment.