From ee47c3d0bbacc2d99f137cfe939b411eb6663802 Mon Sep 17 00:00:00 2001 From: lmora Date: Wed, 6 Nov 2024 17:34:58 -0600 Subject: [PATCH] Create new skins.minerva.styles module This merges the existing modules skins.minerva.base.styles and skins.minerva.mainMenu.styles into a new module skins.minerva.styles which is named consistently with Vector's style module. The old modules will be kept for caching reasons for at least one, and possibly two deploy cycles, after which we will continue this task. Additional change: * drop .minerva-icon--{name}-base20 and .minerva-icon--{name}-disabled variants since these are no longer utilized and only serve cached HTML Bug: T266361 Change-Id: Iccf415a22e9535603befae25b8cea467f9905437 --- bundlesize.config.json | 2 +- skin.json | 25 +++++++++++++++++++++---- tests/phpunit/skins/SkinMinervaTest.php | 17 +++++++++++++++++ 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/bundlesize.config.json b/bundlesize.config.json index cc6675a8d..6e1284e87 100644 --- a/bundlesize.config.json +++ b/bundlesize.config.json @@ -21,7 +21,7 @@ }, { "resourceModule": "skins.minerva.mainMenu.styles", - "maxSize": "1.0KB" + "maxSize": "1.1KB" }, { "resourceModule": "skins.minerva.scripts", diff --git a/skin.json b/skin.json index 1cf4aefdc..cb279f589 100644 --- a/skin.json +++ b/skin.json @@ -141,13 +141,12 @@ "skins.minerva.scripts" ], "styles": [ - "skins.minerva.base.styles", + "skins.minerva.styles", "skins.minerva.content.styles.images", "mediawiki.hlist", "skins.minerva.codex.styles", "skins.minerva.icons.wikimedia", - "skins.minerva.mainMenu.icons", - "skins.minerva.mainMenu.styles" + "skins.minerva.mainMenu.icons" ], "messages": [ "variants", @@ -323,7 +322,24 @@ } }, "ResourceModules": { + "skins.minerva.styles": { + "class": "MediaWiki\\ResourceLoader\\SkinModule", + "features": [ + "normalize", + "accessibility", + "i18n-ordered-lists", + "content-body", + "content-tables", + "interface-core" + ], + "styles": [ + "resources/skins.minerva.base.styles/CSSCustomProperties.less", + "resources/skins.minerva.base.styles/skin.less", + "resources/skins.minerva.mainMenu.styles/index.less" + ] + }, "skins.minerva.base.styles": { + "deprecated": "Retained for caching reasons. Please use skins.minerva.styles instead.", "class": "MediaWiki\\ResourceLoader\\SkinModule", "features": [ "normalize", @@ -397,7 +413,7 @@ ] }, "skins.minerva.icons.wikimedia": { - "selectorWithoutVariant": ".minerva-icon--{name}-base20, .minerva-icon--{name}-disabled, .minerva-icon--{name}", + "selectorWithoutVariant": ".minerva-icon--{name}", "useDataURI": false, "defaultColor": "#54595d", "class": "MediaWiki\\ResourceLoader\\OOUIIconPackModule", @@ -473,6 +489,7 @@ ] }, "skins.minerva.mainMenu.styles": { + "deprecated": "Retained for caching reasons. Please use skins.minerva.styles instead.", "styles": [ "resources/skins.minerva.mainMenu.styles/index.less" ] diff --git a/tests/phpunit/skins/SkinMinervaTest.php b/tests/phpunit/skins/SkinMinervaTest.php index accb158e8..86daf99f0 100644 --- a/tests/phpunit/skins/SkinMinervaTest.php +++ b/tests/phpunit/skins/SkinMinervaTest.php @@ -99,6 +99,23 @@ class SkinMinervaTest extends MediaWikiIntegrationTestCase { ]; } + /** + * @covers ::getDefaultModules + */ + public function testGetDefaultModules() { + $context = new RequestContext(); + $context->setTitle( Title::makeTitle( 0, 'Hello' ) ); + $context->setActionName( 'view' ); + + $skinFactory = $this->getServiceContainer()->getSkinFactory(); + $skin = $skinFactory->makeSkin( 'minerva' ); + + $skin->setContext( $context ); + + $this->assertContains( 'skins.minerva.styles', $skin->getDefaultModules()['styles']['skin'], + 'Check entry point' ); + } + /** * @dataProvider provideHasPageTabs * @covers ::hasPageTabs