Cscott has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/231162

Change subject: WIP: add more test cases for 'detect paste of wikitext'
......................................................................

WIP: add more test cases for 'detect paste of wikitext'

Change-Id: Ibf1dba30c54d69b142de8b748f39eb4d899ffd17
---
M 
modules/ve-mw/tests/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.test.js
1 file changed, 86 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/62/231162/1

diff --git 
a/modules/ve-mw/tests/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.test.js
 
b/modules/ve-mw/tests/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.test.js
index 6e882a0..a149188 100644
--- 
a/modules/ve-mw/tests/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.test.js
+++ 
b/modules/ve-mw/tests/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.test.js
@@ -121,3 +121,89 @@
                { type: '/internalList' }
        ] );
 } );
+
+QUnit.test( 'magic link (RFC)', 1, function ( assert ) {
+       var a = {
+               type: 'link/mwInternal',
+               attributes: {
+                       hrefPrefix: './',
+                       lookupTitle: 'Foo',
+                       normalizedTitle: 'Foo',
+                       origTitle: 'Foo',
+                       title: 'Foo'
+               }
+       };
+       runHandlerTest( assert, this.server, 'RFC 1234', 'text/plain',
+               '<body data-parsoid=\'{"dsr":[0,7,0,0]}\' lang="en" 
class="mw-content-ltr sitedir-ltr ltr mw-body mw-body-content mediawiki" 
dir="ltr"><p data-parsoid=\'{"dsr":[0,7,0,0]}\'><a rel="mw:WikiLink" 
href="./Foo" title="Foo" 
data-parsoid=\'{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"Foo"},"dsr":[0,7,2,2]}\'>Foo</a></p></body>',
 [
+               [ 'R', [ a ] ],
+               [ 'F', [ a ] ],
+               [ 'C', [ a ] ],
+               [ ' ', [ a ] ],
+               [ '1', [ a ] ],
+               [ '2', [ a ] ],
+               [ '3', [ a ] ],
+               [ '4', [ a ] ],
+               { type: 'internalList' },
+               { type: '/internalList' }
+       ] );
+} );
+
+QUnit.test( 'magic link (PMID)', 1, function ( assert ) {
+       var a = {
+               type: 'link/mwInternal',
+               attributes: {
+                       hrefPrefix: './',
+                       lookupTitle: 'Foo',
+                       normalizedTitle: 'Foo',
+                       origTitle: 'Foo',
+                       title: 'Foo'
+               }
+       };
+       runHandlerTest( assert, this.server, 'PMID 1234', 'text/plain',
+               '<body data-parsoid=\'{"dsr":[0,7,0,0]}\' lang="en" 
class="mw-content-ltr sitedir-ltr ltr mw-body mw-body-content mediawiki" 
dir="ltr"><p data-parsoid=\'{"dsr":[0,7,0,0]}\'><a rel="mw:WikiLink" 
href="./Foo" title="Foo" 
data-parsoid=\'{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"Foo"},"dsr":[0,7,2,2]}\'>Foo</a></p></body>',
 [
+               [ 'P', [ a ] ],
+               [ 'M', [ a ] ],
+               [ 'I', [ a ] ],
+               [ 'D', [ a ] ],
+               [ ' ', [ a ] ],
+               [ '1', [ a ] ],
+               [ '2', [ a ] ],
+               [ '3', [ a ] ],
+               [ '4', [ a ] ],
+               { type: 'internalList' },
+               { type: '/internalList' }
+       ] );
+} );
+
+QUnit.test( 'magic link (ISBN)', 1, function ( assert ) {
+       var a = {
+               type: 'link/mwInternal',
+               attributes: {
+                       hrefPrefix: './',
+                       lookupTitle: 'Foo',
+                       normalizedTitle: 'Foo',
+                       origTitle: 'Foo',
+                       title: 'Foo'
+               }
+       };
+       runHandlerTest( assert, this.server, 'ISBN 123456789x', 'text/plain',
+               '<body data-parsoid=\'{"dsr":[0,7,0,0]}\' lang="en" 
class="mw-content-ltr sitedir-ltr ltr mw-body mw-body-content mediawiki" 
dir="ltr"><p data-parsoid=\'{"dsr":[0,7,0,0]}\'><a rel="mw:WikiLink" 
href="./Foo" title="Foo" 
data-parsoid=\'{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"Foo"},"dsr":[0,7,2,2]}\'>Foo</a></p></body>',
 [
+               [ 'I', [ a ] ],
+               [ 'S', [ a ] ],
+               [ 'B', [ a ] ],
+               [ 'N', [ a ] ],
+               [ ' ', [ a ] ],
+               [ '1', [ a ] ],
+               [ '2', [ a ] ],
+               [ '3', [ a ] ],
+               [ '4', [ a ] ],
+               [ '5', [ a ] ],
+               [ '6', [ a ] ],
+               [ '7', [ a ] ],
+               [ '8', [ a ] ],
+               [ '9', [ a ] ],
+               [ 'x', [ a ] ],
+               { type: 'internalList' },
+               { type: '/internalList' }
+       ] );
+} );

-- 
To view, visit https://gerrit.wikimedia.org/r/231162
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf1dba30c54d69b142de8b748f39eb4d899ffd17
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to