"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/qunit/suites/resources/mediawiki.rcfilters/UriProcessor.test.js" between
mediawiki-1.31.1.tar.gz and mediawiki-1.32.0.tar.gz

About: MediaWiki is a wiki engine (the collaborative editing software that runs for e.g. Wikipedia, the free encyclopedia).

UriProcessor.test.js  (mediawiki-1.31.1):UriProcessor.test.js  (mediawiki-1.32.0)
/* eslint-disable camelcase */ /* eslint-disable camelcase */
/* eslint no-underscore-dangle: "off" */ /* eslint no-underscore-dangle: "off" */
( function ( mw, $ ) { ( function () {
var mockFilterStructure = [ { var mockFilterStructure = [ {
name: 'group1', name: 'group1',
title: 'Group 1', title: 'Group 1',
type: 'send_unselected_if_any', type: 'send_unselected_if_any',
filters: [ filters: [
{ name: 'filter1', cssClass: 'filter1class', defa ult: true }, { name: 'filter1', cssClass: 'filter1class', defa ult: true },
{ name: 'filter2', cssClass: 'filter2class' } { name: 'filter2', cssClass: 'filter2class' }
] ]
}, { }, {
name: 'group2', name: 'group2',
skipping to change at line 48 skipping to change at line 48
minimalDefaultParams = { minimalDefaultParams = {
filter1: '1', filter1: '1',
filter4: '1' filter4: '1'
}; };
QUnit.module( 'mediawiki.rcfilters - UriProcessor' ); QUnit.module( 'mediawiki.rcfilters - UriProcessor' );
QUnit.test( 'getVersion', function ( assert ) { QUnit.test( 'getVersion', function ( assert ) {
var uriProcessor = new mw.rcfilters.UriProcessor( new mw.rcfilter s.dm.FiltersViewModel() ); var uriProcessor = new mw.rcfilters.UriProcessor( new mw.rcfilter s.dm.FiltersViewModel() );
assert.ok( assert.strictEqual(
uriProcessor.getVersion( { param1: 'foo', urlversion: '2' } ), uriProcessor.getVersion( { param1: 'foo', urlversion: '2' } ),
2, 2,
'Retrieving the version from the URI query' 'Retrieving the version from the URI query'
); );
assert.ok( assert.strictEqual(
uriProcessor.getVersion( { param1: 'foo' } ), uriProcessor.getVersion( { param1: 'foo' } ),
1, 1,
'Getting version 1 if no version is specified' 'Getting version 1 if no version is specified'
); );
} ); } );
QUnit.test( 'getUpdatedUri', function ( assert ) { QUnit.test( 'getUpdatedUri', function ( assert ) {
var uriProcessor, var uriProcessor,
filtersModel = new mw.rcfilters.dm.FiltersViewModel(), filtersModel = new mw.rcfilters.dm.FiltersViewModel(),
makeUri = function ( queryParams ) { makeUri = function ( queryParams ) {
skipping to change at line 191 skipping to change at line 191
}, },
result: true, result: true,
message: 'Changed unrecognized parameters are a new state' message: 'Changed unrecognized parameters are a new state'
} }
]; ];
filtersModel.initializeFilters( mockFilterStructure ); filtersModel.initializeFilters( mockFilterStructure );
uriProcessor = new mw.rcfilters.UriProcessor( filtersModel ); uriProcessor = new mw.rcfilters.UriProcessor( filtersModel );
cases.forEach( function ( testCase ) { cases.forEach( function ( testCase ) {
assert.equal( assert.strictEqual(
uriProcessor.isNewState( testCase.states.curr, te stCase.states.new ), uriProcessor.isNewState( testCase.states.curr, te stCase.states.new ),
testCase.result, testCase.result,
testCase.message testCase.message
); );
} ); } );
} ); } );
QUnit.test( 'doesQueryContainRecognizedParams', function ( assert ) { QUnit.test( 'doesQueryContainRecognizedParams', function ( assert ) {
var uriProcessor, var uriProcessor,
filtersModel = new mw.rcfilters.dm.FiltersViewModel(), filtersModel = new mw.rcfilters.dm.FiltersViewModel(),
skipping to change at line 234 skipping to change at line 234
query: { foo: 'bar', debug: true }, query: { foo: 'bar', debug: true },
result: false, result: false,
message: 'Only unrecognized parameters ma kes the query invalid for load' message: 'Only unrecognized parameters ma kes the query invalid for load'
} }
]; ];
filtersModel.initializeFilters( mockFilterStructure ); filtersModel.initializeFilters( mockFilterStructure );
uriProcessor = new mw.rcfilters.UriProcessor( filtersModel ); uriProcessor = new mw.rcfilters.UriProcessor( filtersModel );
cases.forEach( function ( testCase ) { cases.forEach( function ( testCase ) {
assert.equal( assert.strictEqual(
uriProcessor.doesQueryContainRecognizedParams( te stCase.query ), uriProcessor.doesQueryContainRecognizedParams( te stCase.query ),
testCase.result, testCase.result,
testCase.message testCase.message
); );
} ); } );
} ); } );
QUnit.test( '_getNormalizedQueryParams', function ( assert ) { QUnit.test( '_getNormalizedQueryParams', function ( assert ) {
var uriProcessor, var uriProcessor,
filtersModel = new mw.rcfilters.dm.FiltersViewModel(), filtersModel = new mw.rcfilters.dm.FiltersViewModel(),
skipping to change at line 344 skipping to change at line 344
cases.forEach( function ( testCase ) { cases.forEach( function ( testCase ) {
var uriProcessor = new mw.rcfilters.UriProcessor( var uriProcessor = new mw.rcfilters.UriProcessor(
null, null,
{ {
normalizeTarget: testCase.normalizeTarget === undefined ? normalizeTarget: testCase.normalizeTarget === undefined ?
true : testCase.normalizeTarget true : testCase.normalizeTarget
} }
); );
assert.equal( assert.strictEqual(
uriProcessor._normalizeTargetInUri( uriProcessor._normalizeTargetInUri(
new mw.Uri( testCase.input ) new mw.Uri( testCase.input )
).toString(), ).toString(),
new mw.Uri( testCase.output ).toString(), new mw.Uri( testCase.output ).toString(),
testCase.message testCase.message
); );
} ); } );
} ); } );
}( mediaWiki, jQuery ) ); }() );
 End of changes. 7 change blocks. 
6 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)