jenkins-bot has submitted this change and it was merged.

Change subject: Update VE core submodule to master (90cbd62)
......................................................................


Update VE core submodule to master (90cbd62)

New changes:
abf8f41 Replace Array#concat with Array#push in converter
02aeb90 Localisation updates from https://translatewiki.net.
902ddda Use safer batchPush in converter
6368191 Use current surface's sequence registry in command help dialog
f7ce4b9 Optimize batchPush on small lists
fb43a0a ve.batchPush: add unit test to exercise long-array path
d6c7d24 Factor out RESTBase ID regular expression
ffcbf4b IndentationCommand: Use hasMatchingAncestor
d447023 Allow ommission of range from ve.dm.Document cloneFromRange
cfbc344 Don't strip empty paragraphs on paste if they are generated
01c918b Localisation updates from https://translatewiki.net.
1467947 Fix documentation of getMetadataIdRegExp

Local changes:
* Define RESTBase ID pattern in platform and fix slightly
* Bring in paste test from core, which requires platform switching.

Bug: T147607
Depends-On: Ifc1c15872a50f915e5ef8d561b3a363dc5f4d28f
Change-Id: I3eb21e115de92a67afa85b5675fcbca5b111adb6
---
M lib/ve
M modules/ve-mw/init/ve.init.mw.Platform.js
M modules/ve-mw/tests/ce/ve.ce.Surface.test.js
M modules/ve-mw/tests/ve.test.utils.js
4 files changed, 61 insertions(+), 2 deletions(-)

Approvals:
  Jforrester: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/ve b/lib/ve
index 89ce43b..90cbd62 160000
--- a/lib/ve
+++ b/lib/ve
@@ -1 +1 @@
-Subproject commit 89ce43b137d6f02c3341815e143bf3ae3d68c440
+Subproject commit 90cbd62c7e9f2dbc5df457f894ec243a39b8595e
diff --git a/modules/ve-mw/init/ve.init.mw.Platform.js 
b/modules/ve-mw/init/ve.init.mw.Platform.js
index c293dd1..97c157a 100644
--- a/modules/ve-mw/init/ve.init.mw.Platform.js
+++ b/modules/ve-mw/init/ve.init.mw.Platform.js
@@ -47,6 +47,17 @@
        return this.unanchoredExternalLinkUrlProtocolsRegExp;
 };
 
+/**
+ * Regular expression matching RESTBase IDs
+ *
+ * This isn't perfect, see T147607
+ *
+ * @inheritdoc
+ */
+ve.init.mw.Platform.prototype.getMetadataIdRegExp = function () {
+       return /^mw[a-zA-Z0-9\-_]{2,6}$/;
+};
+
 /** @inheritdoc */
 ve.init.mw.Platform.prototype.addMessages = function ( messages ) {
        return mw.messages.set( messages );
diff --git a/modules/ve-mw/tests/ce/ve.ce.Surface.test.js 
b/modules/ve-mw/tests/ce/ve.ce.Surface.test.js
index de2704d..28ae61f 100644
--- a/modules/ve-mw/tests/ce/ve.ce.Surface.test.js
+++ b/modules/ve-mw/tests/ce/ve.ce.Surface.test.js
@@ -62,3 +62,41 @@
                );
        }
 } );
+
+QUnit.test( 'beforePaste/afterPaste', function ( assert ) {
+       var i, expected = 0,
+               cases = [
+                       {
+                               documentHtml: '<p></p>',
+                               rangeOrSelection: new ve.Range( 1 ),
+                               pasteHtml: '<span typeof="mw:Entity" 
id="mwAB">-</span><span typeof="mw:Entity" id="mw-reference-cite">-</span>',
+                               fromVe: true,
+                               expectedRangeOrSelection: new ve.Range( 5 ),
+                               expectedHtml: '<p><span 
typeof="mw:Entity">-</span><span typeof="mw:Entity" 
id="mw-reference-cite">-</span></p>',
+                               msg: 'RESTBase IDs stripped'
+                       }
+               ];
+
+       for ( i = 0; i < cases.length; i++ ) {
+               if ( cases[ i ].expectedOps ) {
+                       expected++;
+               }
+               if ( cases[ i ].expectedRangeOrSelection ) {
+                       expected++;
+               }
+               if ( cases[ i ].expectedHtml ) {
+                       expected++;
+               }
+       }
+       QUnit.expect( expected );
+
+       for ( i = 0; i < cases.length; i++ ) {
+               ve.test.utils.runSurfacePasteTest(
+                       assert, cases[ i ].documentHtml,
+                       cases[ i ].pasteHtml, cases[ i 
].internalSourceRangeOrSelection, cases[ i ].fromVe, cases[ i 
].useClipboardData,
+                       cases[ i ].pasteTargetHtml, cases[ i 
].rangeOrSelection, cases[ i ].pasteSpecial,
+                       cases[ i ].expectedOps, cases[ i 
].expectedRangeOrSelection, cases[ i ].expectedHtml,
+                       cases[ i ].store, false, cases[ i ].msg
+               );
+       }
+} );
diff --git a/modules/ve-mw/tests/ve.test.utils.js 
b/modules/ve-mw/tests/ve.test.utils.js
index 6b9c27a..dad625b 100644
--- a/modules/ve-mw/tests/ve.test.utils.js
+++ b/modules/ve-mw/tests/ve.test.utils.js
@@ -36,7 +36,8 @@
 ve.dm.modelRegistry.register( ve.dm.BlockImageNode );
 
 ve.test.utils.mwEnvironment = ( function () {
-       var overrides = [
+       var mwPlatform, corePlatform,
+               overrides = [
                        ve.dm.MWHeadingNode,
                        ve.dm.MWPreformattedNode,
                        ve.dm.MWTableNode,
@@ -47,6 +48,13 @@
                        ve.dm.BlockImageNode
                ];
 
+       corePlatform = ve.init.platform;
+       mwPlatform = new ve.init.mw.Platform();
+       // Disable some API requests from platform
+       mwPlatform.imageInfoCache = null;
+       // Unregister mwPlatform
+       ve.init.platform = corePlatform;
+
        function setupOverrides() {
                var i;
                for ( i = 0; i < overrides.length; i++ ) {
@@ -55,6 +63,7 @@
                for ( i = 0; i < overridden.length; i++ ) {
                        ve.dm.modelRegistry.unregister( overridden[ i ] );
                }
+               ve.init.platform = mwPlatform;
        }
 
        function teardownOverrides() {
@@ -65,6 +74,7 @@
                for ( i = 0; i < overridden.length; i++ ) {
                        ve.dm.modelRegistry.register( overridden[ i ] );
                }
+               ve.init.platform = corePlatform;
        }
 
        // On load, teardown overrides so the first core tests run correctly

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3eb21e115de92a67afa85b5675fcbca5b111adb6
Gerrit-PatchSet: 9
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <esand...@wikimedia.org>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to