Set up node-jscs via Grunt (and pass it)
* Set up Grunt via package.json (run `npm install` in mediawiki-core) * Add grunt task for node-jscs (NEW) This is a style checker (as opposed to jshint, which is for code quality). There are a few small style-related things that JSHint can check (camelcase, onevar etc.) but those are being deprecated in JSHint v3, people should use more sophisticated tools like node-jscs for this instead. As such this commit removes moves of those options from our jshint configuration. See: http://jshint.com/blog/jshint-3-plans/ * Add grunt task for jshint This will use the same jshint configuration as we use on Jenkins but makes it easier to run locally from the command line by being part of the same `$ grunt test` task list. Also: * Changed jshintignore to use "dir/**"" instead of "/dir" or "dir" because the latter is not compatible with Grunt for some reason. See also https://github.com/gruntjs/grunt-contrib-jshint/issues/126. Examples of coding style rules that were being violated that we can now catch in node-jscs: * Operator "," should stick to preceding expression * Missing space after "if" keyword * Multiple line break * Empty block (in jquery.textSelection and mediawiki.language) Bug: 54218 Change-Id: Ib9d7eab9f0d5cea5fb33f0b9f82e5554897fdfe0
This commit is contained in:
parent
eba9eb1e50
commit
4ec6b0cce1
52 changed files with 983 additions and 899 deletions
30
.jscsrc
Normal file
30
.jscsrc
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"requireCurlyBraces": ["if", "else", "for", "while", "do"],
|
||||
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "function"],
|
||||
"requireParenthesesAroundIIFE": true,
|
||||
"requireSpacesInFunctionExpression": {
|
||||
"beforeOpeningCurlyBrace": true
|
||||
},
|
||||
"requireMultipleVarDecl": true,
|
||||
"disallowEmptyBlocks": true,
|
||||
"requireSpacesInsideObjectBrackets": "all",
|
||||
"disallowSpaceAfterObjectKeys": true,
|
||||
"requireCommaBeforeLineBreak": true,
|
||||
"disallowLeftStickedOperators": ["?", ">", ">=", "<", "<="],
|
||||
"disallowRightStickedOperators": ["?", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
|
||||
"requireRightStickedOperators": ["!"],
|
||||
"requireLeftStickedOperators": [","],
|
||||
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~"],
|
||||
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
|
||||
"requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
|
||||
"requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
|
||||
"disallowKeywords": [ "with" ],
|
||||
"disallowMultipleLineBreaks": true,
|
||||
"validateLineBreaks": "LF",
|
||||
"validateQuoteMarks": "'",
|
||||
"disallowMixedSpacesAndTabs": "smart",
|
||||
"disallowTrailingWhitespace": true,
|
||||
"requireLineFeedAtFileEnd": true,
|
||||
"requireCapitalizedConstructors": true,
|
||||
"requireDotNotation": true
|
||||
}
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
# Generated documentation
|
||||
docs/html/
|
||||
docs/js/
|
||||
resources/mediawiki.ui/docs
|
||||
docs/html/**
|
||||
docs/js/**
|
||||
resources/mediawiki.ui/docs/**
|
||||
|
||||
# kss template for mediawiki ui documentation
|
||||
resources/styleguide-template
|
||||
resources/styleguide-template/**
|
||||
|
||||
# third-party libs
|
||||
extensions/
|
||||
node_modules/
|
||||
extensions/**
|
||||
node_modules/**
|
||||
resources/jquery/jquery.appear.js
|
||||
resources/jquery/jquery.async.js
|
||||
resources/jquery/jquery.ba-throttle-debounce.js
|
||||
|
|
@ -26,14 +26,15 @@ resources/jquery/jquery.qunit.js
|
|||
resources/jquery/jquery.validate.js
|
||||
resources/jquery/jquery.xmldom.js
|
||||
resources/jquery.chosen/chosen.jquery.js
|
||||
resources/jquery.effects/
|
||||
resources/jquery.tipsy/
|
||||
resources/jquery.ui/
|
||||
resources/mediawiki.libs/
|
||||
resources/oojs/
|
||||
resources/oojs-ui/
|
||||
resources/sinonjs/
|
||||
resources/moment/
|
||||
resources/jquery.effects/**
|
||||
resources/jquery.tipsy/**
|
||||
resources/jquery.ui/**
|
||||
resources/mediawiki.libs/**
|
||||
resources/moment/**
|
||||
resources/oojs-ui/**
|
||||
resources/oojs/**
|
||||
resources/sinonjs/**
|
||||
tests/frontend/node_modules/**
|
||||
|
||||
# github.com/jshint/jshint/issues/729
|
||||
tests/qunit/suites/resources/mediawiki/mediawiki.jscompat.test.js
|
||||
|
|
|
|||
16
.jshintrc
16
.jshintrc
|
|
@ -2,24 +2,20 @@
|
|||
/* Common */
|
||||
|
||||
// Enforcing
|
||||
"camelcase": true,
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"immed": true,
|
||||
"latedef": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"nonew": true,
|
||||
"quotmark": "single",
|
||||
"trailing": true,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
// Legacy
|
||||
"onevar": true,
|
||||
|
||||
/* Local */
|
||||
|
||||
// FIXME: Deprecated, handle these with node-jscs instead.
|
||||
// Handled here because we still have inline overrides in some places.
|
||||
"camelcase": true,
|
||||
"nomen": true,
|
||||
|
||||
// Enforcing
|
||||
"bitwise": true,
|
||||
"forin": false,
|
||||
|
|
@ -31,8 +27,6 @@
|
|||
"multistr": true,
|
||||
// Environment
|
||||
"browser": true,
|
||||
// Legacy
|
||||
"nomen": true,
|
||||
|
||||
"predef": [
|
||||
"mediaWiki",
|
||||
|
|
|
|||
|
|
@ -189,7 +189,6 @@
|
|||
$el.attr( 'maxlength', elLimit );
|
||||
}
|
||||
|
||||
|
||||
// Safe base value, used to determine the path between the previous state
|
||||
// and the state that triggered the event handler below - and enforce the
|
||||
// limit approppiately (e.g. don't chop from the end if text was inserted
|
||||
|
|
|
|||
|
|
@ -66,4 +66,3 @@
|
|||
};
|
||||
|
||||
}( jQuery ) );
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@
|
|||
changePlaceholder.call(this, text);
|
||||
}
|
||||
|
||||
|
||||
$this
|
||||
.filter((isInputSupported ? 'textarea' : ':input') + '[placeholder]')
|
||||
.filter(function () {
|
||||
|
|
|
|||
|
|
@ -79,7 +79,6 @@
|
|||
isEmptyObject: $.isEmptyObject
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* CompletenessTest
|
||||
* @constructor
|
||||
|
|
|
|||
|
|
@ -68,8 +68,6 @@
|
|||
*/
|
||||
|
||||
( function ( $, mw ) {
|
||||
/*jshint onevar:false */
|
||||
|
||||
/* Local scope */
|
||||
|
||||
var ts,
|
||||
|
|
@ -78,8 +76,9 @@
|
|||
/* Parser utility functions */
|
||||
|
||||
function getParserById( name ) {
|
||||
var len = parsers.length;
|
||||
for ( var i = 0; i < len; i++ ) {
|
||||
var i,
|
||||
len = parsers.length;
|
||||
for ( i = 0; i < len; i++ ) {
|
||||
if ( parsers[i].id.toLowerCase() === name.toLowerCase() ) {
|
||||
return parsers[i];
|
||||
}
|
||||
|
|
@ -228,18 +227,19 @@
|
|||
}
|
||||
|
||||
function appendToTable( table, cache ) {
|
||||
var row = cache.row,
|
||||
var i, pos, l, j,
|
||||
row = cache.row,
|
||||
normalized = cache.normalized,
|
||||
totalRows = normalized.length,
|
||||
checkCell = ( normalized[0].length - 1 ),
|
||||
fragment = document.createDocumentFragment();
|
||||
|
||||
for ( var i = 0; i < totalRows; i++ ) {
|
||||
var pos = normalized[i][checkCell];
|
||||
for ( i = 0; i < totalRows; i++ ) {
|
||||
pos = normalized[i][checkCell];
|
||||
|
||||
var l = row[pos].length;
|
||||
l = row[pos].length;
|
||||
|
||||
for ( var j = 0; j < l; j++ ) {
|
||||
for ( j = 0; j < l; j++ ) {
|
||||
fragment.appendChild( row[pos][j] );
|
||||
}
|
||||
|
||||
|
|
@ -260,11 +260,12 @@
|
|||
* @param $table jQuery object for a <table>
|
||||
*/
|
||||
function emulateTHeadAndFoot( $table ) {
|
||||
var $rows = $table.find( '> tbody > tr' );
|
||||
var $thead, $tfoot, i, len,
|
||||
$rows = $table.find( '> tbody > tr' );
|
||||
if ( !$table.get(0).tHead ) {
|
||||
var $thead = $( '<thead>' );
|
||||
$thead = $( '<thead>' );
|
||||
$rows.each( function () {
|
||||
if ( $(this).children( 'td' ).length > 0 ) {
|
||||
if ( $(this).children( 'td' ).length ) {
|
||||
// This row contains a <td>, so it's not a header row
|
||||
// Stop here
|
||||
return false;
|
||||
|
|
@ -274,10 +275,10 @@
|
|||
$table.find(' > tbody:first').before( $thead );
|
||||
}
|
||||
if ( !$table.get(0).tFoot ) {
|
||||
var $tfoot = $( '<tfoot>' );
|
||||
var len = $rows.length;
|
||||
for ( var i = len-1; i >= 0; i-- ) {
|
||||
if( $( $rows[i] ).children( 'td' ).length > 0 ){
|
||||
$tfoot = $( '<tfoot>' );
|
||||
len = $rows.length;
|
||||
for ( i = len - 1; i >= 0; i-- ) {
|
||||
if ( $( $rows[i] ).children( 'td' ).length ){
|
||||
break;
|
||||
}
|
||||
$tfoot.prepend( $( $rows[i] ));
|
||||
|
|
@ -424,7 +425,6 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
function uniqueElements( array ) {
|
||||
var uniques = [];
|
||||
$.each( array, function( index, elem ) {
|
||||
|
|
@ -455,14 +455,15 @@
|
|||
}
|
||||
|
||||
function multisort( table, sortList, cache ) {
|
||||
var sortFn = [];
|
||||
var len = sortList.length;
|
||||
for ( var i = 0; i < len; i++ ) {
|
||||
var i,
|
||||
sortFn = [],
|
||||
len = sortList.length;
|
||||
for ( i = 0; i < len; i++ ) {
|
||||
sortFn[i] = ( sortList[i][1] ) ? sortTextDesc : sortText;
|
||||
}
|
||||
cache.normalized.sort( function ( array1, array2 ) {
|
||||
var col, ret;
|
||||
for ( var i = 0; i < len; i++ ) {
|
||||
var i, col, ret;
|
||||
for ( i = 0; i < len; i++ ) {
|
||||
col = sortList[i][0];
|
||||
ret = sortFn[i].call( this, array1[col], array2[col] );
|
||||
if ( ret !== 0 ) {
|
||||
|
|
@ -476,25 +477,27 @@
|
|||
}
|
||||
|
||||
function buildTransformTable() {
|
||||
var digits = '0123456789,.'.split( '' );
|
||||
var separatorTransformTable = mw.config.get( 'wgSeparatorTransformTable' );
|
||||
var digitTransformTable = mw.config.get( 'wgDigitTransformTable' );
|
||||
var ascii, localised, i, digitClass,
|
||||
digits = '0123456789,.'.split( '' ),
|
||||
separatorTransformTable = mw.config.get( 'wgSeparatorTransformTable' ),
|
||||
digitTransformTable = mw.config.get( 'wgDigitTransformTable' );
|
||||
|
||||
if ( separatorTransformTable === null || ( separatorTransformTable[0] === '' && digitTransformTable[2] === '' ) ) {
|
||||
ts.transformTable = false;
|
||||
} else {
|
||||
ts.transformTable = {};
|
||||
|
||||
// Unpack the transform table
|
||||
var ascii = separatorTransformTable[0].split( '\t' ).concat( digitTransformTable[0].split( '\t' ) );
|
||||
var localised = separatorTransformTable[1].split( '\t' ).concat( digitTransformTable[1].split( '\t' ) );
|
||||
ascii = separatorTransformTable[0].split( '\t' ).concat( digitTransformTable[0].split( '\t' ) );
|
||||
localised = separatorTransformTable[1].split( '\t' ).concat( digitTransformTable[1].split( '\t' ) );
|
||||
|
||||
// Construct regex for number identification
|
||||
for ( var i = 0; i < ascii.length; i++ ) {
|
||||
for ( i = 0; i < ascii.length; i++ ) {
|
||||
ts.transformTable[localised[i]] = ascii[i];
|
||||
digits.push( $.escapeRE( localised[i] ) );
|
||||
}
|
||||
}
|
||||
var digitClass = '[' + digits.join( '', digits ) + ']';
|
||||
digitClass = '[' + digits.join( '', digits ) + ']';
|
||||
|
||||
// We allow a trailing percent sign, which we just strip. This works fine
|
||||
// if percents and regular numbers aren't being mixed.
|
||||
|
|
@ -504,11 +507,13 @@
|
|||
}
|
||||
|
||||
function buildDateTable() {
|
||||
var regex = [];
|
||||
var i, name,
|
||||
regex = [];
|
||||
|
||||
ts.monthNames = {};
|
||||
|
||||
for ( var i = 0; i < 12; i++ ) {
|
||||
var name = mw.language.months.names[i].toLowerCase();
|
||||
for ( i = 0; i < 12; i++ ) {
|
||||
name = mw.language.months.names[i].toLowerCase();
|
||||
ts.monthNames[name] = i + 1;
|
||||
regex.push( $.escapeRE( name ) );
|
||||
name = mw.language.months.genitive[i].toLowerCase();
|
||||
|
|
@ -541,7 +546,9 @@
|
|||
* @param $table jQuery object for a <table>
|
||||
*/
|
||||
function explodeRowspans( $table ) {
|
||||
var rowspanCells = $table.find( '> tbody > tr > [rowspan]' ).get();
|
||||
var spanningRealCellIndex, rowSpan, colSpan,
|
||||
cell, i, $tds, $clone, $nextRows,
|
||||
rowspanCells = $table.find( '> tbody > tr > [rowspan]' ).get();
|
||||
|
||||
// Short circuit
|
||||
if ( !rowspanCells.length ) {
|
||||
|
|
@ -552,9 +559,10 @@
|
|||
// account colspans. We also cache the rowIndex to avoid having to take
|
||||
// cell.parentNode.rowIndex in the sorting function below.
|
||||
$table.find( '> tbody > tr' ).each( function () {
|
||||
var col = 0;
|
||||
var l = this.cells.length;
|
||||
for ( var i = 0; i < l; i++ ) {
|
||||
var i,
|
||||
col = 0,
|
||||
l = this.cells.length;
|
||||
for ( i = 0; i < l; i++ ) {
|
||||
this.cells[i].realCellIndex = col;
|
||||
this.cells[i].realRowIndex = this.rowIndex;
|
||||
col += this.cells[i].colSpan;
|
||||
|
|
@ -579,7 +587,6 @@
|
|||
}
|
||||
resortCells();
|
||||
|
||||
var spanningRealCellIndex, rowSpan, colSpan;
|
||||
function filterfunc() {
|
||||
return this.realCellIndex >= spanningRealCellIndex;
|
||||
}
|
||||
|
|
@ -596,15 +603,15 @@
|
|||
resortCells();
|
||||
}
|
||||
|
||||
var cell = rowspanCells.shift();
|
||||
cell = rowspanCells.shift();
|
||||
rowSpan = cell.rowSpan;
|
||||
colSpan = cell.colSpan;
|
||||
spanningRealCellIndex = cell.realCellIndex;
|
||||
cell.rowSpan = 1;
|
||||
var $nextRows = $( cell ).parent().nextAll();
|
||||
for ( var i = 0; i < rowSpan - 1; i++ ) {
|
||||
var $tds = $( $nextRows[i].cells ).filter( filterfunc );
|
||||
var $clone = $( cell ).clone();
|
||||
$nextRows = $( cell ).parent().nextAll();
|
||||
for ( i = 0; i < rowSpan - 1; i++ ) {
|
||||
$tds = $( $nextRows[i].cells ).filter( filterfunc );
|
||||
$clone = $( cell ).clone();
|
||||
$clone[0].realCellIndex = spanningRealCellIndex;
|
||||
if ( $tds.length ) {
|
||||
$tds.each( fixTdCellIndex );
|
||||
|
|
@ -620,11 +627,13 @@
|
|||
ts.collationTable = mw.config.get( 'tableSorterCollation' );
|
||||
ts.collationRegex = null;
|
||||
if ( ts.collationTable ) {
|
||||
var keys = [];
|
||||
var key,
|
||||
keys = [];
|
||||
|
||||
// Build array of key names
|
||||
for ( var key in ts.collationTable ) {
|
||||
if ( ts.collationTable.hasOwnProperty(key) ) { //to be safe
|
||||
for ( key in ts.collationTable ) {
|
||||
// Check hasOwn to be safe
|
||||
if ( ts.collationTable.hasOwnProperty(key) ) {
|
||||
keys.push(key);
|
||||
}
|
||||
}
|
||||
|
|
@ -714,7 +723,7 @@
|
|||
construct: function ( $tables, settings ) {
|
||||
return $tables.each( function ( i, table ) {
|
||||
// Declare and cache.
|
||||
var $headers, cache, config,
|
||||
var $headers, cache, config, sortCSS, sortMsg,
|
||||
$table = $( table ),
|
||||
firstTime = true;
|
||||
|
||||
|
|
@ -745,8 +754,8 @@
|
|||
$.data( table, 'tablesorter', { config: config } );
|
||||
|
||||
// Get the CSS class names, could be done else where.
|
||||
var sortCSS = [ config.cssDesc, config.cssAsc ];
|
||||
var sortMsg = [ mw.msg( 'sort-descending' ), mw.msg( 'sort-ascending' ) ];
|
||||
sortCSS = [ config.cssDesc, config.cssAsc ];
|
||||
sortMsg = [ mw.msg( 'sort-descending' ), mw.msg( 'sort-ascending' ) ];
|
||||
|
||||
// Build headers
|
||||
$headers = buildHeaders( table, sortMsg );
|
||||
|
|
@ -819,15 +828,17 @@
|
|||
this.order = this.count % 2;
|
||||
this.count++;
|
||||
|
||||
var cell = this;
|
||||
var cell, columns, newSortList, i;
|
||||
|
||||
cell = this;
|
||||
// Get current column index
|
||||
var columns = table.headerToColumns[ this.headerIndex ];
|
||||
var newSortList = $.map( columns, function (c) {
|
||||
columns = table.headerToColumns[ this.headerIndex ];
|
||||
newSortList = $.map( columns, function ( c ) {
|
||||
// jQuery "helpfully" flattens the arrays...
|
||||
return [[c, cell.order]];
|
||||
});
|
||||
// Index of first column belonging to this header
|
||||
var i = columns[0];
|
||||
i = columns[0];
|
||||
|
||||
if ( !e[config.sortMultiSortKey] ) {
|
||||
// User only wants to sort on one column set
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
* These plugins provide extra functionality for interaction with textareas.
|
||||
*/
|
||||
( function ( $ ) {
|
||||
/*jshint noempty:false */
|
||||
|
||||
if ( document.selection && document.selection.createRange ) {
|
||||
// On IE, patch the focus() method to restore the windows' scroll position
|
||||
// (bug 32241)
|
||||
|
|
@ -73,7 +71,6 @@
|
|||
el = this.get( 0 );
|
||||
|
||||
if ( $(el).is( ':hidden' ) ) {
|
||||
// Do nothing
|
||||
retval = '';
|
||||
} else if ( document.selection && document.selection.createRange ) {
|
||||
activateElementOnIE( el );
|
||||
|
|
@ -143,9 +140,9 @@
|
|||
}
|
||||
|
||||
isSample = false;
|
||||
if ( this.style.display === 'none' ) {
|
||||
// Do nothing
|
||||
} else if ( document.selection && document.selection.createRange ) {
|
||||
// Do nothing if display none
|
||||
if ( this.style.display !== 'none' ) {
|
||||
if ( document.selection && document.selection.createRange ) {
|
||||
// IE
|
||||
|
||||
// Note that IE9 will trigger the next section unless we check this first.
|
||||
|
|
@ -247,6 +244,7 @@
|
|||
this.selectionEnd = this.selectionStart;
|
||||
}
|
||||
}
|
||||
}
|
||||
$(this).trigger( 'encapsulateSelection', [ options.pre, options.peri, options.post, options.ownline,
|
||||
options.replace, options.spitlines ] );
|
||||
});
|
||||
|
|
@ -366,9 +364,9 @@
|
|||
setSelection: function ( options ) {
|
||||
return this.each( function () {
|
||||
var selection, length, newLines;
|
||||
if ( $(this).is( ':hidden' ) ) {
|
||||
// Do nothing
|
||||
} else if ( this.selectionStart || this.selectionStart === 0 ) {
|
||||
// Do nothing if hidden
|
||||
if ( !$(this).is( ':hidden' ) ) {
|
||||
if ( this.selectionStart || this.selectionStart === 0 ) {
|
||||
// Opera 9.0 doesn't allow setting selectionStart past
|
||||
// selectionEnd; any attempts to do that will be ignored
|
||||
// Make sure to set them in the right order
|
||||
|
|
@ -396,6 +394,7 @@
|
|||
selection.select();
|
||||
} catch ( e ) { }
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
|
|
@ -461,9 +460,9 @@
|
|||
}
|
||||
return this.each(function () {
|
||||
var scroll, range, savedRange, pos, oldScrollTop;
|
||||
if ( $(this).is( ':hidden' ) ) {
|
||||
// Do nothing
|
||||
} else if ( this.selectionStart || this.selectionStart === 0 ) {
|
||||
// Do nothing if hidden
|
||||
if ( !$(this).is( ':hidden' ) ) {
|
||||
if ( this.selectionStart || this.selectionStart === 0 ) {
|
||||
// Mozilla
|
||||
scroll = getCaretScrollPosition( this );
|
||||
if ( options.force || scroll < $(this).scrollTop() ||
|
||||
|
|
@ -496,6 +495,7 @@
|
|||
}
|
||||
savedRange.select();
|
||||
}
|
||||
}
|
||||
$(this).trigger( 'scrollToPosition' );
|
||||
} );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,4 +53,3 @@
|
|||
} );
|
||||
|
||||
}( mediaWiki, jQuery ) );
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,6 @@ jQuery( function ( $ ) {
|
|||
// Set initial state
|
||||
updateDiffRadios();
|
||||
|
||||
|
||||
// Prettify url output for HistoryAction submissions,
|
||||
// to cover up action=historysubmit construction.
|
||||
|
||||
|
|
|
|||
|
|
@ -84,7 +84,6 @@
|
|||
.promise( { abort: apiPromise.abort } );
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Get the categories that a particular page on the wiki belongs to
|
||||
* @param {mw.Title} title
|
||||
|
|
|
|||
|
|
@ -3,15 +3,14 @@
|
|||
*/
|
||||
|
||||
mediaWiki.language.convertGrammar = function ( word, form ) {
|
||||
/*jshint noempty:false */
|
||||
var grammarForms = mediaWiki.language.getData( 'uk', 'grammarForms' );
|
||||
if ( grammarForms && grammarForms[form] ) {
|
||||
return grammarForms[form][word];
|
||||
}
|
||||
switch ( form ) {
|
||||
case 'genitive': // родовий відмінок
|
||||
if ( ( word.substr( word.length - 4 ) === 'вікі' ) || ( word.substr( word.length - 4 ) === 'Вікі' ) ) {
|
||||
} else if ( word.substr( word.length - 1 ) === 'ь' ) {
|
||||
if ( word.substr( word.length - 4 ) !== 'вікі' && word.substr( word.length - 4 ) !== 'Вікі' ) {
|
||||
if ( word.substr( word.length - 1 ) === 'ь' ) {
|
||||
word = word.substr(0, word.length - 1 ) + 'я';
|
||||
} else if ( word.substr( word.length - 2 ) === 'ія' ) {
|
||||
word = word.substr(0, word.length - 2 ) + 'ії';
|
||||
|
|
@ -24,13 +23,14 @@ mediaWiki.language.convertGrammar = function ( word, form ) {
|
|||
} else if ( word.substr( word.length - 3 ) === 'ник' ) {
|
||||
word = word.substr(0, word.length - 3 ) + 'ника';
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'accusative': // знахідний відмінок
|
||||
if ( ( word.substr( word.length - 4 ) === 'вікі' ) || ( word.substr( word.length - 4 ) === 'Вікі' ) ) {
|
||||
}
|
||||
else if ( word.substr( word.length - 2 ) === 'ія' ) {
|
||||
if ( word.substr( word.length - 4 ) !== 'вікі' && word.substr( word.length - 4 ) !== 'Вікі' ) {
|
||||
if ( word.substr( word.length - 2 ) === 'ія' ) {
|
||||
word = word.substr(0, word.length - 2 ) + 'ію';
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return word;
|
||||
|
|
|
|||
|
|
@ -70,7 +70,8 @@
|
|||
$elm: $this,
|
||||
width: $this.outerWidth(),
|
||||
imgWidth: imgWidth,
|
||||
aspect: imgWidth / imgHeight, // XXX: can divide by 0 ever happen?
|
||||
// XXX: can divide by 0 ever happen?
|
||||
aspect: imgWidth / imgHeight,
|
||||
captionWidth: $this.children().children( 'div.gallerytextwrapper' ).width(),
|
||||
height: imgHeight
|
||||
};
|
||||
|
|
@ -159,7 +160,12 @@
|
|||
}
|
||||
if ( preferredHeight < 5 ) {
|
||||
// Well something clearly went wrong...
|
||||
mw.log( {maxWidth: maxWidth, combinedPadding: combinedPadding, combinedAspect: combinedAspect, wantedWidth: wantedWidth } );
|
||||
mw.log( {
|
||||
maxWidth: maxWidth,
|
||||
combinedPadding: combinedPadding,
|
||||
combinedAspect: combinedAspect,
|
||||
wantedWidth: wantedWidth
|
||||
} );
|
||||
mw.log( 'mw.page.gallery: [BUG!] Fitting row ' + i + ' to too small a size: ' + preferredHeight );
|
||||
// Skip this row.
|
||||
continue;
|
||||
|
|
@ -182,7 +188,6 @@
|
|||
imageElm = $imageElm.length ? $imageElm[0] : null;
|
||||
$caption = $outerDiv.find( 'div.gallerytextwrapper' );
|
||||
|
||||
|
||||
// Since we are going to re-adjust the height, the vertical
|
||||
// centering margins need to be reset.
|
||||
$imageDiv.children( 'div' ).css( 'margin', '0px auto' );
|
||||
|
|
|
|||
|
|
@ -43,4 +43,3 @@
|
|||
}
|
||||
} );
|
||||
}( mediaWiki, jQuery ) );
|
||||
|
||||
|
|
|
|||
|
|
@ -34,4 +34,3 @@
|
|||
} );
|
||||
|
||||
}( mediaWiki, jQuery ) );
|
||||
|
||||
|
|
|
|||
|
|
@ -263,7 +263,6 @@
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -179,7 +179,6 @@
|
|||
.replace( rUnderscoreTrim, '' );
|
||||
}
|
||||
|
||||
|
||||
// Reject illegal characters
|
||||
if ( title.match( rInvalid ) ) {
|
||||
return false;
|
||||
|
|
@ -271,7 +270,6 @@
|
|||
};
|
||||
}() );
|
||||
|
||||
|
||||
/* Static members */
|
||||
|
||||
/**
|
||||
|
|
@ -575,7 +573,6 @@
|
|||
*/
|
||||
Title.prototype.toString = Title.prototype.getPrefixedDb;
|
||||
|
||||
|
||||
/**
|
||||
* @alias #getPrefixedText
|
||||
* @method
|
||||
|
|
|
|||
|
|
@ -238,7 +238,6 @@
|
|||
$( '<colgroup>' ).appendTo( $table );
|
||||
$( '<colgroup>' ).css( 'width', 350 ).appendTo( $table );
|
||||
|
||||
|
||||
entryTypeText = function ( entryType ) {
|
||||
switch ( entryType ) {
|
||||
case 'log':
|
||||
|
|
@ -297,7 +296,6 @@
|
|||
.appendTo( $table );
|
||||
}
|
||||
|
||||
|
||||
return $table;
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -163,9 +163,12 @@
|
|||
* The section of the dialog to show.
|
||||
*/
|
||||
display: function ( s ) {
|
||||
this.$dialog.dialog( { buttons:{} } ); // hide the buttons
|
||||
this.$dialog.find( '.feedback-mode' ).hide(); // hide everything
|
||||
this.$dialog.find( '.feedback-' + s ).show(); // show the desired div
|
||||
// Hide the buttons
|
||||
this.$dialog.dialog( { buttons: {} } );
|
||||
// Hide everything
|
||||
this.$dialog.find( '.feedback-mode' ).hide();
|
||||
// Show the desired div
|
||||
this.$dialog.find( '.feedback-' + s ).show();
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* http://www.modernmethod.com/sajax/
|
||||
*/
|
||||
|
||||
/*jshint camelcase:false, onevar:false */
|
||||
/*jshint camelcase:false */
|
||||
/*global alert */
|
||||
( function ( mw ) {
|
||||
|
||||
|
|
@ -89,9 +89,7 @@ function createXhr() {
|
|||
* with id = showFoo
|
||||
*/
|
||||
function doAjaxRequest( func_name, args, target ) {
|
||||
var i, x;
|
||||
var uri;
|
||||
var post_data;
|
||||
var i, x, uri, post_data;
|
||||
uri = mw.util.wikiScript() + '?action=ajax';
|
||||
if ( window.sajax_request_type === 'GET' ) {
|
||||
if ( uri.indexOf( '?' ) === -1 ) {
|
||||
|
|
@ -173,8 +171,9 @@ function doAjaxRequest( func_name, args, target ) {
|
|||
* @return {boolean} Whether the browser supports AJAX
|
||||
*/
|
||||
function wfSupportsAjax() {
|
||||
var request = createXhr();
|
||||
var supportsAjax = request ? true : false;
|
||||
var request = createXhr(),
|
||||
supportsAjax = request ? true : false;
|
||||
|
||||
request = undefined;
|
||||
return supportsAjax;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,6 @@ function uploadSetup() {
|
|||
wpLicenseTbody.insertBefore( row, wpLicenseRow.nextSibling );
|
||||
}
|
||||
|
||||
|
||||
// fillDestFile setup
|
||||
uploadSourceIds = mw.config.get( 'wgUploadSourceIds' );
|
||||
len = uploadSourceIds.length;
|
||||
|
|
|
|||
51
tests/frontend/Gruntfile.js
Normal file
51
tests/frontend/Gruntfile.js
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/*!
|
||||
* Grunt file
|
||||
*/
|
||||
|
||||
/*jshint node:true */
|
||||
module.exports = function ( grunt ) {
|
||||
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
|
||||
grunt.loadNpmTasks( 'grunt-contrib-watch' );
|
||||
grunt.loadNpmTasks( 'grunt-jscs-checker' );
|
||||
|
||||
grunt.file.setBase( __dirname + '/../..' );
|
||||
|
||||
grunt.initConfig( {
|
||||
pkg: grunt.file.readJSON( __dirname + '/package.json' ),
|
||||
jshint: {
|
||||
options: {
|
||||
jshintrc: '.jshintrc'
|
||||
},
|
||||
all: [ '*.js', '{includes,languages,resources,skins,tests}/**/*.js' ]
|
||||
},
|
||||
jscs: {
|
||||
// Known issues:
|
||||
// - https://github.com/mdevils/node-jscs/issues/277
|
||||
// - https://github.com/mdevils/node-jscs/issues/278
|
||||
all: [
|
||||
'<%= jshint.all %>',
|
||||
// Auto-generated file with JSON (double quotes)
|
||||
'!tests/qunit/data/mediawiki.jqueryMsg.data.js'
|
||||
|
||||
// Exclude all files ignored by jshint
|
||||
].concat( grunt.file.read( '.jshintignore' ).split( '\n' ).reduce( function ( patterns, pattern ) {
|
||||
// Filter out empty lines
|
||||
if ( pattern.length && pattern[0] !== '#' ) {
|
||||
patterns.push( '!' + pattern );
|
||||
}
|
||||
return patterns;
|
||||
}, [] ) )
|
||||
},
|
||||
watch: {
|
||||
files: [
|
||||
'.{jshintrc,jscs.json,jshintignore,csslintrc}',
|
||||
'<%= jshint.all %>'
|
||||
],
|
||||
tasks: ['test']
|
||||
}
|
||||
} );
|
||||
|
||||
grunt.registerTask( 'lint', ['jshint', 'jscs'] );
|
||||
grunt.registerTask( 'test', ['lint'] );
|
||||
grunt.registerTask( 'default', ['test'] );
|
||||
};
|
||||
13
tests/frontend/package.json
Normal file
13
tests/frontend/package.json
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"name": "mediawiki",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"test": "grunt test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt": "0.4.2",
|
||||
"grunt-contrib-jshint": "0.8.0",
|
||||
"grunt-contrib-watch": "0.5.3",
|
||||
"grunt-jscs-checker": "0.4.0"
|
||||
}
|
||||
}
|
||||
|
|
@ -135,7 +135,6 @@ class GenerateJqueryMsgData extends Maintenance {
|
|||
. '// Last generated with ' . basename( __FILE__ ) . ' at ' . gmdate( 'r' ) . "\n"
|
||||
// This file will contain unquoted JSON strings as javascript native object literals,
|
||||
// flip the quotemark convention for this file.
|
||||
. "/*jshint quotmark: double */\n"
|
||||
. "\n"
|
||||
. 'mediaWiki.libs.phpParserData = ' . FormatJson::encode( $phpParserData, true ) . ";\n";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
// This file stores the output from the PHP parser for various messages, arguments,
|
||||
// languages, and parser modes. Intended for use by a unit test framework by looping
|
||||
// through the object and comparing its parser return value with the 'result' property.
|
||||
// Last generated with generateJqueryMsgData.php at Sat, 03 Nov 2012 21:32:01 +0000
|
||||
/*jshint quotmark: double */
|
||||
// Last generated with generateJqueryMsgData.php at Thu, 30 Jan 2014 04:04:41 +0000
|
||||
|
||||
mediaWiki.libs.phpParserData = {
|
||||
"messages": {
|
||||
|
|
@ -10,12 +9,12 @@ mediaWiki.libs.phpParserData = {
|
|||
"en_category-subcat-count": "{{PLURAL:$2|This category has only the following subcategory.|This category has the following {{PLURAL:$1|subcategory|$1 subcategories}}, out of $2 total.}}",
|
||||
"fr_undelete_short": "Restaurer $1 modification{{PLURAL:$1||s}}",
|
||||
"fr_category-subcat-count": "Cette cat\u00e9gorie comprend {{PLURAL:$2|la sous-cat\u00e9gorie|$2 sous-cat\u00e9gories, dont {{PLURAL:$1|celle|les $1}}}} ci-dessous.",
|
||||
"ar_undelete_short": "\u0627\u0633\u062a\u0631\u062c\u0627\u0639 {{PLURAL:$1|\u062a\u0639\u062f\u064a\u0644 \u0648\u0627\u062d\u062f|\u062a\u0639\u062f\u064a\u0644\u064a\u0646|$1 \u062a\u0639\u062f\u064a\u0644\u0627\u062a|$1 \u062a\u0639\u062f\u064a\u0644|$1 \u062a\u0639\u062f\u064a\u0644\u0627}}",
|
||||
"ar_category-subcat-count": "{{PLURAL:$2|\u0644\u0627 \u062a\u0635\u0627\u0646\u064a\u0641 \u0641\u0631\u0639\u064a\u0629 \u0641\u064a \u0647\u0630\u0627 \u0627\u0644\u062a\u0635\u0646\u064a\u0641|\u0647\u0630\u0627 \u0627\u0644\u062a\u0635\u0646\u064a\u0641 \u0641\u064a\u0647 \u0627\u0644\u062a\u0635\u0646\u064a\u0641 \u0627\u0644\u0641\u0631\u0639\u064a \u0627\u0644\u062a\u0627\u0644\u064a \u0641\u0642\u0637.|\u0647\u0630\u0627 \u0627\u0644\u062a\u0635\u0646\u064a\u0641 \u0641\u064a\u0647 {{PLURAL:$1||\u0647\u0630\u0627 \u0627\u0644\u062a\u0635\u0646\u064a\u0641 \u0627\u0644\u0641\u0631\u0639\u064a|\u0647\u0630\u064a\u0646 \u0627\u0644\u062a\u0635\u0646\u064a\u0641\u064a\u0646 \u0627\u0644\u0641\u0631\u0639\u064a\u064a\u0646|\u0647\u0630\u0647 \u0627\u0644$1 \u062a\u0635\u0627\u0646\u064a\u0641 \u0627\u0644\u0641\u0631\u0639\u064a\u0629|\u0647\u0630\u0647 \u0627\u0644$1 \u062a\u0635\u0646\u064a\u0641\u0627 \u0641\u0631\u0639\u064a\u0627|\u0647\u0630\u0647 \u0627\u0644$1 \u062a\u0635\u0646\u064a\u0641 \u0641\u0631\u0639\u064a}}\u060c \u0645\u0646 \u0625\u062c\u0645\u0627\u0644\u064a $2.}}",
|
||||
"ar_undelete_short": "\u0627\u0633\u062a\u0631\u062c\u0627\u0639 {{PLURAL:$1||\u062a\u0639\u062f\u064a\u0644 \u0648\u0627\u062d\u062f|\u062a\u0639\u062f\u064a\u0644\u064a\u0646|$1 \u062a\u0639\u062f\u064a\u0644\u0627\u062a|$1 \u062a\u0639\u062f\u064a\u0644\u0627\u064b|$1 \u062a\u0639\u062f\u064a\u0644}}",
|
||||
"ar_category-subcat-count": "{{PLURAL:$2|\u0647\u0630\u0627 \u0627\u0644\u062a\u0635\u0646\u064a\u0641 \u064a\u062d\u0648\u064a \u0627\u0644\u062a\u0635\u0646\u064a\u0641 \u0627\u0644\u0641\u0631\u0639\u064a \u0627\u0644\u062a\u0627\u0644\u064a|\u0647\u0630\u0627 \u0627\u0644\u062a\u0635\u0646\u064a\u0641 \u064a\u062d\u0648\u064a {{PLURAL:$1||\u0627\u0644\u062a\u0635\u0646\u064a\u0641 \u0627\u0644\u0641\u0631\u0639\u064a|\u062a\u0635\u0646\u064a\u0641\u064a\u0646 \u0641\u0631\u0639\u064a\u064a\u0646|$1 \u062a\u0635\u0646\u064a\u0641\u0627\u062a \u0641\u0631\u0639\u064a\u0629}}\u060c \u0645\u0646 \u0625\u062c\u0645\u0627\u0644\u064a $2.}}",
|
||||
"jp_undelete_short": "Undelete {{PLURAL:$1|one edit|$1 edits}}",
|
||||
"jp_category-subcat-count": "{{PLURAL:$2|This category has only the following subcategory.|This category has the following {{PLURAL:$1|subcategory|$1 subcategories}}, out of $2 total.}}",
|
||||
"zh_undelete_short": "\u6062\u590d$1\u4e2a\u88ab\u5220\u9664\u7684\u7f16\u8f91",
|
||||
"zh_category-subcat-count": "{{PLURAL:$2|\u672c\u5206\u7c7b\u53ea\u6709\u4e0b\u5217\u4e00\u4e2a\u5b50\u5206\u7c7b\u3002|\u672c\u5206\u7c7b\u5305\u542b\u4e0b\u5217$1\u4e2a\u5b50\u5206\u7c7b\uff0c\u5171$2\u4e2a\u5b50\u5206\u7c7b\u3002}}"
|
||||
"zh_undelete_short": "\u8fd8\u539f{{PLURAL:$1|$1\u4e2a\u7f16\u8f91}}",
|
||||
"zh_category-subcat-count": "{{PLURAL:$2|\u672c\u5206\u7c7b\u53ea\u6709\u4ee5\u4e0b\u5b50\u5206\u7c7b\u3002|\u672c\u5206\u7c7b\u6709\u4ee5\u4e0b$1\u4e2a\u5b50\u5206\u7c7b\uff0c\u5171\u6709$2\u4e2a\u5b50\u5206\u7c7b\u3002}}"
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
|
|
@ -212,7 +211,7 @@ mediaWiki.libs.phpParserData = {
|
|||
"args": [
|
||||
0
|
||||
],
|
||||
"result": "\u0627\u0633\u062a\u0631\u062c\u0627\u0639 \u062a\u0639\u062f\u064a\u0644 \u0648\u0627\u062d\u062f",
|
||||
"result": "\u0627\u0633\u062a\u0631\u062c\u0627\u0639 ",
|
||||
"lang": "ar"
|
||||
},
|
||||
{
|
||||
|
|
@ -221,7 +220,7 @@ mediaWiki.libs.phpParserData = {
|
|||
"args": [
|
||||
1
|
||||
],
|
||||
"result": "\u0627\u0633\u062a\u0631\u062c\u0627\u0639 \u062a\u0639\u062f\u064a\u0644\u064a\u0646",
|
||||
"result": "\u0627\u0633\u062a\u0631\u062c\u0627\u0639 \u062a\u0639\u062f\u064a\u0644 \u0648\u0627\u062d\u062f",
|
||||
"lang": "ar"
|
||||
},
|
||||
{
|
||||
|
|
@ -230,7 +229,7 @@ mediaWiki.libs.phpParserData = {
|
|||
"args": [
|
||||
2
|
||||
],
|
||||
"result": "\u0627\u0633\u062a\u0631\u062c\u0627\u0639 2 \u062a\u0639\u062f\u064a\u0644\u0627\u062a",
|
||||
"result": "\u0627\u0633\u062a\u0631\u062c\u0627\u0639 \u062a\u0639\u062f\u064a\u0644\u064a\u0646",
|
||||
"lang": "ar"
|
||||
},
|
||||
{
|
||||
|
|
@ -239,7 +238,7 @@ mediaWiki.libs.phpParserData = {
|
|||
"args": [
|
||||
5
|
||||
],
|
||||
"result": "\u0627\u0633\u062a\u0631\u062c\u0627\u0639 5 \u062a\u0639\u062f\u064a\u0644",
|
||||
"result": "\u0627\u0633\u062a\u0631\u062c\u0627\u0639 5 \u062a\u0639\u062f\u064a\u0644\u0627\u062a",
|
||||
"lang": "ar"
|
||||
},
|
||||
{
|
||||
|
|
@ -248,7 +247,7 @@ mediaWiki.libs.phpParserData = {
|
|||
"args": [
|
||||
21
|
||||
],
|
||||
"result": "\u0627\u0633\u062a\u0631\u062c\u0627\u0639 21 \u062a\u0639\u062f\u064a\u0644\u0627",
|
||||
"result": "\u0627\u0633\u062a\u0631\u062c\u0627\u0639 21 \u062a\u0639\u062f\u064a\u0644\u0627\u064b",
|
||||
"lang": "ar"
|
||||
},
|
||||
{
|
||||
|
|
@ -257,7 +256,7 @@ mediaWiki.libs.phpParserData = {
|
|||
"args": [
|
||||
101
|
||||
],
|
||||
"result": "\u0627\u0633\u062a\u0631\u062c\u0627\u0639 101 \u062a\u0639\u062f\u064a\u0644\u0627",
|
||||
"result": "\u0627\u0633\u062a\u0631\u062c\u0627\u0639 101 \u062a\u0639\u062f\u064a\u0644",
|
||||
"lang": "ar"
|
||||
},
|
||||
{
|
||||
|
|
@ -267,7 +266,7 @@ mediaWiki.libs.phpParserData = {
|
|||
0,
|
||||
10
|
||||
],
|
||||
"result": "\u0647\u0630\u0627 \u0627\u0644\u062a\u0635\u0646\u064a\u0641 \u0641\u064a\u0647 \u060c \u0645\u0646 \u0625\u062c\u0645\u0627\u0644\u064a 10.",
|
||||
"result": "\u0647\u0630\u0627 \u0627\u0644\u062a\u0635\u0646\u064a\u0641 \u064a\u062d\u0648\u064a \u060c \u0645\u0646 \u0625\u062c\u0645\u0627\u0644\u064a 10.",
|
||||
"lang": "ar"
|
||||
},
|
||||
{
|
||||
|
|
@ -277,7 +276,7 @@ mediaWiki.libs.phpParserData = {
|
|||
1,
|
||||
1
|
||||
],
|
||||
"result": "\u0647\u0630\u0627 \u0627\u0644\u062a\u0635\u0646\u064a\u0641 \u0641\u064a\u0647 \u0627\u0644\u062a\u0635\u0646\u064a\u0641 \u0627\u0644\u0641\u0631\u0639\u064a \u0627\u0644\u062a\u0627\u0644\u064a \u0641\u0642\u0637.",
|
||||
"result": "\u0647\u0630\u0627 \u0627\u0644\u062a\u0635\u0646\u064a\u0641 \u064a\u062d\u0648\u064a \u0627\u0644\u062a\u0635\u0646\u064a\u0641 \u0627\u0644\u0641\u0631\u0639\u064a\u060c \u0645\u0646 \u0625\u062c\u0645\u0627\u0644\u064a 1.",
|
||||
"lang": "ar"
|
||||
},
|
||||
{
|
||||
|
|
@ -287,7 +286,7 @@ mediaWiki.libs.phpParserData = {
|
|||
1,
|
||||
2
|
||||
],
|
||||
"result": "\u0647\u0630\u0627 \u0627\u0644\u062a\u0635\u0646\u064a\u0641 \u0641\u064a\u0647 \u0647\u0630\u0627 \u0627\u0644\u062a\u0635\u0646\u064a\u0641 \u0627\u0644\u0641\u0631\u0639\u064a\u060c \u0645\u0646 \u0625\u062c\u0645\u0627\u0644\u064a 2.",
|
||||
"result": "\u0647\u0630\u0627 \u0627\u0644\u062a\u0635\u0646\u064a\u0641 \u064a\u062d\u0648\u064a \u0627\u0644\u062a\u0635\u0646\u064a\u0641 \u0627\u0644\u0641\u0631\u0639\u064a\u060c \u0645\u0646 \u0625\u062c\u0645\u0627\u0644\u064a 2.",
|
||||
"lang": "ar"
|
||||
},
|
||||
{
|
||||
|
|
@ -297,7 +296,7 @@ mediaWiki.libs.phpParserData = {
|
|||
3,
|
||||
30
|
||||
],
|
||||
"result": "\u0647\u0630\u0627 \u0627\u0644\u062a\u0635\u0646\u064a\u0641 \u0641\u064a\u0647 \u0647\u0630\u0647 \u0627\u06443 \u062a\u0635\u0627\u0646\u064a\u0641 \u0627\u0644\u0641\u0631\u0639\u064a\u0629\u060c \u0645\u0646 \u0625\u062c\u0645\u0627\u0644\u064a 30.",
|
||||
"result": "\u0647\u0630\u0627 \u0627\u0644\u062a\u0635\u0646\u064a\u0641 \u064a\u062d\u0648\u064a 3 \u062a\u0635\u0646\u064a\u0641\u0627\u062a \u0641\u0631\u0639\u064a\u0629\u060c \u0645\u0646 \u0625\u062c\u0645\u0627\u0644\u064a 30.",
|
||||
"lang": "ar"
|
||||
},
|
||||
{
|
||||
|
|
@ -400,7 +399,7 @@ mediaWiki.libs.phpParserData = {
|
|||
"args": [
|
||||
0
|
||||
],
|
||||
"result": "\u6062\u590d0\u4e2a\u88ab\u5220\u9664\u7684\u7f16\u8f91",
|
||||
"result": "\u8fd8\u539f0\u4e2a\u7f16\u8f91",
|
||||
"lang": "zh"
|
||||
},
|
||||
{
|
||||
|
|
@ -409,7 +408,7 @@ mediaWiki.libs.phpParserData = {
|
|||
"args": [
|
||||
1
|
||||
],
|
||||
"result": "\u6062\u590d1\u4e2a\u88ab\u5220\u9664\u7684\u7f16\u8f91",
|
||||
"result": "\u8fd8\u539f1\u4e2a\u7f16\u8f91",
|
||||
"lang": "zh"
|
||||
},
|
||||
{
|
||||
|
|
@ -418,7 +417,7 @@ mediaWiki.libs.phpParserData = {
|
|||
"args": [
|
||||
2
|
||||
],
|
||||
"result": "\u6062\u590d2\u4e2a\u88ab\u5220\u9664\u7684\u7f16\u8f91",
|
||||
"result": "\u8fd8\u539f2\u4e2a\u7f16\u8f91",
|
||||
"lang": "zh"
|
||||
},
|
||||
{
|
||||
|
|
@ -427,7 +426,7 @@ mediaWiki.libs.phpParserData = {
|
|||
"args": [
|
||||
5
|
||||
],
|
||||
"result": "\u6062\u590d5\u4e2a\u88ab\u5220\u9664\u7684\u7f16\u8f91",
|
||||
"result": "\u8fd8\u539f5\u4e2a\u7f16\u8f91",
|
||||
"lang": "zh"
|
||||
},
|
||||
{
|
||||
|
|
@ -436,7 +435,7 @@ mediaWiki.libs.phpParserData = {
|
|||
"args": [
|
||||
21
|
||||
],
|
||||
"result": "\u6062\u590d21\u4e2a\u88ab\u5220\u9664\u7684\u7f16\u8f91",
|
||||
"result": "\u8fd8\u539f21\u4e2a\u7f16\u8f91",
|
||||
"lang": "zh"
|
||||
},
|
||||
{
|
||||
|
|
@ -445,7 +444,7 @@ mediaWiki.libs.phpParserData = {
|
|||
"args": [
|
||||
101
|
||||
],
|
||||
"result": "\u6062\u590d101\u4e2a\u88ab\u5220\u9664\u7684\u7f16\u8f91",
|
||||
"result": "\u8fd8\u539f101\u4e2a\u7f16\u8f91",
|
||||
"lang": "zh"
|
||||
},
|
||||
{
|
||||
|
|
@ -455,7 +454,7 @@ mediaWiki.libs.phpParserData = {
|
|||
0,
|
||||
10
|
||||
],
|
||||
"result": "\u672c\u5206\u7c7b\u5305\u542b\u4e0b\u52170\u4e2a\u5b50\u5206\u7c7b\uff0c\u517110\u4e2a\u5b50\u5206\u7c7b\u3002",
|
||||
"result": "\u672c\u5206\u7c7b\u6709\u4ee5\u4e0b0\u4e2a\u5b50\u5206\u7c7b\uff0c\u5171\u670910\u4e2a\u5b50\u5206\u7c7b\u3002",
|
||||
"lang": "zh"
|
||||
},
|
||||
{
|
||||
|
|
@ -465,7 +464,7 @@ mediaWiki.libs.phpParserData = {
|
|||
1,
|
||||
1
|
||||
],
|
||||
"result": "\u672c\u5206\u7c7b\u53ea\u6709\u4e0b\u5217\u4e00\u4e2a\u5b50\u5206\u7c7b\u3002",
|
||||
"result": "\u672c\u5206\u7c7b\u53ea\u6709\u4ee5\u4e0b\u5b50\u5206\u7c7b\u3002",
|
||||
"lang": "zh"
|
||||
},
|
||||
{
|
||||
|
|
@ -475,7 +474,7 @@ mediaWiki.libs.phpParserData = {
|
|||
1,
|
||||
2
|
||||
],
|
||||
"result": "\u672c\u5206\u7c7b\u5305\u542b\u4e0b\u52171\u4e2a\u5b50\u5206\u7c7b\uff0c\u51712\u4e2a\u5b50\u5206\u7c7b\u3002",
|
||||
"result": "\u672c\u5206\u7c7b\u6709\u4ee5\u4e0b1\u4e2a\u5b50\u5206\u7c7b\uff0c\u5171\u67092\u4e2a\u5b50\u5206\u7c7b\u3002",
|
||||
"lang": "zh"
|
||||
},
|
||||
{
|
||||
|
|
@ -485,7 +484,7 @@ mediaWiki.libs.phpParserData = {
|
|||
3,
|
||||
30
|
||||
],
|
||||
"result": "\u672c\u5206\u7c7b\u5305\u542b\u4e0b\u52173\u4e2a\u5b50\u5206\u7c7b\uff0c\u517130\u4e2a\u5b50\u5206\u7c7b\u3002",
|
||||
"result": "\u672c\u5206\u7c7b\u6709\u4ee5\u4e0b3\u4e2a\u5b50\u5206\u7c7b\uff0c\u5171\u670930\u4e2a\u5b50\u5206\u7c7b\u3002",
|
||||
"lang": "zh"
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -32,29 +32,33 @@
|
|||
}, opt.after );
|
||||
|
||||
QUnit.test( opt.description, function ( assert ) {
|
||||
/*jshint onevar: false */
|
||||
var tests = 1;
|
||||
var $textarea, start, end, options, text,
|
||||
tests = 1;
|
||||
if ( opt.after.selected !== null ) {
|
||||
tests++;
|
||||
}
|
||||
QUnit.expect( tests );
|
||||
|
||||
var $textarea = $( '<textarea>' );
|
||||
$textarea = $( '<textarea>' );
|
||||
|
||||
$( '#qunit-fixture' ).append( $textarea );
|
||||
|
||||
//$textarea.textSelection( 'setContents', opt.before.text); // this method is actually missing atm...
|
||||
$textarea.val( opt.before.text ); // won't work with the WikiEditor iframe?
|
||||
// This method is actually missing atm...
|
||||
//$textarea.textSelection( 'setContents', opt.before.text);
|
||||
|
||||
var start = opt.before.start,
|
||||
// Won't work with the WikiEditor iframe?
|
||||
$textarea.val( opt.before.text );
|
||||
|
||||
start = opt.before.start;
|
||||
end = opt.before.end;
|
||||
|
||||
var options = $.extend( {}, opt.replace ); // Clone opt.replace
|
||||
// Clone opt.replace
|
||||
options = $.extend( {}, opt.replace );
|
||||
options.selectionStart = start;
|
||||
options.selectionEnd = end;
|
||||
$textarea.textSelection( 'encapsulateSelection', options );
|
||||
|
||||
var text = $textarea.textSelection( 'getContents' ).replace( /\r\n/g, '\n' );
|
||||
text = $textarea.textSelection( 'getContents' ).replace( /\r\n/g, '\n' );
|
||||
|
||||
assert.equal( text, opt.after.text, 'Checking full text after encapsulation' );
|
||||
|
||||
|
|
@ -161,7 +165,6 @@
|
|||
replace: h2
|
||||
} );
|
||||
|
||||
|
||||
encapsulateTest( {
|
||||
description: 'ownline option: turn a partial line into new h2',
|
||||
before: {
|
||||
|
|
@ -176,7 +179,6 @@
|
|||
replace: h2
|
||||
} );
|
||||
|
||||
|
||||
encapsulateTest( {
|
||||
description: 'splitlines option: no selection, insert new list item',
|
||||
before: {
|
||||
|
|
@ -216,10 +218,10 @@
|
|||
replace: ulist
|
||||
} );
|
||||
|
||||
|
||||
function caretTest( options ) {
|
||||
QUnit.test( options.description, 2, function ( assert ) {
|
||||
var pos, $textarea = $( '<textarea>' ).text( options.text );
|
||||
var pos,
|
||||
$textarea = $( '<textarea>' ).text( options.text );
|
||||
|
||||
$( '#qunit-fixture' ).append( $textarea );
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
} );
|
||||
} );
|
||||
|
||||
|
||||
QUnit.test( 'API error', function ( assert ) {
|
||||
QUnit.expect( 1 );
|
||||
|
||||
|
|
|
|||
|
|
@ -25,32 +25,31 @@
|
|||
100: 'Penguins'
|
||||
},
|
||||
wgNamespaceIds: {
|
||||
/*jshint camelcase: false */
|
||||
media: -2,
|
||||
special: -1,
|
||||
'media': -2,
|
||||
'special': -1,
|
||||
'': 0,
|
||||
talk: 1,
|
||||
user: 2,
|
||||
user_talk: 3,
|
||||
wikipedia: 4,
|
||||
wikipedia_talk: 5,
|
||||
file: 6,
|
||||
file_talk: 7,
|
||||
mediawiki: 8,
|
||||
mediawiki_talk: 9,
|
||||
template: 10,
|
||||
template_talk: 11,
|
||||
help: 12,
|
||||
help_talk: 13,
|
||||
category: 14,
|
||||
category_talk: 15,
|
||||
image: 6,
|
||||
image_talk: 7,
|
||||
project: 4,
|
||||
project_talk: 5,
|
||||
/* testing custom / alias */
|
||||
penguins: 100,
|
||||
antarctic_waterfowl: 100
|
||||
'talk': 1,
|
||||
'user': 2,
|
||||
'user_talk': 3,
|
||||
'wikipedia': 4,
|
||||
'wikipedia_talk': 5,
|
||||
'file': 6,
|
||||
'file_talk': 7,
|
||||
'mediawiki': 8,
|
||||
'mediawiki_talk': 9,
|
||||
'template': 10,
|
||||
'template_talk': 11,
|
||||
'help': 12,
|
||||
'help_talk': 13,
|
||||
'category': 14,
|
||||
'category_talk': 15,
|
||||
'image': 6,
|
||||
'image_talk': 7,
|
||||
'project': 4,
|
||||
'project_talk': 5,
|
||||
// Testing custom namespaces and aliases
|
||||
'penguins': 100,
|
||||
'antarctic_waterfowl': 100
|
||||
},
|
||||
wgCaseSensitiveNamespaces: []
|
||||
},
|
||||
|
|
|
|||
|
|
@ -705,7 +705,6 @@ QUnit.test( 'HTML', 26, function ( assert ) {
|
|||
'Escaped attributes are parsed correctly'
|
||||
);
|
||||
|
||||
|
||||
mw.messages.set( 'jquerymsg-wikitext-contents-parsed', '<i>[http://example.com Example]</i>' );
|
||||
assert.htmlEqual(
|
||||
formatParse( 'jquerymsg-wikitext-contents-parsed' ),
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@
|
|||
'notExist': null
|
||||
}, 'Map.get return includes keys that were not found as null values' );
|
||||
|
||||
|
||||
// Interacting with globals and accessing the values object
|
||||
assert.strictEqual( conf.get(), conf.values, 'Map.get returns the entire values object by reference (if called without arguments)' );
|
||||
|
||||
|
|
@ -216,14 +215,12 @@
|
|||
assertMultipleFormats( ['plural-test-msg-explicit-beginning', 6], ['text', 'parse', 'escaped'], 'Basket has half a dozen eggs', 'explicit plural given at beginning get resolved for 6' );
|
||||
assertMultipleFormats( ['plural-test-msg-explicit-beginning', 0], ['text', 'parse', 'escaped'], 'Basket has no eggs', 'explicit plural given at beginning get resolved for 0' );
|
||||
|
||||
|
||||
assertMultipleFormats( ['mediawiki-test-pagetriage-del-talk-page-notify-summary'], ['plain', 'text'], mw.messages.get( 'mediawiki-test-pagetriage-del-talk-page-notify-summary' ), 'Double square brackets with no parameters unchanged' );
|
||||
|
||||
assertMultipleFormats( ['mediawiki-test-pagetriage-del-talk-page-notify-summary', specialCharactersPageName], ['plain', 'text'], 'Notifying author of deletion nomination for [[' + specialCharactersPageName + ']]', 'Double square brackets with one parameter' );
|
||||
|
||||
assert.equal( mw.message( 'mediawiki-test-pagetriage-del-talk-page-notify-summary', specialCharactersPageName ).escaped(), 'Notifying author of deletion nomination for [[' + mw.html.escape( specialCharactersPageName ) + ']]', 'Double square brackets with one parameter, when escaped' );
|
||||
|
||||
|
||||
assert.ok( mw.messages.set( 'mediawiki-test-categorytree-collapse-bullet', '[<b>−</b>]' ), 'mw.messages.set: Register' );
|
||||
assert.equal( mw.message( 'mediawiki-test-categorytree-collapse-bullet' ).plain(), mw.messages.get( 'mediawiki-test-categorytree-collapse-bullet' ), 'Single square brackets unchanged in plain mode' );
|
||||
|
||||
|
|
@ -277,7 +274,6 @@
|
|||
'Script escaped when using parse format'
|
||||
);
|
||||
|
||||
|
||||
} );
|
||||
|
||||
QUnit.test( 'mw.msg', 14, function ( assert ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue