mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-25 14:47:08 +00:00
9150aec131
Two new feature flags: 1) MinervaPersonalMenu 2) MinervaAdvancedMainMenu Changes: * AMC defaults to false on desktop - desktop doesn't have AMC mode it just enables several skin options. * WHen inserting a link at the bottom of the page check whether the talk at top of the page (tabs) is enabled.. not AMC * Update ServiceWiring to construct menu based on MinervaAdvancedMainMenu and MinervaPersonalMenu - note when former is enabled but not latter there is no way to logout. Noted in README. * Use one entry point for skins.minerva.amc.styles/index.less * Document files inside skins.minerva.amc.styles to make it clear which features they are associated with * Drop history page styles when AMC is disabled - it's not possible to ever get to these as the history page redirects in non-AMC mode * Rename the class .minerva--amc-enabled to minerva--history-page-action-enabled to reflect its real purpose and move styles from skins.minerva.base.styles to skins.minerva.amc.styles No need to worry about cached HTML as AMC runs without cache... * Remove isAnyAMCOptionEnabled - it's an antipattern and should be discouraged as it discourages the art of feature flagging. Nothing is using it after these changes. * The AMC_MODE flag is disabled. There is no need for this - AMC is not a feature and therefore not a skin option. It is a mechanism for turning on other skin options. Tests are updated. Testing: It should now be possible to enable any feature in `beta` and see it in the beta of the site. Bug: T229295 Change-Id: I48959905f5c09721b14a27aa1a5ad82849ac6263
71 lines
1.9 KiB
PHP
71 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace Tests\MediaWiki\Minerva;
|
|
|
|
use MediaWiki\Minerva\SkinOptions;
|
|
|
|
/**
|
|
* Class SkinMinervaTest
|
|
* @package Tests\MediaWiki\Minerva
|
|
* @group MinervaNeue
|
|
* @coversDefaultClass \MediaWiki\Minerva\SkinOptions
|
|
*/
|
|
class SkinOptionsTest extends \MediaWikiUnitTestCase {
|
|
|
|
/**
|
|
* @covers ::get
|
|
* @covers ::getAll
|
|
* @covers ::setMultiple
|
|
*/
|
|
public function testSettersAndGetters() {
|
|
$options = new SkinOptions();
|
|
$defaultValue = $options->get( SkinOptions::BETA_MODE );
|
|
$options->setMultiple( [ SkinOptions::BETA_MODE => !$defaultValue ] );
|
|
|
|
$allOptions = $options->getAll();
|
|
|
|
$this->assertEquals( !$defaultValue, $options->get( SkinOptions::BETA_MODE ) );
|
|
$this->assertArrayHasKey( SkinOptions::BETA_MODE, $allOptions );
|
|
$this->assertEquals( !$defaultValue, $allOptions[ SkinOptions::BETA_MODE ] );
|
|
}
|
|
|
|
/**
|
|
* @covers ::hasSkinOptions
|
|
*/
|
|
public function testHasSkinOptions() {
|
|
$options = new SkinOptions();
|
|
$this->assertTrue( $options->hasSkinOptions() );
|
|
$options->setMultiple( [ SkinOptions::BACK_TO_TOP => true ] );
|
|
$this->assertTrue( $options->hasSkinOptions() );
|
|
$options->setMultiple( [
|
|
SkinOptions::TALK_AT_TOP => false,
|
|
SkinOptions::HISTORY_IN_PAGE_ACTIONS => false,
|
|
SkinOptions::TOOLBAR_SUBMENU => false,
|
|
SkinOptions::BACK_TO_TOP => false,
|
|
SkinOptions::MAIN_MENU_EXPANDED => false,
|
|
SkinOptions::PERSONAL_MENU => false,
|
|
] );
|
|
$this->assertFalse( $options->hasSkinOptions() );
|
|
}
|
|
|
|
/**
|
|
* @covers ::get
|
|
* @expectedException \OutOfBoundsException
|
|
*/
|
|
public function testGettingUnknownKeyShouldThrowException() {
|
|
$options = new SkinOptions();
|
|
$options->get( 'non_existing_key' );
|
|
}
|
|
|
|
/**
|
|
* @covers ::get
|
|
* @expectedException \OutOfBoundsException
|
|
*/
|
|
public function testSettingUnknownKeyShouldThrowException() {
|
|
$options = new SkinOptions();
|
|
$options->setMultiple( [
|
|
'non_existing_key' => 1
|
|
] );
|
|
}
|
|
}
|