Merge "Revert "Follow-up I38eda4a: Add unit tests for lang/dir in target init""

This commit is contained in:
jenkins-bot 2018-09-03 22:56:52 +00:00 committed by Gerrit Code Review
commit 05dae065c9

View file

@ -7,89 +7,6 @@
QUnit.module( 've.init.mw.DesktopArticleTarget', ve.test.utils.mwEnvironment );
QUnit.test( 'init', function ( assert ) {
var
response = {
visualeditor: {
result: 'success',
notices: [],
checkboxesDef: {
wpMinoredit: {
id: 'wpMinoredit',
'label-message': 'minoredit',
tooltip: 'minoredit',
'label-id': 'mw-editpage-minoredit',
'legacy-name': 'minor',
'default': false
},
wpWatchthis: {
id: 'wpWatchthis',
'label-message': 'watchthis',
tooltip: 'watch',
'label-id': 'mw-editpage-watch',
'legacy-name': 'watch',
'default': true
}
},
checkboxesMessages: {
'accesskey-minoredit': 'i',
'tooltip-minoredit': 'Mark this as a minor edit',
minoredit: 'This is a minor edit',
'accesskey-watch': 'w',
'tooltip-watch': 'Add this page to your watchlist',
watchthis: 'Watch this page'
},
templates: '<div class="templatesUsed"></div>',
links: {
missing: [],
known: 1
},
protectedClasses: '',
basetimestamp: '20161119005107',
starttimestamp: '20180831122319',
oldid: 1804,
content: '<!DOCTYPE html>\n' +
'<html prefix="dc: http://purl.org/dc/terms/ mw: http://mediawiki.org/rdf/" about="http://localhost/MediaWiki/core/index.php/Special:Redirect/revision/1804">' +
'<head prefix="mwr: http://localhost/MediaWiki/core/index.php/Special:Redirect/"><meta property="mw:TimeUuid" content="a4fc0409-ad18-11e8-9b45-dd8cefbedb6d"/>' +
'<meta charset="utf-8"/>' +
'<meta property="mw:pageNamespace" content="0"/>' +
'<meta property="mw:pageId" content="643"/>' +
'<link rel="dc:replaces" resource="mwr:revision/0"/>' +
'<meta property="dc:modified" content="2016-11-19T00:51:07.000Z"/>' +
'<meta property="mw:revisionSHA1" content="da39a3ee5e6b4b0d3255bfef95601890afd80709"/>' +
'<meta property="mw:html:version" content="1.7.0"/>' +
'<link rel="dc:isVersionOf" href="http://localhost/MediaWiki/core/index.php/Empty"/>' +
'<title>Empty</title>' +
'<base href="http://localhost/MediaWiki/core/index.php/"/>' +
'<link rel="stylesheet" href="//localhost/MediaWiki/core/load.php?modules=mediawiki.legacy.commonPrint%2Cshared%7Cmediawiki.skinning.content.parsoid%7Cmediawiki.skinning.interface%7Cskins.vector.styles%7Csite.styles%7Cext.cite.style%7Cext.cite.styles%7Cmediawiki.page.gallery.styles&amp;only=styles&amp;skin=vector"/><!--[if lt IE 9]><script src="//localhost/MediaWiki/core/load.php?modules=html5shiv&amp;only=scripts&amp;skin=vector&amp;sync=1"></script><script>html5.addElements(\'figure-inline\');</script><![endif]-->' +
'</head>' +
'<body id="mwAA" lang="he" class="mw-content-rtl sitedir-rtl rtl mw-body-content parsoid-body mediawiki mw-parser-output" dir="rtl">' +
'<section data-mw-section-id="0" id="mwAQ"></section>' +
'</body>' +
'</html>',
etag: '"1804/a4fc0409-ad18-11e8-9b45-dd8cefbedb6d"',
switched: false,
fromEditedState: false
}
},
target = new ve.init.mw.DesktopArticleTarget(),
dataPromise = $.Deferred().resolve( response ).promise(),
done = assert.async();
target.on( 'surfaceReady', function () {
assert.strictEqual( target.getSurface().getModel().getDocument().getLang(), 'he', 'Page language is passed through from config' );
assert.strictEqual( target.getSurface().getModel().getDocument().getDir(), 'rtl', 'Page direction is passed through from config' );
target.destroy();
mw.config.get( 'wgVisualEditor' ).pageLanguageCode = 'en';
mw.config.get( 'wgVisualEditor' ).pageLanguageDir = 'ltr';
done();
} );
mw.config.get( 'wgVisualEditor' ).pageLanguageCode = 'he';
mw.config.get( 'wgVisualEditor' ).pageLanguageDir = 'rtl';
mw.config.get( 'wgVisualEditorConfig' ).showBetaWelcome = false;
target.activate( dataPromise );
} );
QUnit.test( 'compatibility', function ( assert ) {
var i, profile, matches, compatibility,
cases = [