"preset": "wikimedia",
"disallowQuotedKeysInObjects": null,
- "requireSpacesInsideParentheses": null,
"requireSpacesInsideArrayBrackets": null,
"requireVarDeclFirst": null,
"requireSpacesInsideBrackets": null,
}
if ( !process.env.MW_SCRIPT_PATH ) {
grunt.log.error( 'Environment variable MW_SCRIPT_PATH must be set.\n' +
- 'Set this like $wgScriptPath, e.g. "/w"');
+ 'Set this like $wgScriptPath, e.g. "/w"' );
}
return !!( process.env.MW_SERVER && process.env.MW_SCRIPT_PATH );
} );
var $label, labelText;
function syncText() {
- var value = $(this).val()
+ var value = $( this ).val()
.replace( /[\[\]\{\}|#<>%+? ]/g, '_' )
.replace( /&/, '&' )
.replace( /__+/g, '_' )
.find( '.mw-help-field-hint' )
.show()
.click( function () {
- $(this)
+ $( this )
.closest( '.mw-help-field-container' )
.find( '.mw-help-field-data' )
.slideToggle( 'fast' );
// Show/hide code for DB-specific options
// FIXME: Do we want slow, fast, or even non-animated (instantaneous) showing/hiding here?
$( '.dbRadio' ).each( function () {
- $( document.getElementById( $(this).attr( 'rel' ) ) ).hide();
+ $( document.getElementById( $( this ).attr( 'rel' ) ) ).hide();
} );
$( document.getElementById( $( '.dbRadio:checked' ).attr( 'rel' ) ) ).show();
$( '.dbRadio' ).click( function () {
// Show/hide random stuff (email, upload)
$( '.showHideRadio' ).click( function () {
- var $wrapper = $( '#' + $(this).attr( 'rel' ) );
- if ( $(this).is( ':checked' ) ) {
+ var $wrapper = $( '#' + $( this ).attr( 'rel' ) );
+ if ( $( this ).is( ':checked' ) ) {
$wrapper.show( 'slow' );
} else {
$wrapper.hide( 'slow' );
}
} );
$( '.hideShowRadio' ).click( function () {
- var $wrapper = $( '#' + $(this).attr( 'rel' ) );
- if ( $(this).is( ':checked' ) ) {
+ var $wrapper = $( '#' + $( this ).attr( 'rel' ) );
+ if ( $( this ).is( ':checked' ) ) {
$wrapper.hide( 'slow' );
} else {
$wrapper.show( 'slow' );
// Enable/disable "other" textboxes
$( '.enableForOther' ).click( function () {
- var $textbox = $( document.getElementById( $(this).attr( 'rel' ) ) );
+ var $textbox = $( document.getElementById( $( this ).attr( 'rel' ) ) );
// FIXME: Ugh, this is ugly
- if ( $(this).val() === 'other' ) {
+ if ( $( this ).val() === 'other' ) {
$textbox.removeProp( 'readonly' ).closest( '.config-block' ).slideDown( 'fast' );
} else {
$textbox.prop( 'readonly', true ).closest( '.config-block' ).slideUp( 'fast' );
}
// We override the animation for all of these color styles
- $.each([
+ $.each( [
'backgroundColor',
'borderBottomColor',
'borderLeftColor',
}
fx.elem.style[attr] = 'rgb(' + [
- Math.max( Math.min( parseInt( (fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10 ), 255 ), 0 ),
- Math.max( Math.min( parseInt( (fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10 ), 255 ), 0 ),
- Math.max( Math.min( parseInt( (fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10 ), 255 ), 0 )
+ Math.max( Math.min( parseInt( ( fx.pos * ( fx.end[0] - fx.start[0] ) ) + fx.start[0], 10 ), 255 ), 0 ),
+ Math.max( Math.min( parseInt( ( fx.pos * ( fx.end[1] - fx.start[1] ) ) + fx.start[1], 10 ), 255 ), 0 ),
+ Math.max( Math.min( parseInt( ( fx.pos * ( fx.end[2] - fx.start[2] ) ) + fx.start[2], 10 ), 255 ), 0 )
].join( ',' ) + ')';
};
} );
}
// Look for rgb(num,num,num)
- if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) {
+ if ( result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec( color ) ) {
return [
parseInt( result[1], 10 ),
parseInt( result[2], 10 ),
}
// Look for rgb(num%,num%,num%)
- if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) {
+ if ( result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec( color ) ) {
return [
parseFloat( result[1] ) * 2.55,
parseFloat( result[2] ) * 2.55,
}
// Look for #a0b1c2
- if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) {
+ if ( result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec( color ) ) {
return [
parseInt( result[1], 16 ),
parseInt( result[2], 16 ),
}
// Look for #fff
- if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) {
+ if ( result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec( color ) ) {
return [
parseInt( result[1] + result[1], 16 ),
parseInt( result[2] + result[2], 16 ),
- parseInt( result[3] + result[3], 16)
+ parseInt( result[3] + result[3], 16 )
];
}
// Look for rgba(0, 0, 0, 0) == transparent in Safari 3
- if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) {
+ if ( result = /rgba\(0, 0, 0, 0\)/.exec( color ) ) {
return $.colorUtil.colors.transparent;
}
// Otherwise, we're most likely dealing with a named color
- return $.colorUtil.colors[$.trim(color).toLowerCase()];
+ return $.colorUtil.colors[$.trim( color ).toLowerCase()];
},
/**
min = Math.min( r, g, b ),
h,
s,
- l = (max + min) / 2;
+ l = ( max + min ) / 2;
if ( max === min ) {
// achromatic
h = s = 0;
} else {
d = max - min;
- s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
+ s = l > 0.5 ? d / ( 2 - max - min ) : d / ( max + min );
switch ( max ) {
case r:
- h = (g - b) / d + (g < b ? 6 : 0);
+ h = ( g - b ) / d + ( g < b ? 6 : 0 );
break;
case g:
- h = (b - r) / d + 2;
+ h = ( b - r ) / d + 2;
break;
case b:
- h = (r - g) / d + 4;
+ h = ( r - g ) / d + 4;
break;
}
h /= 6;
t -= 1;
}
if ( t < 1 / 6 ) {
- return p + (q - p) * 6 * t;
+ return p + ( q - p ) * 6 * t;
}
if ( t < 1 / 2 ) {
return q;
}
if ( t < 2 / 3 ) {
- return p + (q - p) * (2 / 3 - t) * 6;
+ return p + ( q - p ) * ( 2 / 3 - t ) * 6;
}
return p;
};
- q = l < 0.5 ? l * (1 + s) : l + s - l * s;
+ q = l < 0.5 ? l * ( 1 + s ) : l + s - l * s;
p = 2 * l - q;
r = hue2rgb( p, q, h + 1 / 3 );
g = hue2rgb( p, q, h );
*/
getColorBrightness: function ( currentColor, mod ) {
var rgbArr = $.colorUtil.getRGB( currentColor ),
- hslArr = $.colorUtil.rgbToHsl(rgbArr[0], rgbArr[1], rgbArr[2] );
- rgbArr = $.colorUtil.hslToRgb(hslArr[0], hslArr[1], hslArr[2] + mod);
+ hslArr = $.colorUtil.rgbToHsl( rgbArr[0], rgbArr[1], rgbArr[2] );
+ rgbArr = $.colorUtil.hslToRgb( hslArr[0], hslArr[1], hslArr[2] + mod );
return 'rgb(' +
- [parseInt( rgbArr[0], 10), parseInt( rgbArr[1], 10 ), parseInt( rgbArr[2], 10 )].join( ',' ) +
+ [parseInt( rgbArr[0], 10 ), parseInt( rgbArr[1], 10 ), parseInt( rgbArr[2], 10 )].join( ',' ) +
')';
}
* @version 2.1.0
* @license MIT
*/
-( function ($) {
+( function ( $ ) {
- var isInputSupported = 'placeholder' in document.createElement('input'),
- isTextareaSupported = 'placeholder' in document.createElement('textarea'),
+ var isInputSupported = 'placeholder' in document.createElement( 'input' ),
+ isTextareaSupported = 'placeholder' in document.createElement( 'textarea' ),
prototype = $.fn,
valHooks = $.valHooks,
propHooks = $.propHooks,
// https://github.com/mathiasbynens/jquery-placeholder/pull/99
try {
return document.activeElement;
- } catch (err) {}
+ } catch ( err ) {}
}
- function args(elem) {
+ function args( elem ) {
// Return an object of element attributes
var newAttrs = {},
rinlinejQuery = /^jQuery\d+$/;
- $.each(elem.attributes, function (i, attr) {
- if (attr.specified && !rinlinejQuery.test(attr.name)) {
+ $.each( elem.attributes, function ( i, attr ) {
+ if ( attr.specified && !rinlinejQuery.test( attr.name ) ) {
newAttrs[attr.name] = attr.value;
}
- });
+ } );
return newAttrs;
}
- function clearPlaceholder(event, value) {
+ function clearPlaceholder( event, value ) {
var input = this,
- $input = $(input);
- if (input.value === $input.attr('placeholder') && $input.hasClass('placeholder')) {
- if ($input.data('placeholder-password')) {
- $input = $input.hide().next().show().attr('id', $input.removeAttr('id').data('placeholder-id'));
+ $input = $( input );
+ if ( input.value === $input.attr( 'placeholder' ) && $input.hasClass( 'placeholder' ) ) {
+ if ( $input.data( 'placeholder-password' ) ) {
+ $input = $input.hide().next().show().attr( 'id', $input.removeAttr( 'id' ).data( 'placeholder-id' ) );
// If `clearPlaceholder` was called from `$.valHooks.input.set`
- if (event === true) {
+ if ( event === true ) {
$input[0].value = value;
return value;
}
$input.focus();
} else {
input.value = '';
- $input.removeClass('placeholder');
- if (input === safeActiveElement()) {
+ $input.removeClass( 'placeholder' );
+ if ( input === safeActiveElement() ) {
input.select();
}
}
function setPlaceholder() {
var $replacement,
input = this,
- $input = $(input),
+ $input = $( input ),
id = this.id;
- if (!input.value) {
- if (input.type === 'password') {
- if (!$input.data('placeholder-textinput')) {
+ if ( !input.value ) {
+ if ( input.type === 'password' ) {
+ if ( !$input.data( 'placeholder-textinput' ) ) {
try {
- $replacement = $input.clone().attr({ 'type': 'text' });
- } catch (e) {
- $replacement = $('<input>').attr($.extend(args(this), { 'type': 'text' }));
+ $replacement = $input.clone().attr( { 'type': 'text' } );
+ } catch ( e ) {
+ $replacement = $( '<input>' ).attr( $.extend( args( this ), { 'type': 'text' } ) );
}
$replacement
- .removeAttr('name')
- .data({
+ .removeAttr( 'name' )
+ .data( {
'placeholder-password': $input,
'placeholder-id': id
- })
- .bind('focus.placeholder drop.placeholder', clearPlaceholder);
+ } )
+ .bind( 'focus.placeholder drop.placeholder', clearPlaceholder );
$input
- .data({
+ .data( {
'placeholder-textinput': $replacement,
'placeholder-id': id
- })
- .before($replacement);
+ } )
+ .before( $replacement );
}
- $input = $input.removeAttr('id').hide().prev().attr('id', id).show();
+ $input = $input.removeAttr( 'id' ).hide().prev().attr( 'id', id ).show();
// Note: `$input[0] != input` now!
}
- $input.addClass('placeholder');
- $input[0].value = $input.attr('placeholder');
+ $input.addClass( 'placeholder' );
+ $input[0].value = $input.attr( 'placeholder' );
} else {
- $input.removeClass('placeholder');
+ $input.removeClass( 'placeholder' );
}
}
- function changePlaceholder(text) {
+ function changePlaceholder( text ) {
var hasArgs = arguments.length,
$input = this;
- if (hasArgs) {
- if ($input.attr('placeholder') !== text) {
- $input.prop('placeholder', text);
- if ($input.hasClass('placeholder')) {
+ if ( hasArgs ) {
+ if ( $input.attr( 'placeholder' ) !== text ) {
+ $input.prop( 'placeholder', text );
+ if ( $input.hasClass( 'placeholder' ) ) {
$input[0].value = text;
}
}
}
}
- if (isInputSupported && isTextareaSupported) {
+ if ( isInputSupported && isTextareaSupported ) {
- placeholder = prototype.placeholder = function (text) {
+ placeholder = prototype.placeholder = function ( text ) {
var hasArgs = arguments.length;
- if (hasArgs) {
- changePlaceholder.call(this, text);
+ if ( hasArgs ) {
+ changePlaceholder.call( this, text );
}
return this;
} else {
- placeholder = prototype.placeholder = function (text) {
+ placeholder = prototype.placeholder = function ( text ) {
var $this = this,
hasArgs = arguments.length;
- if (hasArgs) {
- changePlaceholder.call(this, text);
+ if ( hasArgs ) {
+ changePlaceholder.call( this, text );
}
$this
- .filter((isInputSupported ? 'textarea' : ':input') + '[placeholder]')
+ .filter( ( isInputSupported ? 'textarea' : ':input' ) + '[placeholder]' )
.filter( function () {
- return !$(this).data('placeholder-enabled');
- })
- .bind({
+ return !$( this ).data( 'placeholder-enabled' );
+ } )
+ .bind( {
'focus.placeholder drop.placeholder': clearPlaceholder,
'blur.placeholder': setPlaceholder
- })
- .data('placeholder-enabled', true)
- .trigger('blur.placeholder');
+ } )
+ .data( 'placeholder-enabled', true )
+ .trigger( 'blur.placeholder' );
return $this;
};
placeholder.textarea = isTextareaSupported;
hooks = {
- 'get': function (element) {
- var $element = $(element),
- $passwordInput = $element.data('placeholder-password');
- if ($passwordInput) {
+ 'get': function ( element ) {
+ var $element = $( element ),
+ $passwordInput = $element.data( 'placeholder-password' );
+ if ( $passwordInput ) {
return $passwordInput[0].value;
}
- return $element.data('placeholder-enabled') && $element.hasClass('placeholder') ? '' : element.value;
+ return $element.data( 'placeholder-enabled' ) && $element.hasClass( 'placeholder' ) ? '' : element.value;
},
- 'set': function (element, value) {
- var $element = $(element),
- $passwordInput = $element.data('placeholder-password');
- if ($passwordInput) {
+ 'set': function ( element, value ) {
+ var $element = $( element ),
+ $passwordInput = $element.data( 'placeholder-password' );
+ if ( $passwordInput ) {
$passwordInput[0].value = value;
return value;
}
- if (!$element.data('placeholder-enabled')) {
+ if ( !$element.data( 'placeholder-enabled' ) ) {
element.value = value;
return value;
}
- if (!value) {
+ if ( !value ) {
element.value = value;
// Issue #56: Setting the placeholder causes problems if the element continues to have focus.
- if (element !== safeActiveElement()) {
+ if ( element !== safeActiveElement() ) {
// We can't use `triggerHandler` here because of dummy text/password inputs :(
- setPlaceholder.call(element);
+ setPlaceholder.call( element );
}
- } else if ($element.hasClass('placeholder')) {
- if (!clearPlaceholder.call(element, true, value)) {
+ } else if ( $element.hasClass( 'placeholder' ) ) {
+ if ( !clearPlaceholder.call( element, true, value ) ) {
element.value = value;
}
} else {
}
};
- if (!isInputSupported) {
+ if ( !isInputSupported ) {
valHooks.input = hooks;
propHooks.value = hooks;
}
- if (!isTextareaSupported) {
+ if ( !isTextareaSupported ) {
valHooks.textarea = hooks;
propHooks.value = hooks;
}
$( function () {
// Look for forms
- $(document).delegate('form', 'submit.placeholder', function () {
+ $( document ).delegate( 'form', 'submit.placeholder', function () {
// Clear the placeholder values so they don't get submitted
- var $inputs = $('.placeholder', this).each(clearPlaceholder);
+ var $inputs = $( '.placeholder', this ).each( clearPlaceholder );
setTimeout( function () {
- $inputs.each(setPlaceholder);
- }, 10);
- });
- });
+ $inputs.each( setPlaceholder );
+ }, 10 );
+ } );
+ } );
// Clear placeholder values upon page reload
- $(window).bind('beforeunload.placeholder', function () {
- $('.placeholder').each( function () {
+ $( window ).bind( 'beforeunload.placeholder', function () {
+ $( '.placeholder' ).each( function () {
this.value = '';
- });
- });
+ } );
+ } );
}
-}(jQuery));
+}( jQuery ) );
* @return {jQuery}
*/
function getHiddenInput( name, val ) {
- return $( '<input type="hidden" />')
+ return $( '<input type="hidden" />' )
.attr( 'name', name )
.val( val );
}
word = word.replace( /nuntii$/i, 'nuntios' );// 2nd declension plural (partly)
word = word.replace( /tio$/i, 'tionem' ); // 3rd declension singular (partly)
word = word.replace( /ns$/i, 'ntem' );
- word = word.replace( /as$/i, 'atem');
+ word = word.replace( /as$/i, 'atem' );
word = word.replace( /es$/i, 'em' ); // 5th declension singular
break;
case 'ablative':
word = word.replace( /nuntii$/i, 'nuntiis' ); // 2nd declension plural (partly)
word = word.replace( /tio$/i, 'tione' ); // 3rd declension singular (partly)
word = word.replace( /ns$/i, 'nte' );
- word = word.replace( /as$/i, 'ate');
+ word = word.replace( /as$/i, 'ate' );
word = word.replace( /es$/i, 'e' ); // 5th declension singular
break;
}
case 'genitive': // родовий відмінок
if ( word.slice( -4 ) !== 'вікі' && word.slice( -4 ) !== 'Вікі' ) {
if ( word.slice( -1 ) === 'ь' ) {
- word = word.slice(0, -1 ) + 'я';
+ word = word.slice( 0, -1 ) + 'я';
} else if ( word.slice( -2 ) === 'ія' ) {
- word = word.slice(0, -2 ) + 'ії';
+ word = word.slice( 0, -2 ) + 'ії';
} else if ( word.slice( -2 ) === 'ка' ) {
- word = word.slice(0, -2 ) + 'ки';
+ word = word.slice( 0, -2 ) + 'ки';
} else if ( word.slice( -2 ) === 'ти' ) {
- word = word.slice(0, -2 ) + 'тей';
+ word = word.slice( 0, -2 ) + 'тей';
} else if ( word.slice( -2 ) === 'ды' ) {
- word = word.slice(0, -2 ) + 'дов';
+ word = word.slice( 0, -2 ) + 'дов';
} else if ( word.slice( -3 ) === 'ник' ) {
- word = word.slice(0, -3 ) + 'ника';
+ word = word.slice( 0, -3 ) + 'ника';
}
}
break;
case 'accusative': // знахідний відмінок
if ( word.slice( -4 ) !== 'вікі' && word.slice( -4 ) !== 'Вікі' ) {
if ( word.slice( -2 ) === 'ія' ) {
- word = word.slice(0, -2 ) + 'ію';
+ word = word.slice( 0, -2 ) + 'ію';
}
}
break;
decimal: '.'
};
- if ( isNaN( value) ) {
+ if ( isNaN( value ) ) {
return value;
}
// Disable the button to save preferences unless preferences have changed
$( '#prefcontrol' ).prop( 'disabled', true );
$( '.prefsection' ).one( 'change keydown mousedown', function () {
- $( '#prefcontrol' ).prop( 'disabled', false);
+ $( '#prefcontrol' ).prop( 'disabled', false );
} );
// Enable keyboard users to use left and right keys to switch tabs
* @return {String} Such as 'data/foo.js?131031765087663960'
*/
QUnit.fixurl = function ( value ) {
- return value + (/\?/.test( value ) ? '&' : '?')
+ return value + ( /\?/.test( value ) ? '&' : '?' )
+ String( new Date().getTime() )
+ String( parseInt( Math.random() * 100000, 10 ) );
};
$.each( $.timers, function ( i, timer ) {
var node = timer.elem;
mw.log.warn( 'Unfinished animation #' + i + ' in ' + timer.queue + ' queue on ' +
- mw.html.element( node.nodeName.toLowerCase(), $(node).getAttrs() )
+ mw.html.element( node.nodeName.toLowerCase(), $( node ).getAttrs() )
);
} );
// Force animations to stop to give the next test a clean start
teardown: function () {
this.restoreWarnings();
}
- }) );
+ } ) );
QUnit.test( 'String functions', 7, function ( assert ) {
assert.equal( $.trimLeft( ' foo bar ' ), 'foo bar ', 'trimLeft' );
-( function ($) {
+( function ( $ ) {
- QUnit.module('jquery.placeholder', QUnit.newMwEnvironment());
+ QUnit.module( 'jquery.placeholder', QUnit.newMwEnvironment() );
- QUnit.test('caches results of feature tests', 2, function (assert) {
- assert.strictEqual( typeof $.fn.placeholder.input, 'boolean', '$.fn.placeholder.input');
- assert.strictEqual( typeof $.fn.placeholder.textarea, 'boolean', '$.fn.placeholder.textarea');
- });
+ QUnit.test( 'caches results of feature tests', 2, function ( assert ) {
+ assert.strictEqual( typeof $.fn.placeholder.input, 'boolean', '$.fn.placeholder.input' );
+ assert.strictEqual( typeof $.fn.placeholder.textarea, 'boolean', '$.fn.placeholder.textarea' );
+ } );
- if ($.fn.placeholder.input && $.fn.placeholder.textarea) {
+ if ( $.fn.placeholder.input && $.fn.placeholder.textarea ) {
return;
}
'<input id="input-type-password" type="password" placeholder="e.g. hunter2">' +
'<textarea id="textarea" name="message" placeholder="Your message goes here"></textarea>' +
'</form>',
- testElement = function ($el, assert) {
+ testElement = function ( $el, assert ) {
var el = $el[0],
- placeholder = el.getAttribute('placeholder');
+ placeholder = el.getAttribute( 'placeholder' );
- assert.strictEqual($el.placeholder(), $el, 'should be chainable');
+ assert.strictEqual( $el.placeholder(), $el, 'should be chainable' );
- assert.strictEqual(el.value, placeholder, 'should set `placeholder` text as `value`');
- assert.strictEqual($el.prop('value'), '', 'propHooks works properly');
- assert.strictEqual($el.val(), '', 'valHooks works properly');
- assert.ok($el.hasClass('placeholder'), 'should have `placeholder` class');
+ assert.strictEqual( el.value, placeholder, 'should set `placeholder` text as `value`' );
+ assert.strictEqual( $el.prop( 'value' ), '', 'propHooks works properly' );
+ assert.strictEqual( $el.val(), '', 'valHooks works properly' );
+ assert.ok( $el.hasClass( 'placeholder' ), 'should have `placeholder` class' );
// test on focus
$el.focus();
- assert.strictEqual(el.value, '', '`value` should be the empty string on focus');
- assert.strictEqual($el.prop('value'), '', 'propHooks works properly');
- assert.strictEqual($el.val(), '', 'valHooks works properly');
- assert.ok(!$el.hasClass('placeholder'), 'should not have `placeholder` class on focus');
+ assert.strictEqual( el.value, '', '`value` should be the empty string on focus' );
+ assert.strictEqual( $el.prop( 'value' ), '', 'propHooks works properly' );
+ assert.strictEqual( $el.val(), '', 'valHooks works properly' );
+ assert.ok( !$el.hasClass( 'placeholder' ), 'should not have `placeholder` class on focus' );
// and unfocus (blur) again
$el.blur();
- assert.strictEqual(el.value, placeholder, 'should set `placeholder` text as `value`');
- assert.strictEqual($el.prop('value'), '', 'propHooks works properly');
- assert.strictEqual($el.val(), '', 'valHooks works properly');
- assert.ok($el.hasClass('placeholder'), 'should have `placeholder` class');
+ assert.strictEqual( el.value, placeholder, 'should set `placeholder` text as `value`' );
+ assert.strictEqual( $el.prop( 'value' ), '', 'propHooks works properly' );
+ assert.strictEqual( $el.val(), '', 'valHooks works properly' );
+ assert.ok( $el.hasClass( 'placeholder' ), 'should have `placeholder` class' );
// change the value
- $el.val('lorem ipsum');
- assert.strictEqual($el.prop('value'), 'lorem ipsum', '`$el.val(string)` should change the `value` property');
- assert.strictEqual(el.value, 'lorem ipsum', '`$el.val(string)` should change the `value` attribute');
- assert.ok(!$el.hasClass('placeholder'), '`$el.val(string)` should remove `placeholder` class');
+ $el.val( 'lorem ipsum' );
+ assert.strictEqual( $el.prop( 'value' ), 'lorem ipsum', '`$el.val(string)` should change the `value` property' );
+ assert.strictEqual( el.value, 'lorem ipsum', '`$el.val(string)` should change the `value` attribute' );
+ assert.ok( !$el.hasClass( 'placeholder' ), '`$el.val(string)` should remove `placeholder` class' );
// and clear it again
- $el.val('');
- assert.strictEqual($el.prop('value'), '', '`$el.val("")` should change the `value` property');
- assert.strictEqual(el.value, placeholder, '`$el.val("")` should change the `value` attribute');
- assert.ok($el.hasClass('placeholder'), '`$el.val("")` should re-enable `placeholder` class');
+ $el.val( '' );
+ assert.strictEqual( $el.prop( 'value' ), '', '`$el.val("")` should change the `value` property' );
+ assert.strictEqual( el.value, placeholder, '`$el.val("")` should change the `value` attribute' );
+ assert.ok( $el.hasClass( 'placeholder' ), '`$el.val("")` should re-enable `placeholder` class' );
// make sure the placeholder property works as expected.
- assert.strictEqual($el.prop('placeholder'), placeholder, '$el.prop(`placeholder`) should return the placeholder value');
- $el.placeholder('new placeholder');
- assert.strictEqual(el.getAttribute('placeholder'), 'new placeholder', '$el.placeholder(<string>) should set the placeholder value');
- assert.strictEqual(el.value, 'new placeholder', '$el.placeholder(<string>) should update the displayed placeholder value');
- $el.placeholder(placeholder);
+ assert.strictEqual( $el.prop( 'placeholder' ), placeholder, '$el.prop(`placeholder`) should return the placeholder value' );
+ $el.placeholder( 'new placeholder' );
+ assert.strictEqual( el.getAttribute( 'placeholder' ), 'new placeholder', '$el.placeholder(<string>) should set the placeholder value' );
+ assert.strictEqual( el.value, 'new placeholder', '$el.placeholder(<string>) should update the displayed placeholder value' );
+ $el.placeholder( placeholder );
};
- QUnit.test('emulates placeholder for <input type=text>', 22, function (assert) {
- $('<div>').html(html).appendTo($('#qunit-fixture'));
- testElement($('#input-type-text'), assert);
- });
+ QUnit.test( 'emulates placeholder for <input type=text>', 22, function ( assert ) {
+ $( '<div>' ).html( html ).appendTo( $( '#qunit-fixture' ) );
+ testElement( $( '#input-type-text' ), assert );
+ } );
- QUnit.test('emulates placeholder for <input type=search>', 22, function (assert) {
- $('<div>').html(html).appendTo($('#qunit-fixture'));
- testElement($('#input-type-search'), assert);
- });
+ QUnit.test( 'emulates placeholder for <input type=search>', 22, function ( assert ) {
+ $( '<div>' ).html( html ).appendTo( $( '#qunit-fixture' ) );
+ testElement( $( '#input-type-search' ), assert );
+ } );
- QUnit.test('emulates placeholder for <input type=email>', 22, function (assert) {
- $('<div>').html(html).appendTo($('#qunit-fixture'));
- testElement($('#input-type-email'), assert);
- });
+ QUnit.test( 'emulates placeholder for <input type=email>', 22, function ( assert ) {
+ $( '<div>' ).html( html ).appendTo( $( '#qunit-fixture' ) );
+ testElement( $( '#input-type-email' ), assert );
+ } );
- QUnit.test('emulates placeholder for <input type=url>', 22, function (assert) {
- $('<div>').html(html).appendTo($('#qunit-fixture'));
- testElement($('#input-type-url'), assert);
- });
+ QUnit.test( 'emulates placeholder for <input type=url>', 22, function ( assert ) {
+ $( '<div>' ).html( html ).appendTo( $( '#qunit-fixture' ) );
+ testElement( $( '#input-type-url' ), assert );
+ } );
- QUnit.test('emulates placeholder for <input type=tel>', 22, function (assert) {
- $('<div>').html(html).appendTo($('#qunit-fixture'));
- testElement($('#input-type-tel'), assert);
- });
+ QUnit.test( 'emulates placeholder for <input type=tel>', 22, function ( assert ) {
+ $( '<div>' ).html( html ).appendTo( $( '#qunit-fixture' ) );
+ testElement( $( '#input-type-tel' ), assert );
+ } );
- QUnit.test('emulates placeholder for <input type=password>', 13, function (assert) {
- $('<div>').html(html).appendTo($('#qunit-fixture'));
+ QUnit.test( 'emulates placeholder for <input type=password>', 13, function ( assert ) {
+ $( '<div>' ).html( html ).appendTo( $( '#qunit-fixture' ) );
var selector = '#input-type-password',
- $el = $(selector),
+ $el = $( selector ),
el = $el[0],
- placeholder = el.getAttribute('placeholder');
+ placeholder = el.getAttribute( 'placeholder' );
- assert.strictEqual($el.placeholder(), $el, 'should be chainable');
+ assert.strictEqual( $el.placeholder(), $el, 'should be chainable' );
// Re-select the element, as it gets replaced by another one in some browsers
- $el = $(selector);
+ $el = $( selector );
el = $el[0];
- assert.strictEqual(el.value, placeholder, 'should set `placeholder` text as `value`');
- assert.strictEqual($el.prop('value'), '', 'propHooks works properly');
- assert.strictEqual($el.val(), '', 'valHooks works properly');
- assert.ok($el.hasClass('placeholder'), 'should have `placeholder` class');
+ assert.strictEqual( el.value, placeholder, 'should set `placeholder` text as `value`' );
+ assert.strictEqual( $el.prop( 'value' ), '', 'propHooks works properly' );
+ assert.strictEqual( $el.val(), '', 'valHooks works properly' );
+ assert.ok( $el.hasClass( 'placeholder' ), 'should have `placeholder` class' );
// test on focus
$el.focus();
// Re-select the element, as it gets replaced by another one in some browsers
- $el = $(selector);
+ $el = $( selector );
el = $el[0];
- assert.strictEqual(el.value, '', '`value` should be the empty string on focus');
- assert.strictEqual($el.prop('value'), '', 'propHooks works properly');
- assert.strictEqual($el.val(), '', 'valHooks works properly');
- assert.ok(!$el.hasClass('placeholder'), 'should not have `placeholder` class on focus');
+ assert.strictEqual( el.value, '', '`value` should be the empty string on focus' );
+ assert.strictEqual( $el.prop( 'value' ), '', 'propHooks works properly' );
+ assert.strictEqual( $el.val(), '', 'valHooks works properly' );
+ assert.ok( !$el.hasClass( 'placeholder' ), 'should not have `placeholder` class on focus' );
// and unfocus (blur) again
$el.blur();
// Re-select the element, as it gets replaced by another one in some browsers
- $el = $(selector);
+ $el = $( selector );
el = $el[0];
- assert.strictEqual(el.value, placeholder, 'should set `placeholder` text as `value`');
- assert.strictEqual($el.prop('value'), '', 'propHooks works properly');
- assert.strictEqual($el.val(), '', 'valHooks works properly');
- assert.ok($el.hasClass('placeholder'), 'should have `placeholder` class');
+ assert.strictEqual( el.value, placeholder, 'should set `placeholder` text as `value`' );
+ assert.strictEqual( $el.prop( 'value' ), '', 'propHooks works properly' );
+ assert.strictEqual( $el.val(), '', 'valHooks works properly' );
+ assert.ok( $el.hasClass( 'placeholder' ), 'should have `placeholder` class' );
- });
+ } );
- QUnit.test('emulates placeholder for <textarea></textarea>', 22, function (assert) {
- $('<div>').html(html).appendTo($('#qunit-fixture'));
- testElement($('#textarea'), assert);
- });
+ QUnit.test( 'emulates placeholder for <textarea></textarea>', 22, function ( assert ) {
+ $( '<div>' ).html( html ).appendTo( $( '#qunit-fixture' ) );
+ testElement( $( '#textarea' ), assert );
+ } );
-}(jQuery));
+}( jQuery ) );
QUnit.test( msg, data.length * 2, function ( assert ) {
var extractedR, extractedF, parser;
- if (callback !== undefined ) {
+ if ( callback !== undefined ) {
callback();
}
'</tbody></table>' );
$table.tablesorter();
- assert.equal( $table.find( 'tr:eq(1) th:eq(1)').data('headerIndex'),
+ assert.equal( $table.find( 'tr:eq(1) th:eq(1)' ).data( 'headerIndex' ),
2,
'Incorrect index of sort header'
);
title = new mw.Title( 'Foobar' );
assert.equal( title.getUrl(), '/wiki/Foobar', 'Basic functionality, getUrl uses mw.util.getUrl' );
- assert.equal( title.getUrl({ action: 'edit' }), '/wiki/Foobar?action=edit', 'Basic functionality, \'params\' parameter' );
+ assert.equal( title.getUrl( { action: 'edit' } ), '/wiki/Foobar?action=edit', 'Basic functionality, \'params\' parameter' );
title = new mw.Title( 'John Doe', 3 );
assert.equal( title.getUrl(), '/wiki/User_talk:John_Doe', 'Escaping in title and namespace for urls' );
errorUrl = 'http://example.com',
errorLine = '123',
errorColumn = '45',
- errorObject = new Error( 'Foo'),
+ errorObject = new Error( 'Foo' ),
oldHandler = this.sandbox.stub();
this.sandbox.stub( mw, 'track' );
expected = repeat( '\n', n ) + 'some text';
$textarea = $( '<textarea>\n' + expected + '</textarea>' );
- assert.equal( $textarea.val(), expected, 'Expecting ' + n + ' newlines (HTML contained ' + (n + 1) + ')' );
+ assert.equal( $textarea.val(), expected, 'Expecting ' + n + ' newlines (HTML contained ' + ( n + 1 ) + ')' );
$textarea = $( '<textarea>' ).val( expected );
assert.equal( $textarea.val(), expected, 'Expecting ' + n + ' newlines (from DOM set with ' + n + ')' );
this.restoreWarnings();
// Change value via global Map
- globalConf.set('anotherGlobalMapChecker', 'Again');
+ globalConf.set( 'anotherGlobalMapChecker', 'Again' );
assert.equal( globalConf.get( 'anotherGlobalMapChecker' ), 'Again', 'Change in global Map reflected via get()' );
this.suppressWarnings();
assert.equal( window.anotherGlobalMapChecker, 'Again', 'Change in global Map reflected window object' );