mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-27 07:40:48 +00:00
229d6cdf3b
New changes: d61440346 Add logging to the rebase server and client d1d2539ae rebaser: Add script to convert a log file to a test case 0896d5f05 lib: Update README files for OOjs and OOjs UI 045ae87fb Localisation updates from https://translatewiki.net. 04b276e16 VisualDiff: Make annotation whitespace trimming configurable dd04912e5 Localisation updates from https://translatewiki.net. 11fc30709 MobileContext: fix button spacing 7898acd0b Fix typos and minor lint issues 4e3e2deb9 Avoid using the global namespace in test files 1ed81efa1 build: Update eslint to 0.4.0 and make a pass Bug: T163473 Bug: T164166 Change-Id: I4bab4260d6b05ff0277cacd167186336acc02080
41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
/*!
|
|
* VisualEditor UserInterface UrlStringTransferHandler tests.
|
|
*
|
|
* @copyright 2011-2017 VisualEditor Team and others; see http://ve.mit-license.org
|
|
*/
|
|
|
|
QUnit.module( 've.ui.UrlStringTransferHandler (MW)' );
|
|
|
|
/* Tests */
|
|
|
|
QUnit.test( 'paste', function ( assert ) {
|
|
var i,
|
|
cases = [
|
|
{
|
|
msg: 'External link converts to internal link',
|
|
pasteString: location.origin + mw.Title.newFromText( 'Main Page' ).getUrl(),
|
|
pasteType: 'text/plain',
|
|
expectedData: function () {
|
|
// Explicitly create an internal link so we can assert this behaviour is working
|
|
// eslint-disable-next-line new-cap
|
|
var a = ve.dm.MWInternalLinkAnnotation.static.newFromTitle( new mw.Title.newFromText( 'Main Page' ) ).element;
|
|
return [
|
|
[ 'M', [ a ] ],
|
|
[ 'a', [ a ] ],
|
|
[ 'i', [ a ] ],
|
|
[ 'n', [ a ] ],
|
|
[ ' ', [ a ] ],
|
|
[ 'P', [ a ] ],
|
|
[ 'a', [ a ] ],
|
|
[ 'g', [ a ] ],
|
|
[ 'e', [ a ] ]
|
|
];
|
|
}
|
|
}
|
|
];
|
|
|
|
for ( i = 0; i < cases.length; i++ ) {
|
|
ve.test.utils.runUrlStringHandlerTest( assert, cases[ i ].pasteString, cases[ i ].pasteHtml, cases[ i ].pasteType, cases[ i ].expectedData, cases[ i ].msg );
|
|
}
|
|
} );
|