mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
92c38eab85
Move all MW-specific files into the ve-mw directory, in preparation for moving them out into a separate repo. All MW-specific files were moved into a parallel directory structure in modules/ve-mw . Files with both generic and MW-specific things were split up. Files in ve/init/mw/ were moved to ve-mw/init/ rather than ve-mw/init/mw ; they're still named ve.init.mw.* but we should change that. Some of the test files for core classes had MW-specific test cases, so those were split up and the test runner was duplicated; we should refactor our tests to use data providers so we can add cases more easily. Split files: * ve.ce.Node.css * ve.ce.ContentBranchNode.test.js (MWEntityNode) * ve.ce.Document.test.js (some core test cases genericized) * ve.dm.InternalList.test.js (uses mwReference test document) * ve.dm.SurfaceFragment.test.js, ve.ui.FormatAction.test.js ** Made core tests use heading instead of mwHeading ** Updated core tests because normal headings don't break out of lists ** Moved test runners into ve.test.utils.js * ve.ui.Icons-*.css * ve.ui.Dialog.css (MW parts into ve.ui.MWDialog.css) * ve.ui.Tool.css * ve.ui.Widget.css (move ve-ui-rtl and ve-ui-ltr to ve.ui.css) ve.dm.Converter.test.js: Moved runner functions into ve.test.utils.js ve.dm.example.js: * Refactored createExampleDocument so mwExample can use it * Removed wgExtensionAssetsPath detection, moved into mw-preload.js * Genericized withMeta example document (original version copied to mwExample) * Moved references example document to mwExample ve.dm.mwExample.js: * Move withMeta and references example documents from ve.dm.example.js * Add createExampleDocument function ve-mw/test/index.php: Runner for MW-specific tests only ve-mw/test/mw-preload.js: Sets VE_TESTDIR for Special:JavaScriptTest only ve.ui.Window.js: * Remove magic path interpolation in addLocalStyleSheets() * Pass full(er) paths to addLocalStyleSheets(), here and in subclasses ve.ui.MWDialog.js: Subclass of Dialog that adds MW versions of stylesheets ve.ui.MW*Dialog.js: * Subclass MWDialog rather than Dialog * Load both core and MW versions of stylesheets that have both ve.ui.PagedDialog.js: Converted to a mixin rather than an abstract base class * Don't inherit ve.ui.Dialog * Rather than overriding initialize(), provide initializePages() which the host class is supposed to call from its initialize() * Rename onOutlineSelect to onPageOutlineSelect ve.ui.MWMetaDialog.js, ve.ui.MWTransclusionDialog.js: * Use PagedDialog as a mixin rather than a base class, inherit MWDialog bullet-icon.png: Unused, deleted Stuff we should do later: * Refactor tests to use data providers * Write utility function for SVG compat check * Separate omnibus CSS files such as ve.ui.Widget.css * Separate omnibus RL modules * Use icon classes in ViewPageTarget Change-Id: I1b28f8ba7f2d2513e5c634927a854686fb9dd5a5
138 lines
4.6 KiB
JavaScript
138 lines
4.6 KiB
JavaScript
/*!
|
|
* VisualEditor MediaWiki Initialization ViewPageTarget tests.
|
|
*
|
|
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
QUnit.module( 've.init.mw.ViewPageTarget' );
|
|
|
|
QUnit.test( 'compatibility', function ( assert ) {
|
|
var i, profile, list, matches,
|
|
cases = [
|
|
{
|
|
'msg': 'Unidentified browser',
|
|
'userAgent': 'FooBar Browser Company Version 3.141',
|
|
'matches': []
|
|
},
|
|
{
|
|
'msg': 'IE7',
|
|
'userAgent': 'Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 6.0)',
|
|
'matches': [ 'blacklist' ]
|
|
},
|
|
{
|
|
'msg': 'IE8',
|
|
'userAgent': 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0)',
|
|
'matches': [ 'blacklist' ]
|
|
},
|
|
{
|
|
'msg': 'IE9',
|
|
'userAgent': 'Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)',
|
|
'matches': [ 'blacklist' ]
|
|
},
|
|
{
|
|
'msg': 'IE10',
|
|
'userAgent': 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)',
|
|
'matches': [ 'blacklist' ]
|
|
},
|
|
{
|
|
'msg': 'Firefox 10',
|
|
'userAgent': 'Mozilla/5.0 (X11; Mageia; Linux x86_64; rv:10.0.9) Gecko/20100101 Firefox/10.0.9',
|
|
'matches': [ 'blacklist' ]
|
|
},
|
|
{
|
|
'msg': 'Firefox 11',
|
|
'userAgent': 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20120421 Gecko Firefox/11.0',
|
|
'matches': [ 'whitelist' ]
|
|
},
|
|
{
|
|
'msg': 'Firefox 24',
|
|
'userAgent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0',
|
|
'matches': [ 'whitelist' ]
|
|
},
|
|
{
|
|
'msg': 'Iceweasel 9',
|
|
'userAgent': 'Mozilla/5.0 (X11; Linux x86_64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1 Iceweasel/9.0.1',
|
|
'matches': []
|
|
},
|
|
{
|
|
'msg': 'Iceweasel 10',
|
|
'userAgent': 'Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20100101 Firefox/10.0 Iceweasel/10.0',
|
|
'matches': [ 'whitelist' ]
|
|
},
|
|
{
|
|
'msg': 'Iceweasel 15',
|
|
'userAgent': 'Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1 Iceweasel/15.0.1',
|
|
'matches': [ 'whitelist' ]
|
|
},
|
|
{
|
|
'msg': 'Safari 4',
|
|
'userAgent': 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us) AppleWebKit/531.21.11 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10',
|
|
'matches': []
|
|
},
|
|
{
|
|
'msg': 'Safari 5',
|
|
'userAgent': 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us) AppleWebKit/534.1+ (KHTML, like Gecko) Version/5.0 Safari/533.16',
|
|
'matches': [ 'whitelist' ]
|
|
},
|
|
{
|
|
'msg': 'Safari 6',
|
|
'userAgent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 1084) AppleWebKit/536.30.1 (KHTML like Gecko) Version/6.0.5 Safari/536.30.1',
|
|
'matches': [ 'whitelist' ]
|
|
},
|
|
{
|
|
'msg': 'Chrome 18',
|
|
'userAgent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_5_8) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.151 Safari/535.19',
|
|
'matches': []
|
|
},
|
|
{
|
|
'msg': 'Chrome 19',
|
|
'userAgent': 'Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1061.0 Safari/536.3',
|
|
'matches': [ 'whitelist' ]
|
|
},
|
|
{
|
|
'msg': 'Chrome 27',
|
|
'userAgent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36',
|
|
'matches': [ 'whitelist' ]
|
|
},
|
|
{
|
|
'msg': 'Android 2.3',
|
|
'userAgent': 'Mozilla/5.0 (Linux; U; Android 2.3.5; en-us; HTC Vision Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1',
|
|
'matches': [ 'blacklist' ]
|
|
},
|
|
{
|
|
'msg': 'Android 3.0',
|
|
'userAgent': 'Mozilla/5.0 (Linux; U; Android 3.0; en-us; Xoom Build/HRI39) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13',
|
|
'matches': []
|
|
},
|
|
{
|
|
'msg': 'Android 4.0',
|
|
'userAgent': 'Mozilla/5.0 (Linux; U; Android 4.0.3; HTC Sensation Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30',
|
|
'matches': []
|
|
},
|
|
{
|
|
'msg': 'Opera',
|
|
'userAgent': 'Opera/12.80 (Windows NT 5.1; U; en) Presto/2.10.289 Version/12.02',
|
|
'matches': [ 'blacklist' ]
|
|
},
|
|
{
|
|
'msg': 'BlackBerry',
|
|
'userAgent': 'Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.1.0.346 Mobile Safari/534.11+',
|
|
'matches': [ 'blacklist' ]
|
|
}
|
|
];
|
|
|
|
QUnit.expect( cases.length );
|
|
for ( i = 0; i < cases.length; i++ ) {
|
|
profile = $.client.profile( { 'userAgent': cases[i].userAgent, 'platform': '' } );
|
|
matches = [];
|
|
for ( list in ve.init.mw.ViewPageTarget.compatibility ) {
|
|
if ( $.client.test( ve.init.mw.ViewPageTarget.compatibility[list], profile, true ) ) {
|
|
matches.push( list );
|
|
}
|
|
}
|
|
assert.deepEqual( matches, cases[i].matches,
|
|
cases[i].msg + ': ' + ( cases[i].matches.length ? cases[i].matches.join() : 'greylist (no matches)' ) );
|
|
}
|
|
} );
|