jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/326841 )

Change subject: Feature flag "BackToTop"
......................................................................


Feature flag "BackToTop"

The flag is named "MinervaEnableBackToTop" and set to `true`
in beta.

Bug: T147944
Change-Id: I9349c4feba5ffb5e9a447f71c8d1a95fd69e9a8a
---
M extension.json
M includes/skins/SkinMinerva.php
R resources/skins.minerva.backtotop/init.js
M tests/phpunit/skins/SkinMinervaTest.php
4 files changed, 38 insertions(+), 14 deletions(-)

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



diff --git a/extension.json b/extension.json
index 77f43a2..e9c49ad 100644
--- a/extension.json
+++ b/extension.json
@@ -543,8 +543,7 @@
                                "mobile.toggle"
                        ],
                        "scripts": [
-                               
"resources/mobile.backtotop/BackToTopOverlay.js",
-                               "resources/mobile.backtotop/backtotop.js"
+                               "resources/mobile.backtotop/BackToTopOverlay.js"
                        ],
                        "styles": [
                                "resources/mobile.backtotop/backtotop.less"
@@ -1666,6 +1665,18 @@
                                
"resources/skins.minerva.fallbackeditor/fallbackeditor.less"
                        ]
                },
+               "skins.minerva.backtotop": {
+                       "targets": [
+                               "mobile",
+                               "desktop"
+                       ],
+                       "dependencies": [
+                               "mobile.backtotop"
+                       ],
+                       "scripts": [
+                               "resources/skins.minerva.backtotop/init.js"
+                       ]
+               },
                "skins.minerva.categories": {
                        "targets": [
                                "mobile",
@@ -2016,6 +2027,10 @@
                  "base": false,
                  "beta": true
                },
+               "MinervaEnableBackToTop": {
+                       "base": false,
+                       "beta": true
+               },
                "MFStripResponsiveImages": true,
                "MFResponsiveImageWhitelist": [
                        "image/svg+xml"
diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php
index 62a5148..8530c03 100644
--- a/includes/skins/SkinMinerva.php
+++ b/includes/skins/SkinMinerva.php
@@ -1287,6 +1287,10 @@
                        $modules[] = 'skins.minerva.fontchanger';
                }
 
+               if ( $this->mobileContext->getConfigVariable( 
'MinervaEnableBackToTop' ) ) {
+                       $modules[] = 'skins.minerva.backtotop';
+               }
+
                return $modules;
        }
 
diff --git a/resources/mobile.backtotop/backtotop.js 
b/resources/skins.minerva.backtotop/init.js
similarity index 100%
rename from resources/mobile.backtotop/backtotop.js
rename to resources/skins.minerva.backtotop/init.js
diff --git a/tests/phpunit/skins/SkinMinervaTest.php 
b/tests/phpunit/skins/SkinMinervaTest.php
index 4f9b3b4..ba7fe95 100644
--- a/tests/phpunit/skins/SkinMinervaTest.php
+++ b/tests/phpunit/skins/SkinMinervaTest.php
@@ -128,12 +128,15 @@
        /**
         * Test whether the font changer module is correctly added to the list 
context modules
         *
-        * @covers SkinMinerva::getContextSpecificModules
-        * @dataProvider provideFontChangerModule
-        * @param $wgMinervaEnableFontChanger
-        * @param $expected
+        * @covers       SkinMinerva::getContextSpecificModules
+        * @dataProvider provideGetContextSpecificModules
+        * @param string $configName Config name that needs to be set
+        * @param mixed $configValue Config value that is assigned to 
$configName
+        * @param string $moduleName Module name that is being tested
+        * @param bool $expected Whether the module is expected to be returned 
by the function being tested
         */
-       public function testFontChangerModule( $wgMinervaEnableFontChanger, 
$expected ) {
+       public function testGetContextSpecificModules( $configName, 
$configValue,
+                                                                               
                   $moduleName, $expected ) {
                $skin = TestingAccessWrapper::newFromObject(
                        $this->getMockBuilder( SkinMinerva::class )
                                ->disableOriginalConstructor()
@@ -147,21 +150,23 @@
                        ->method( 'getTitle' )
                        ->will( $this->returnValue( $title ) );
 
-               $this->setMwGlobals( 'wgMinervaEnableFontChanger', [
-                       'base' => $wgMinervaEnableFontChanger
+               $this->setMwGlobals( $configName, [
+                       'base' => $configValue
                ] );
 
                if ( $expected ) {
-                       $this->assertContains( 'skins.minerva.fontchanger', 
$skin->getContextSpecificModules() );
+                       $this->assertContains( $moduleName, 
$skin->getContextSpecificModules() );
                } else {
-                       $this->assertNotContains( 'skins.minerva.fontchanger', 
$skin->getContextSpecificModules() );
+                       $this->assertNotContains( $moduleName, 
$skin->getContextSpecificModules() );
                }
        }
 
-       public function provideFontChangerModule() {
+       public function provideGetContextSpecificModules() {
                return [
-                       [ true, true ],
-                       [ false, false ],
+                       [ 'wgMinervaEnableFontChanger', true, 
'skins.minerva.fontchanger', true ],
+                       [ 'wgMinervaEnableFontChanger', false, 
'skins.minerva.fontchanger', false ],
+                       [ 'wgMinervaEnableBackToTop', true, 
'skins.minerva.backtotop', true ],
+                       [ 'wgMinervaEnableBackToTop', false, 
'skins.minerva.backtotop', false ],
                ];
        }
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9349c4feba5ffb5e9a447f71c8d1a95fd69e9a8a
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Bmansurov <[email protected]>
Gerrit-Reviewer: Bmansurov <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to