mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-23 14:06:52 +00:00
build: Updating eslint-config-wikimedia to 0.28.0
The following rules are failing and were disabled: * modules/ve-mw/tests: * implicit-arrow-linebreak Change-Id: If857233c0de24c8cf619dbb1347ebb375f3ab1ba
This commit is contained in:
parent
7789b55666
commit
702677220d
|
@ -146,13 +146,13 @@ module.exports = function ( grunt ) {
|
||||||
grunt.registerTask( 'git-status', function () {
|
grunt.registerTask( 'git-status', function () {
|
||||||
const done = this.async();
|
const done = this.async();
|
||||||
// Are there unstaged changes?
|
// Are there unstaged changes?
|
||||||
require( 'child_process' ).exec( 'git ls-files --modified', function ( err, stdout, stderr ) {
|
require( 'child_process' ).exec( 'git ls-files --modified', ( err, stdout, stderr ) => {
|
||||||
const ret = err || stderr || stdout;
|
const ret = err || stderr || stdout;
|
||||||
if ( ret ) {
|
if ( ret ) {
|
||||||
grunt.log.error( 'Unstaged changes in these files:' );
|
grunt.log.error( 'Unstaged changes in these files:' );
|
||||||
grunt.log.error( ret );
|
grunt.log.error( ret );
|
||||||
// Show a condensed diff
|
// Show a condensed diff
|
||||||
require( 'child_process' ).exec( 'git diff -U1 | tail -n +3', function ( err2, stdout2, stderr2 ) {
|
require( 'child_process' ).exec( 'git diff -U1 | tail -n +3', ( err2, stdout2, stderr2 ) => {
|
||||||
grunt.log.write( err2 || stderr2 || stdout2 );
|
grunt.log.write( err2 || stderr2 || stdout2 );
|
||||||
done( false );
|
done( false );
|
||||||
} );
|
} );
|
||||||
|
|
|
@ -76,9 +76,7 @@ function checkFiles() {
|
||||||
const modulesFiles = new Set();
|
const modulesFiles = new Set();
|
||||||
addModulesToSet( modulesJson, modulesFiles, 'lib/ve' );
|
addModulesToSet( modulesJson, modulesFiles, 'lib/ve' );
|
||||||
|
|
||||||
const missingFiles = Array.from( modulesFiles ).filter( ( file ) => {
|
const missingFiles = Array.from( modulesFiles ).filter( ( file ) => !extensionFiles.has( file ) && !isIgnored( file ) );
|
||||||
return !extensionFiles.has( file ) && !isIgnored( file );
|
|
||||||
} );
|
|
||||||
|
|
||||||
if ( unusedIgnores.size ) {
|
if ( unusedIgnores.size ) {
|
||||||
console.warn(
|
console.warn(
|
||||||
|
|
|
@ -11,7 +11,7 @@ function runTests( lang ) {
|
||||||
|
|
||||||
test.describe( 'Screenshots: ' + lang, function () {
|
test.describe( 'Screenshots: ' + lang, function () {
|
||||||
this.lang = lang;
|
this.lang = lang;
|
||||||
test.it( 'Simple diff', function () {
|
test.it( 'Simple diff', () => {
|
||||||
runLang( 'VisualEditor_diff_simple', diffs.simple );
|
runLang( 'VisualEditor_diff_simple', diffs.simple );
|
||||||
runLang( 'VisualEditor_diff_move_and_change', diffs.moveAndChange );
|
runLang( 'VisualEditor_diff_move_and_change', diffs.moveAndChange );
|
||||||
runLang( 'VisualEditor_diff_link_change', diffs.linkChange );
|
runLang( 'VisualEditor_diff_link_change', diffs.linkChange );
|
||||||
|
|
|
@ -33,15 +33,15 @@ function createScreenshotEnvironment( test ) {
|
||||||
driver.manage().window().setSize( 1200, 1000 );
|
driver.manage().window().setSize( 1200, 1000 );
|
||||||
|
|
||||||
driver.get( 'https://en.wikipedia.org/wiki/Help:Sample_page?veaction=edit&vehidebetadialog=1&uselang=' + lang )
|
driver.get( 'https://en.wikipedia.org/wiki/Help:Sample_page?veaction=edit&vehidebetadialog=1&uselang=' + lang )
|
||||||
.then( null, function ( e ) {
|
.then( null, ( e ) => {
|
||||||
console.error( e.message );
|
console.error( e.message );
|
||||||
} );
|
} );
|
||||||
driver.wait(
|
driver.wait(
|
||||||
driver.executeAsyncScript(
|
driver.executeAsyncScript(
|
||||||
require( './screenshots-client/utils.js' )
|
require( './screenshots-client/utils.js' )
|
||||||
).then( function ( cs ) {
|
).then( ( cs ) => {
|
||||||
clientSize = cs;
|
clientSize = cs;
|
||||||
}, function ( e ) {
|
}, ( e ) => {
|
||||||
// Log error (timeout)
|
// Log error (timeout)
|
||||||
console.error( e.message );
|
console.error( e.message );
|
||||||
// Setup failed, set clientSize to null so no screenshots are generated
|
// Setup failed, set clientSize to null so no screenshots are generated
|
||||||
|
@ -50,9 +50,9 @@ function createScreenshotEnvironment( test ) {
|
||||||
);
|
);
|
||||||
} );
|
} );
|
||||||
|
|
||||||
test.afterEach( function () {
|
test.afterEach( () => {
|
||||||
driver.quit()
|
driver.quit()
|
||||||
.then( null, function ( e ) {
|
.then( null, ( e ) => {
|
||||||
console.error( e.message );
|
console.error( e.message );
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
@ -67,7 +67,7 @@ function createScreenshotEnvironment( test ) {
|
||||||
const right = Math.min( clientSize.width, rect.left + rect.width + padding );
|
const right = Math.min( clientSize.width, rect.left + rect.width + padding );
|
||||||
const bottom = Math.min( clientSize.height, rect.top + rect.height + padding );
|
const bottom = Math.min( clientSize.height, rect.top + rect.height + padding );
|
||||||
|
|
||||||
return Jimp.read( imageBuffer ).then( function ( jimpImage ) {
|
return Jimp.read( imageBuffer ).then( ( jimpImage ) => {
|
||||||
try {
|
try {
|
||||||
jimpImage
|
jimpImage
|
||||||
.crop( left, top, right - left, bottom - top )
|
.crop( left, top, right - left, bottom - top )
|
||||||
|
@ -89,20 +89,18 @@ function createScreenshotEnvironment( test ) {
|
||||||
|
|
||||||
driver.manage().timeouts().setScriptTimeout( TIMEOUT );
|
driver.manage().timeouts().setScriptTimeout( TIMEOUT );
|
||||||
driver.wait(
|
driver.wait(
|
||||||
driver.executeAsyncScript( clientScript ).then( function ( rect ) {
|
driver.executeAsyncScript( clientScript ).then( ( rect ) => driver.takeScreenshot().then( ( base64Image ) => {
|
||||||
return driver.takeScreenshot().then( function ( base64Image ) {
|
|
||||||
if ( rect ) {
|
if ( rect ) {
|
||||||
const imageBuffer = Buffer.from( base64Image, 'base64' );
|
const imageBuffer = Buffer.from( base64Image, 'base64' );
|
||||||
return cropScreenshot( filename, imageBuffer, rect, padding );
|
return cropScreenshot( filename, imageBuffer, rect, padding );
|
||||||
} else {
|
} else {
|
||||||
fs.writeFile( filename, base64Image, 'base64' );
|
fs.writeFile( filename, base64Image, 'base64' );
|
||||||
}
|
}
|
||||||
} ).then( function () {
|
} ).then( () => {
|
||||||
if ( teardownScript ) {
|
if ( teardownScript ) {
|
||||||
return driver.executeAsyncScript( teardownScript );
|
return driver.executeAsyncScript( teardownScript );
|
||||||
}
|
}
|
||||||
} );
|
} ), ( e ) => {
|
||||||
}, function ( e ) {
|
|
||||||
// Log error (timeout)
|
// Log error (timeout)
|
||||||
console.error( e );
|
console.error( e );
|
||||||
} )
|
} )
|
||||||
|
|
|
@ -11,7 +11,7 @@ function runTests( lang ) {
|
||||||
|
|
||||||
test.describe( 'Screenshots: ' + lang, function () {
|
test.describe( 'Screenshots: ' + lang, function () {
|
||||||
this.lang = lang;
|
this.lang = lang;
|
||||||
test.it( 'Screenshots', function () {
|
test.it( 'Screenshots', () => {
|
||||||
|
|
||||||
// Toolbar & action tools
|
// Toolbar & action tools
|
||||||
runLang( 'VisualEditor_toolbar', userGuide.toolbar, 0 );
|
runLang( 'VisualEditor_toolbar', userGuide.toolbar, 0 );
|
||||||
|
@ -57,6 +57,6 @@ function runTests( lang ) {
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
langs.forEach( function ( lang ) {
|
langs.forEach( ( lang ) => {
|
||||||
runTests( lang );
|
runTests( lang );
|
||||||
} );
|
} );
|
||||||
|
|
|
@ -12,10 +12,14 @@
|
||||||
"sinon": "readonly"
|
"sinon": "readonly"
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"compat/compat": [ "error", "last 2 chrome versions, last 2 firefox versions" ],
|
"compat/compat": [
|
||||||
|
"error",
|
||||||
|
"last 2 chrome versions, last 2 firefox versions"
|
||||||
|
],
|
||||||
"indent": "off",
|
"indent": "off",
|
||||||
"no-jquery/no-html": "off",
|
"no-jquery/no-html": "off",
|
||||||
"no-jquery/no-parse-html-literal": "off"
|
"no-jquery/no-parse-html-literal": "off",
|
||||||
|
"implicit-arrow-linebreak": "warn"
|
||||||
},
|
},
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": 2018
|
"ecmaVersion": 2018
|
||||||
|
|
|
@ -235,6 +235,6 @@ QUnit.test.each( 'getFragment', {
|
||||||
original: 'Foo#bar#baz#bat',
|
original: 'Foo#bar#baz#bat',
|
||||||
expected: 'bar#baz#bat'
|
expected: 'bar#baz#bat'
|
||||||
}
|
}
|
||||||
}, function ( assert, { original, expected } ) {
|
}, ( assert, { original, expected } ) => {
|
||||||
assert.strictEqual( ve.dm.MWInternalLinkAnnotation.static.getFragment( original ), expected );
|
assert.strictEqual( ve.dm.MWInternalLinkAnnotation.static.getFragment( original ), expected );
|
||||||
} );
|
} );
|
||||||
|
|
|
@ -44,8 +44,7 @@
|
||||||
[ '/unexpected_prefix', '/unexpected prefix' ],
|
[ '/unexpected_prefix', '/unexpected prefix' ],
|
||||||
[ './Template:%C3%9Cnicode%5Fexample/subpage', 'Template:Ünicode example/subpage' ],
|
[ './Template:%C3%9Cnicode%5Fexample/subpage', 'Template:Ünicode example/subpage' ],
|
||||||
[ './Template:Possibly_invalid%5B%5D', 'Template:Possibly invalid[]' ]
|
[ './Template:Possibly_invalid%5B%5D', 'Template:Possibly invalid[]' ]
|
||||||
].forEach( ( [ href, expected ] ) =>
|
].forEach( ( [ href, expected ] ) => QUnit.test( 'getTitle: ' + href, ( assert ) => {
|
||||||
QUnit.test( 'getTitle: ' + href, ( assert ) => {
|
|
||||||
const transclusion = { nextUniquePartId: () => '' },
|
const transclusion = { nextUniquePartId: () => '' },
|
||||||
template = new ve.dm.MWTemplateModel( transclusion, { href } );
|
template = new ve.dm.MWTemplateModel( transclusion, { href } );
|
||||||
assert.strictEqual( template.getTitle(), expected );
|
assert.strictEqual( template.getTitle(), expected );
|
||||||
|
@ -200,8 +199,7 @@
|
||||||
},
|
},
|
||||||
expected: [ 'foo', 'bar', 'Bar', 'empty' ]
|
expected: [ 'foo', 'bar', 'Bar', 'empty' ]
|
||||||
}
|
}
|
||||||
].forEach( ( { name, spec, expected } ) =>
|
].forEach( ( { name, spec, expected } ) => QUnit.test( name, ( assert ) => {
|
||||||
QUnit.test( name, ( assert ) => {
|
|
||||||
const template = newTemplateModel();
|
const template = newTemplateModel();
|
||||||
|
|
||||||
template.getSpec().setTemplateData( spec );
|
template.getSpec().setTemplateData( spec );
|
||||||
|
@ -322,8 +320,7 @@
|
||||||
''
|
''
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
].forEach( ( { name, spec, expected } ) =>
|
].forEach( ( { name, spec, expected } ) => QUnit.test( 'getOrderedParameterNames: ' + name, ( assert ) => {
|
||||||
QUnit.test( 'getOrderedParameterNames: ' + name, ( assert ) => {
|
|
||||||
const template = newTemplateModel();
|
const template = newTemplateModel();
|
||||||
|
|
||||||
if ( spec ) {
|
if ( spec ) {
|
||||||
|
@ -459,8 +456,7 @@
|
||||||
''
|
''
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
].forEach( ( { name, spec, expected } ) =>
|
].forEach( ( { name, spec, expected } ) => QUnit.test( 'getAllParametersOrdered: ' + name, ( assert ) => {
|
||||||
QUnit.test( 'getAllParametersOrdered: ' + name, ( assert ) => {
|
|
||||||
const template = newTemplateModel();
|
const template = newTemplateModel();
|
||||||
|
|
||||||
if ( spec ) {
|
if ( spec ) {
|
||||||
|
@ -493,8 +489,7 @@
|
||||||
[ ' SUBST: a', 'b', 'Template:A', 'ignores capitalization and whitespace' ],
|
[ ' SUBST: a', 'b', 'Template:A', 'ignores capitalization and whitespace' ],
|
||||||
[ 'subst :a', 'b', 'Template:Subst :a', 'leaves bad whitespace untouched' ],
|
[ 'subst :a', 'b', 'Template:Subst :a', 'leaves bad whitespace untouched' ],
|
||||||
[ 'int:a', 'b', 'Template:Int:a', 'leaves other prefixes untouched' ]
|
[ 'int:a', 'b', 'Template:Int:a', 'leaves other prefixes untouched' ]
|
||||||
].forEach( ( [ wt, href, expected, message ] ) =>
|
].forEach( ( [ wt, href, expected, message ] ) => QUnit.test( 'getTemplateDataQueryTitle: ' + message, ( assert ) => {
|
||||||
QUnit.test( 'getTemplateDataQueryTitle: ' + message, ( assert ) => {
|
|
||||||
const transclusion = { nextUniquePartId: () => '' },
|
const transclusion = { nextUniquePartId: () => '' },
|
||||||
data = { target: { wt, href } },
|
data = { target: { wt, href } },
|
||||||
model = ve.dm.MWTemplateModel.newFromData( transclusion, data );
|
model = ve.dm.MWTemplateModel.newFromData( transclusion, data );
|
||||||
|
@ -512,8 +507,7 @@
|
||||||
[ { p1: { wt: ' ' } }, true, 'space' ],
|
[ { p1: { wt: ' ' } }, true, 'space' ],
|
||||||
[ { p1: { wt: '0' } }, true, '0' ],
|
[ { p1: { wt: '0' } }, true, '0' ],
|
||||||
[ { p1: { wt: '\nfoo' } }, true, 'newline' ]
|
[ { p1: { wt: '\nfoo' } }, true, 'newline' ]
|
||||||
].forEach( ( [ params, expected, message ] ) =>
|
].forEach( ( [ params, expected, message ] ) => QUnit.test( 'containsValuableData: ' + message, ( assert ) => {
|
||||||
QUnit.test( 'containsValuableData: ' + message, ( assert ) => {
|
|
||||||
const transclusion = { nextUniquePartId: () => '' },
|
const transclusion = { nextUniquePartId: () => '' },
|
||||||
data = { target: {}, params },
|
data = { target: {}, params },
|
||||||
model = ve.dm.MWTemplateModel.newFromData( transclusion, data );
|
model = ve.dm.MWTemplateModel.newFromData( transclusion, data );
|
||||||
|
|
|
@ -118,8 +118,7 @@
|
||||||
[ '{{a_a}}', './Talk:b_b', 'Talk:B b', 'does not strip other namespaces' ],
|
[ '{{a_a}}', './Talk:b_b', 'Talk:B b', 'does not strip other namespaces' ],
|
||||||
[ '{{a_a}}', './b_b', ':B b', 'title in main namespace must be prefixed' ],
|
[ '{{a_a}}', './b_b', ':B b', 'title in main namespace must be prefixed' ],
|
||||||
[ '{{a_a}}', './Template:{{b_b}}', 'Template:{{b b}}', 'falls back to unmodified href if invalid' ]
|
[ '{{a_a}}', './Template:{{b_b}}', 'Template:{{b b}}', 'falls back to unmodified href if invalid' ]
|
||||||
].forEach( ( [ wt, href, expected, message ] ) =>
|
].forEach( ( [ wt, href, expected, message ] ) => QUnit.test( 'getLabel: ' + message, ( assert ) => {
|
||||||
QUnit.test( 'getLabel: ' + message, ( assert ) => {
|
|
||||||
const transclusion = new ve.dm.MWTransclusionModel(),
|
const transclusion = new ve.dm.MWTransclusionModel(),
|
||||||
template = new ve.dm.MWTemplateModel( transclusion, { wt, href } ),
|
template = new ve.dm.MWTemplateModel( transclusion, { wt, href } ),
|
||||||
spec = new ve.dm.MWTemplateSpecModel( template );
|
spec = new ve.dm.MWTemplateSpecModel( template );
|
||||||
|
@ -133,8 +132,7 @@
|
||||||
null,
|
null,
|
||||||
[],
|
[],
|
||||||
{}
|
{}
|
||||||
].forEach( ( templateData ) =>
|
].forEach( ( templateData ) => QUnit.test( 'Invalid TemplateData, e.g. empty or without params', ( assert ) => {
|
||||||
QUnit.test( 'Invalid TemplateData, e.g. empty or without params', ( assert ) => {
|
|
||||||
const template = createTemplateMock(),
|
const template = createTemplateMock(),
|
||||||
spec = new ve.dm.MWTemplateSpecModel( template );
|
spec = new ve.dm.MWTemplateSpecModel( template );
|
||||||
|
|
||||||
|
@ -301,8 +299,7 @@
|
||||||
|
|
||||||
[ { notemplatedata: false }, true, 'unexpected false' ],
|
[ { notemplatedata: false }, true, 'unexpected false' ],
|
||||||
[ { notemplatedata: '' }, true, 'unsupported formatversion=1' ]
|
[ { notemplatedata: '' }, true, 'unsupported formatversion=1' ]
|
||||||
].forEach( ( [ templateData, expected, message ] ) =>
|
].forEach( ( [ templateData, expected, message ] ) => QUnit.test( 'isDocumented(): ' + message, ( assert ) => {
|
||||||
QUnit.test( 'isDocumented(): ' + message, ( assert ) => {
|
|
||||||
const template = createTemplateMock(),
|
const template = createTemplateMock(),
|
||||||
spec = new ve.dm.MWTemplateSpecModel( template );
|
spec = new ve.dm.MWTemplateSpecModel( template );
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,7 @@
|
||||||
[ ' ', true ],
|
[ ' ', true ],
|
||||||
[ '0', true ],
|
[ '0', true ],
|
||||||
[ '\nfoo', true ]
|
[ '\nfoo', true ]
|
||||||
].forEach( ( [ wikitext, expected ] ) =>
|
].forEach( ( [ wikitext, expected ] ) => QUnit.test( 'containsValuableData: ' + wikitext, ( assert ) => {
|
||||||
QUnit.test( 'containsValuableData: ' + wikitext, ( assert ) => {
|
|
||||||
const model = new ve.dm.MWTransclusionContentModel( createTransclusionModel(), wikitext );
|
const model = new ve.dm.MWTransclusionContentModel( createTransclusionModel(), wikitext );
|
||||||
|
|
||||||
assert.strictEqual( model.containsValuableData(), expected );
|
assert.strictEqual( model.containsValuableData(), expected );
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
} );
|
} );
|
||||||
};
|
};
|
||||||
|
|
||||||
QUnit.test( 'nextUniquePartId', function ( assert ) {
|
QUnit.test( 'nextUniquePartId', ( assert ) => {
|
||||||
const transclusion = new ve.dm.MWTransclusionModel();
|
const transclusion = new ve.dm.MWTransclusionModel();
|
||||||
assert.strictEqual( transclusion.nextUniquePartId(), 'part_0' );
|
assert.strictEqual( transclusion.nextUniquePartId(), 'part_0' );
|
||||||
assert.strictEqual( transclusion.nextUniquePartId(), 'part_1' );
|
assert.strictEqual( transclusion.nextUniquePartId(), 'part_1' );
|
||||||
|
|
|
@ -14,11 +14,9 @@ ve.dm.mwExample = {};
|
||||||
|
|
||||||
ve.dm.mwExample.baseUri = 'http://example.com/wiki/';
|
ve.dm.mwExample.baseUri = 'http://example.com/wiki/';
|
||||||
|
|
||||||
ve.dm.mwExample.createExampleDocument = ( name, store, base ) =>
|
ve.dm.mwExample.createExampleDocument = ( name, store, base ) => ve.dm.example.createExampleDocumentFromObject( name, store, ve.dm.mwExample, base || ve.dm.mwExample.baseUri );
|
||||||
ve.dm.example.createExampleDocumentFromObject( name, store, ve.dm.mwExample, base || ve.dm.mwExample.baseUri );
|
|
||||||
|
|
||||||
ve.dm.mwExample.createExampleDocumentFromData = ( data, store, base ) =>
|
ve.dm.mwExample.createExampleDocumentFromData = ( data, store, base ) => ve.dm.example.createExampleDocumentFromData( data, store, base || ve.dm.mwExample.baseUri );
|
||||||
ve.dm.example.createExampleDocumentFromData( data, store, base || ve.dm.mwExample.baseUri );
|
|
||||||
|
|
||||||
ve.dm.mwExample.MWTransclusion = {
|
ve.dm.mwExample.MWTransclusion = {
|
||||||
blockOpen: ve.dm.example.singleLine`
|
blockOpen: ve.dm.example.singleLine`
|
||||||
|
|
|
@ -22,11 +22,9 @@ ve.test.utils.runWikitextStringHandlerTest = ( assert, server, string, mimeType,
|
||||||
item = ve.ui.DataTransferItem.static.newFromString( string, mimeType ),
|
item = ve.ui.DataTransferItem.static.newFromString( string, mimeType ),
|
||||||
doc = ve.dm.Document.static.newBlankDocument(),
|
doc = ve.dm.Document.static.newBlankDocument(),
|
||||||
mockSurface = {
|
mockSurface = {
|
||||||
getModel: () => {
|
getModel: () => ( {
|
||||||
return {
|
|
||||||
getDocument: () => doc
|
getDocument: () => doc
|
||||||
};
|
} ),
|
||||||
},
|
|
||||||
createProgress: () => ve.createDeferred().promise()
|
createProgress: () => ve.createDeferred().promise()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ QUnit.module( 've.ui.FragmentInspector (MW)', ve.test.utils.newMwEnvironment( {
|
||||||
|
|
||||||
/* Tests */
|
/* Tests */
|
||||||
|
|
||||||
QUnit.test( 'Wikitext link inspector', function ( assert ) {
|
QUnit.test( 'Wikitext link inspector', ( assert ) => {
|
||||||
const done = assert.async(),
|
const done = assert.async(),
|
||||||
surface = ve.init.target.createSurface(
|
surface = ve.init.target.createSurface(
|
||||||
ve.dm.converter.getModelFromDom(
|
ve.dm.converter.getModelFromDom(
|
||||||
|
|
|
@ -46,8 +46,7 @@ QUnit.test( 'Input event handlers', ( assert ) => {
|
||||||
[ 'usedAliasNoLabel', '(visualeditor-dialog-transclusion-add-param-error-alias: usedAliasNoLabel, usedAliasNoLabel)' ],
|
[ 'usedAliasNoLabel', '(visualeditor-dialog-transclusion-add-param-error-alias: usedAliasNoLabel, usedAliasNoLabel)' ],
|
||||||
[ 'usedDeprecated', '(visualeditor-dialog-transclusion-add-param-error-exists-selected: usedDeprecated, usedDeprecated)' ],
|
[ 'usedDeprecated', '(visualeditor-dialog-transclusion-add-param-error-exists-selected: usedDeprecated, usedDeprecated)' ],
|
||||||
[ 'unusedDeprecated', '(visualeditor-dialog-transclusion-add-param-error-deprecated: unusedDeprecated, unusedDeprecated)' ]
|
[ 'unusedDeprecated', '(visualeditor-dialog-transclusion-add-param-error-deprecated: unusedDeprecated, unusedDeprecated)' ]
|
||||||
].forEach( ( [ input, expected ] ) =>
|
].forEach( ( [ input, expected ] ) => QUnit.test( 'getValidationErrors: ' + input, ( assert ) => {
|
||||||
QUnit.test( 'getValidationErrors: ' + input, ( assert ) => {
|
|
||||||
const data = {
|
const data = {
|
||||||
target: {},
|
target: {},
|
||||||
params: {
|
params: {
|
||||||
|
|
|
@ -38,8 +38,7 @@ QUnit.module( 've.ui.MWParameterPage', ve.test.utils.newMwEnvironment );
|
||||||
[ 'wiki-template-name', '', mw.widgets.TitleInputWidget ],
|
[ 'wiki-template-name', '', mw.widgets.TitleInputWidget ],
|
||||||
[ 'wiki-template-name', 'GoodTitle', mw.widgets.TitleInputWidget ],
|
[ 'wiki-template-name', 'GoodTitle', mw.widgets.TitleInputWidget ],
|
||||||
[ 'wiki-template-name', '[[BadTitle]]', ve.ui.MWLazyMultilineTextInputWidget ]
|
[ 'wiki-template-name', '[[BadTitle]]', ve.ui.MWLazyMultilineTextInputWidget ]
|
||||||
].forEach( ( [ type, value, expected ] ) =>
|
].forEach( ( [ type, value, expected ] ) => QUnit.test( `createValueInput: ${ type }, ${ value }`, ( assert ) => {
|
||||||
QUnit.test( `createValueInput: ${ type }, ${ value }`, ( assert ) => {
|
|
||||||
const transclusion = new ve.dm.MWTransclusionModel(),
|
const transclusion = new ve.dm.MWTransclusionModel(),
|
||||||
template = new ve.dm.MWTemplateModel( transclusion, {} ),
|
template = new ve.dm.MWTemplateModel( transclusion, {} ),
|
||||||
parameter = new ve.dm.MWParameterModel( template, 'p', value );
|
parameter = new ve.dm.MWParameterModel( template, 'p', value );
|
||||||
|
@ -68,8 +67,7 @@ QUnit.module( 've.ui.MWParameterPage', ve.test.utils.newMwEnvironment );
|
||||||
[ 'wiki-user-name', mw.widgets.UserInputWidget ],
|
[ 'wiki-user-name', mw.widgets.UserInputWidget ],
|
||||||
[ 'wiki-file-name', mw.widgets.TitleInputWidget ],
|
[ 'wiki-file-name', mw.widgets.TitleInputWidget ],
|
||||||
[ 'wiki-template-name', mw.widgets.TitleInputWidget ]
|
[ 'wiki-template-name', mw.widgets.TitleInputWidget ]
|
||||||
].forEach( ( [ type, expected ] ) =>
|
].forEach( ( [ type, expected ] ) => QUnit.test( `suggestedvalues: ${ type }`, ( assert ) => {
|
||||||
QUnit.test( `suggestedvalues: ${ type }`, ( assert ) => {
|
|
||||||
const transclusion = new ve.dm.MWTransclusionModel(),
|
const transclusion = new ve.dm.MWTransclusionModel(),
|
||||||
template = new ve.dm.MWTemplateModel( transclusion, {} ),
|
template = new ve.dm.MWTemplateModel( transclusion, {} ),
|
||||||
parameter = new ve.dm.MWParameterModel( template, 'p', '' );
|
parameter = new ve.dm.MWParameterModel( template, 'p', '' );
|
||||||
|
@ -119,8 +117,7 @@ QUnit.module( 've.ui.MWParameterPage', ve.test.utils.newMwEnvironment );
|
||||||
'', ' ', true,
|
'', ' ', true,
|
||||||
'same for the default'
|
'same for the default'
|
||||||
]
|
]
|
||||||
].forEach( ( [ value, defaultValue, expected, message ] ) =>
|
].forEach( ( [ value, defaultValue, expected, message ] ) => QUnit.test( 'containsSomeValue: ' + message, ( assert ) => {
|
||||||
QUnit.test( 'containsSomeValue: ' + message, ( assert ) => {
|
|
||||||
const transclusion = new ve.dm.MWTransclusionModel(),
|
const transclusion = new ve.dm.MWTransclusionModel(),
|
||||||
template = new ve.dm.MWTemplateModel( transclusion, {} ),
|
template = new ve.dm.MWTemplateModel( transclusion, {} ),
|
||||||
parameter = new ve.dm.MWParameterModel( template, 'p', value );
|
parameter = new ve.dm.MWParameterModel( template, 'p', value );
|
||||||
|
|
|
@ -13,8 +13,7 @@ QUnit.test( 'Constructor passes config to parent', ( assert ) => {
|
||||||
[ '', false, 'empty string' ],
|
[ '', false, 'empty string' ],
|
||||||
[ '2', false, 'unexpected string' ],
|
[ '2', false, 'unexpected string' ],
|
||||||
[ true, false, 'unexpected type' ]
|
[ true, false, 'unexpected type' ]
|
||||||
].forEach( ( [ value, expected, message ] ) =>
|
].forEach( ( [ value, expected, message ] ) => QUnit.test( `setValue( ${ message } )`, ( assert ) => {
|
||||||
QUnit.test( `setValue( ${ message } )`, ( assert ) => {
|
|
||||||
const widget = new ve.ui.MWParameterCheckboxInputWidget();
|
const widget = new ve.ui.MWParameterCheckboxInputWidget();
|
||||||
widget.setValue( value );
|
widget.setValue( value );
|
||||||
|
|
||||||
|
@ -26,8 +25,7 @@ QUnit.test( 'Constructor passes config to parent', ( assert ) => {
|
||||||
[
|
[
|
||||||
true,
|
true,
|
||||||
false
|
false
|
||||||
].forEach( ( value ) =>
|
].forEach( ( value ) => QUnit.test( `setSelected( ${ value } )`, ( assert ) => {
|
||||||
QUnit.test( `setSelected( ${ value } )`, ( assert ) => {
|
|
||||||
const widget = new ve.ui.MWParameterCheckboxInputWidget();
|
const widget = new ve.ui.MWParameterCheckboxInputWidget();
|
||||||
widget.setSelected( value );
|
widget.setSelected( value );
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,15 @@
|
||||||
{
|
{
|
||||||
const toggleCirrusSearchLookup = ( enabled ) =>
|
const toggleCirrusSearchLookup = ( enabled ) => mw.config.set( 'wgVisualEditorConfig', ve.extendObject( {}, mw.config.get( 'wgVisualEditorConfig' ), {
|
||||||
mw.config.set( 'wgVisualEditorConfig', ve.extendObject( {}, mw.config.get( 'wgVisualEditorConfig' ), {
|
|
||||||
cirrusSearchLookup: enabled !== false
|
cirrusSearchLookup: enabled !== false
|
||||||
} ) );
|
} ) );
|
||||||
|
|
||||||
const makeFakeApi = () => {
|
const makeFakeApi = () => ( {
|
||||||
return {
|
|
||||||
defaults: { parameters: {} },
|
defaults: { parameters: {} },
|
||||||
get: () => {
|
get: () => ( {
|
||||||
return {
|
|
||||||
abort: { bind: () => {} },
|
abort: { bind: () => {} },
|
||||||
then: () => {}
|
then: () => {}
|
||||||
};
|
} )
|
||||||
}
|
} );
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
QUnit.module( 've.ui.MWTemplateTitleInputWidget', ve.test.utils.newMwEnvironment( {
|
QUnit.module( 've.ui.MWTemplateTitleInputWidget', ve.test.utils.newMwEnvironment( {
|
||||||
// Config will be reset by newMwEnvironment's teardown
|
// Config will be reset by newMwEnvironment's teardown
|
||||||
|
|
|
@ -70,8 +70,7 @@ QUnit.test( 'Adding and moving parts to specific positions', ( assert ) => {
|
||||||
[ 'part_0/foo', 'foo' ],
|
[ 'part_0/foo', 'foo' ],
|
||||||
[ 'part_1/foo', null ],
|
[ 'part_1/foo', null ],
|
||||||
[ 'part_0/foo/bar', 'foo/bar' ]
|
[ 'part_0/foo/bar', 'foo/bar' ]
|
||||||
].forEach( ( [ pageName, expected ] ) =>
|
].forEach( ( [ pageName, expected ] ) => QUnit.test( 'setSelectionByPageName: ' + pageName, ( assert ) => {
|
||||||
QUnit.test( 'setSelectionByPageName: ' + pageName, ( assert ) => {
|
|
||||||
const transclusion = new ve.dm.MWTransclusionModel(),
|
const transclusion = new ve.dm.MWTransclusionModel(),
|
||||||
template = new ve.dm.MWTemplateModel( transclusion, { wt: '' } ),
|
template = new ve.dm.MWTemplateModel( transclusion, { wt: '' } ),
|
||||||
partWidget = new ve.ui.MWTransclusionOutlineTemplateWidget( template ),
|
partWidget = new ve.ui.MWTransclusionOutlineTemplateWidget( template ),
|
||||||
|
|
|
@ -137,7 +137,7 @@ ve.ui.MWAceEditorWidget.prototype.setupEditor = function () {
|
||||||
this.editor.renderer.on( 'resize', this.onEditorResize.bind( this ) );
|
this.editor.renderer.on( 'resize', this.onEditorResize.bind( this ) );
|
||||||
this.setEditorValue( this.getValue() );
|
this.setEditorValue( this.getValue() );
|
||||||
// Force resize (T303964)
|
// Force resize (T303964)
|
||||||
// eslint-disable-next-line es-x/no-resizable-and-growable-arraybuffers
|
|
||||||
this.editor.resize( true );
|
this.editor.resize( true );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -399,7 +399,7 @@ ve.ui.MWAceEditorWidget.prototype.adjustSize = function ( force ) {
|
||||||
// so do nothing here unless this is a user triggered resize, otherwise call the parent method.
|
// so do nothing here unless this is a user triggered resize, otherwise call the parent method.
|
||||||
if ( force ) {
|
if ( force ) {
|
||||||
this.loadingPromise.done( () => {
|
this.loadingPromise.done( () => {
|
||||||
// eslint-disable-next-line es-x/no-resizable-and-growable-arraybuffers
|
|
||||||
this.editor.resize();
|
this.editor.resize();
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
968
package-lock.json
generated
968
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -20,7 +20,7 @@
|
||||||
"@wdio/mocha-framework": "7.16.13",
|
"@wdio/mocha-framework": "7.16.13",
|
||||||
"@wdio/spec-reporter": "7.16.13",
|
"@wdio/spec-reporter": "7.16.13",
|
||||||
"api-testing": "1.6.0",
|
"api-testing": "1.6.0",
|
||||||
"eslint-config-wikimedia": "0.27.0",
|
"eslint-config-wikimedia": "0.28.0",
|
||||||
"grunt": "1.6.1",
|
"grunt": "1.6.1",
|
||||||
"grunt-banana-checker": "0.13.0",
|
"grunt-banana-checker": "0.13.0",
|
||||||
"grunt-contrib-watch": "1.1.0",
|
"grunt-contrib-watch": "1.1.0",
|
||||||
|
@ -29,10 +29,10 @@
|
||||||
"grunt-mocha-test": "0.13.3",
|
"grunt-mocha-test": "0.13.3",
|
||||||
"grunt-stylelint": "0.20.0",
|
"grunt-stylelint": "0.20.0",
|
||||||
"grunt-tyops": "0.1.1",
|
"grunt-tyops": "0.1.1",
|
||||||
|
"jimp": "0.13.0",
|
||||||
"jsdoc": "4.0.2",
|
"jsdoc": "4.0.2",
|
||||||
"jsdoc-class-hierarchy": "1.1.2",
|
"jsdoc-class-hierarchy": "1.1.2",
|
||||||
"jsdoc-wmf-theme": "1.0.1",
|
"jsdoc-wmf-theme": "1.0.1",
|
||||||
"jimp": "0.13.0",
|
|
||||||
"mocha": "5.2.0",
|
"mocha": "5.2.0",
|
||||||
"selenium-webdriver": "3.6.0",
|
"selenium-webdriver": "3.6.0",
|
||||||
"stringify-object": "3.2.2",
|
"stringify-object": "3.2.2",
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
const { action, assert, utils } = require( 'api-testing' );
|
const { action, assert, utils } = require( 'api-testing' );
|
||||||
|
|
||||||
describe( 'Visual Editor API', function () {
|
describe( 'Visual Editor API', () => {
|
||||||
const title = utils.title( 'VisualEditor' );
|
const title = utils.title( 'VisualEditor' );
|
||||||
|
|
||||||
let alice;
|
let alice;
|
||||||
|
@ -66,7 +66,7 @@ describe( 'Visual Editor API', function () {
|
||||||
// VisualEditor edit: 'visualeditoredit' action API ///
|
// VisualEditor edit: 'visualeditoredit' action API ///
|
||||||
const page = utils.title( 'VisualEditorNew' );
|
const page = utils.title( 'VisualEditorNew' );
|
||||||
|
|
||||||
describe( 'Editing', function () {
|
describe( 'Editing', () => {
|
||||||
it( 'Should create page, edit and save page with HTML', async () => {
|
it( 'Should create page, edit and save page with HTML', async () => {
|
||||||
const token = await alice.token();
|
const token = await alice.token();
|
||||||
const html = '<p>save paction</p>';
|
const html = '<p>save paction</p>';
|
||||||
|
|
|
@ -120,8 +120,8 @@ class EditPage extends Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
activationComplete() {
|
activationComplete() {
|
||||||
return browser.executeAsync( function ( done ) {
|
return browser.executeAsync( ( done ) => {
|
||||||
mw.hook( 've.activationComplete' ).add( function () {
|
mw.hook( 've.activationComplete' ).add( () => {
|
||||||
done();
|
done();
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
@ -133,8 +133,8 @@ class EditPage extends Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
saveComplete() {
|
saveComplete() {
|
||||||
return browser.executeAsync( function ( done ) {
|
return browser.executeAsync( ( done ) => {
|
||||||
ve.init.target.on( 'save', function () {
|
ve.init.target.on( 'save', () => {
|
||||||
done();
|
done();
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
|
@ -4,11 +4,11 @@ const EditPage = require( '../pageobjects/edit.page' );
|
||||||
const LoginPage = require( 'wdio-mediawiki/LoginPage' );
|
const LoginPage = require( 'wdio-mediawiki/LoginPage' );
|
||||||
const Util = require( 'wdio-mediawiki/Util' );
|
const Util = require( 'wdio-mediawiki/Util' );
|
||||||
|
|
||||||
describe( 'Content Editable', function () {
|
describe( 'Content Editable', () => {
|
||||||
|
|
||||||
let name, content;
|
let name, content;
|
||||||
|
|
||||||
beforeEach( async function () {
|
beforeEach( async () => {
|
||||||
content = Util.getTestString();
|
content = Util.getTestString();
|
||||||
name = Util.getTestString();
|
name = Util.getTestString();
|
||||||
await LoginPage.loginAdmin();
|
await LoginPage.loginAdmin();
|
||||||
|
@ -17,24 +17,24 @@ describe( 'Content Editable', function () {
|
||||||
await EditPage.toolbar.waitForDisplayed( { timeout: 20000 } );
|
await EditPage.toolbar.waitForDisplayed( { timeout: 20000 } );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
afterEach( async function () {
|
afterEach( async () => {
|
||||||
// T269566: Popup with text
|
// T269566: Popup with text
|
||||||
// 'Leave site? Changes that you made may not be saved. Cancel/Leave'
|
// 'Leave site? Changes that you made may not be saved. Cancel/Leave'
|
||||||
// appears after the browser tries to leave the page with the preview.
|
// appears after the browser tries to leave the page with the preview.
|
||||||
await browser.reloadSession();
|
await browser.reloadSession();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should load when an url is opened @daily', async function () {
|
it( 'should load when an url is opened @daily', async () => {
|
||||||
assert( await EditPage.toolbar.isDisplayed() );
|
assert( await EditPage.toolbar.isDisplayed() );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should be editable', async function () {
|
it( 'should be editable', async () => {
|
||||||
await EditPage.veRootNode.setValue( content );
|
await EditPage.veRootNode.setValue( content );
|
||||||
|
|
||||||
assert.equal( await EditPage.veRootNode.getText(), content );
|
assert.equal( await EditPage.veRootNode.getText(), content );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should save an edit', async function () {
|
it( 'should save an edit', async () => {
|
||||||
await EditPage.veRootNode.setValue( content );
|
await EditPage.veRootNode.setValue( content );
|
||||||
await EditPage.savePageDots.click();
|
await EditPage.savePageDots.click();
|
||||||
await EditPage.savePage.waitForClickable();
|
await EditPage.savePage.waitForClickable();
|
||||||
|
@ -44,7 +44,7 @@ describe( 'Content Editable', function () {
|
||||||
assert.strictEqual( await EditPage.notification.getText(), 'The page has been created.' );
|
assert.strictEqual( await EditPage.notification.getText(), 'The page has been created.' );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should insert a table', async function () {
|
it( 'should insert a table', async () => {
|
||||||
await EditPage.insertTable();
|
await EditPage.insertTable();
|
||||||
|
|
||||||
assert( await EditPage.insertedTable.isDisplayed() );
|
assert( await EditPage.insertedTable.isDisplayed() );
|
||||||
|
|
|
@ -3,71 +3,71 @@ const assert = require( 'assert' );
|
||||||
const EditPage = require( '../pageobjects/edit.page' );
|
const EditPage = require( '../pageobjects/edit.page' );
|
||||||
const Util = require( 'wdio-mediawiki/Util' );
|
const Util = require( 'wdio-mediawiki/Util' );
|
||||||
|
|
||||||
describe( 'Toolbar', function () {
|
describe( 'Toolbar', () => {
|
||||||
|
|
||||||
let name;
|
let name;
|
||||||
|
|
||||||
beforeEach( async function () {
|
beforeEach( async () => {
|
||||||
name = Util.getTestString();
|
name = Util.getTestString();
|
||||||
await EditPage.openForEditing( name );
|
await EditPage.openForEditing( name );
|
||||||
await EditPage.toolbar.waitForDisplayed( { timeout: 20000 } );
|
await EditPage.toolbar.waitForDisplayed( { timeout: 20000 } );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
afterEach( async function () {
|
afterEach( async () => {
|
||||||
// T269566: Popup with text
|
// T269566: Popup with text
|
||||||
// 'Leave site? Changes that you made may not be saved. Cancel/Leave'
|
// 'Leave site? Changes that you made may not be saved. Cancel/Leave'
|
||||||
// appears after the browser tries to leave the page with the preview.
|
// appears after the browser tries to leave the page with the preview.
|
||||||
await browser.reloadSession();
|
await browser.reloadSession();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should open notices popup as soon as it loads', async function () {
|
it( 'should open notices popup as soon as it loads', async () => {
|
||||||
assert( await EditPage.notices.isDisplayed() );
|
assert( await EditPage.notices.isDisplayed() );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should open switch editor', async function () {
|
it( 'should open switch editor', async () => {
|
||||||
await EditPage.switchEditorElement.click();
|
await EditPage.switchEditorElement.click();
|
||||||
|
|
||||||
assert( await EditPage.visualEditing.isDisplayed() );
|
assert( await EditPage.visualEditing.isDisplayed() );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should open page options', async function () {
|
it( 'should open page options', async () => {
|
||||||
await EditPage.pageOptionsElement.click();
|
await EditPage.pageOptionsElement.click();
|
||||||
|
|
||||||
assert( await EditPage.options.isDisplayed() );
|
assert( await EditPage.options.isDisplayed() );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should open help popup', async function () {
|
it( 'should open help popup', async () => {
|
||||||
await EditPage.helpElement.click();
|
await EditPage.helpElement.click();
|
||||||
|
|
||||||
assert( await EditPage.helpPopup.isDisplayed() );
|
assert( await EditPage.helpPopup.isDisplayed() );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it.skip( 'should open special characters menu', async function () {
|
it.skip( 'should open special characters menu', async () => {
|
||||||
await EditPage.specialCharacterElement.click();
|
await EditPage.specialCharacterElement.click();
|
||||||
await EditPage.specialCharacterMenu.waitForDisplayed( { timeout: 1000 } );
|
await EditPage.specialCharacterMenu.waitForDisplayed( { timeout: 1000 } );
|
||||||
|
|
||||||
assert( await EditPage.specialCharacterMenu.isDisplayed() );
|
assert( await EditPage.specialCharacterMenu.isDisplayed() );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should open insert menu', async function () {
|
it( 'should open insert menu', async () => {
|
||||||
await EditPage.insert.click();
|
await EditPage.insert.click();
|
||||||
|
|
||||||
assert( await EditPage.insertMenu.isDisplayed() );
|
assert( await EditPage.insertMenu.isDisplayed() );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should open structure options menu', async function () {
|
it( 'should open structure options menu', async () => {
|
||||||
await EditPage.structureOptionsElement.click();
|
await EditPage.structureOptionsElement.click();
|
||||||
|
|
||||||
assert( await EditPage.bulletListOption.isDisplayed() );
|
assert( await EditPage.bulletListOption.isDisplayed() );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should open style text options', async function () {
|
it( 'should open style text options', async () => {
|
||||||
await EditPage.styleTextElement.click();
|
await EditPage.styleTextElement.click();
|
||||||
|
|
||||||
assert( await EditPage.boldTextStyleOption.isDisplayed() );
|
assert( await EditPage.boldTextStyleOption.isDisplayed() );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should open format paragraph menu', async function () {
|
it( 'should open format paragraph menu', async () => {
|
||||||
await EditPage.formatParagraphElement.click();
|
await EditPage.formatParagraphElement.click();
|
||||||
|
|
||||||
assert( await EditPage.paragraphFormatMenu.isDisplayed() );
|
assert( await EditPage.paragraphFormatMenu.isDisplayed() );
|
||||||
|
|
Loading…
Reference in a new issue