From 545c6f1301b398b270bdc1cb14eb7b4493963b0c Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Tue, 12 Nov 2019 13:49:58 +0000 Subject: [PATCH] Add missing FragmentInspector tests to MW Requires unregistering MWLinkAnnotationInspector Bonus: Remove unnecessary list of unregsiters as teardownOverrides is run on init. Change-Id: I3e36ab7736cc8479ab53f40d2eb24c0fa15d3dc0 --- extension.json | 1 + modules/ve-mw/tests/ve.test.utils.js | 16 ++++++---------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/extension.json b/extension.json index 53cb9cb1f7..01147a991e 100644 --- a/extension.json +++ b/extension.json @@ -2651,6 +2651,7 @@ "modules/ve-mw/tests/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.test.js", "modules/ve-mw/tests/ui/datatransferhandlers/ve.ui.UrlStringTransferHandler.test.js", "modules/ve-mw/tests/init/targets/ve.init.mw.DesktopArticleTarget.test.js", + "lib/ve/tests/ui/inspectors/ve.ui.FragmentInspector.test.js", "lib/ve/tests/ce/ve.ce.TestRunner.js", "lib/ve/tests/ce/ve.ce.imetests.test.js", "lib/ve/tests/ce/imetests/backspace-chromium-ubuntu-none.js", diff --git a/modules/ve-mw/tests/ve.test.utils.js b/modules/ve-mw/tests/ve.test.utils.js index 2b093e90bd..5b96494c02 100644 --- a/modules/ve-mw/tests/ve.test.utils.js +++ b/modules/ve-mw/tests/ve.test.utils.js @@ -51,16 +51,6 @@ }; ve.test.utils.MWDummyPlatform = MWDummyPlatform; - // Unregister MW override nodes. - // They are temporarily registered in setup/teardown. - ve.dm.modelRegistry.unregister( ve.dm.MWHeadingNode ); - ve.dm.modelRegistry.unregister( ve.dm.MWPreformattedNode ); - ve.dm.modelRegistry.unregister( ve.dm.MWTableNode ); - ve.dm.modelRegistry.unregister( ve.dm.MWExternalLinkAnnotation ); - // Re-register unregistered nodes. - ve.dm.modelRegistry.register( ve.dm.InlineImageNode ); - ve.dm.modelRegistry.register( ve.dm.BlockImageNode ); - ve.test.utils.mwEnvironment = ( function () { var mwPlatform, corePlatform, mwTarget, coreTarget, setEditorPreference = mw.libs.ve.setEditorPreference, @@ -94,6 +84,9 @@ for ( i = 0; i < overridden.length; i++ ) { ve.dm.modelRegistry.unregister( overridden[ i ] ); } + ve.ui.windowFactory.unregister( ve.ui.LinkAnnotationInspector ); + ve.ui.windowFactory.register( ve.ui.MWLinkAnnotationInspector ); + ve.init.platform = mwPlatform; ve.init.target = mwTarget; mw.libs.ve.setEditorPreference = dummySetEditorPreference; @@ -110,6 +103,9 @@ for ( i = 0; i < overridden.length; i++ ) { ve.dm.modelRegistry.register( overridden[ i ] ); } + ve.ui.windowFactory.unregister( ve.ui.MWLinkAnnotationInspector ); + ve.ui.windowFactory.register( ve.ui.LinkAnnotationInspector ); + ve.init.platform = corePlatform; ve.init.target = coreTarget; mw.libs.ve.setEditorPreference = setEditorPreference;