Desktop should use AMC mode

To help us test special pages prior to moving them on mobile it
would be useful to make AMC the default on desktop
where the special page override does not exist

This is also probably what editors on desktop using the Minerva
skin want out of the skin.

On top of this, add an amc class to the body tag so we can
target styles at AMC and/or non-AMC users

Change-Id: I7f3141bae71181131ae4878fd21fb6ff4322c8ca
This commit is contained in:
jdlrobson 2019-03-29 14:31:09 -07:00 committed by Jdlrobson
parent a3e524192d
commit 0be05950af
2 changed files with 10 additions and 1 deletions

View File

@ -95,7 +95,8 @@ class SkinMinerva extends SkinTemplate {
/** @var array skin specific options */
protected $skinOptions = [
self::OPTION_AMC => false,
// Defaults to true for desktop mode.
self::OPTION_AMC => true,
self::OPTIONS_MOBILE_BETA => false,
/**
* Whether the main menu should include a link to
@ -1445,6 +1446,11 @@ class SkinMinerva extends SkinTemplate {
*/
public function addToBodyAttributes( $out, &$bodyAttrs ) {
$classes = $out->getProperty( 'bodyClassName' );
if ( $this->getSkinOption( self::OPTION_AMC ) ) {
$classes .= ' minerva--amc-enabled';
} else {
$classes .= ' minerva--amc-disabled';
}
$bodyAttrs[ 'class' ] .= ' ' . $classes;
}

View File

@ -173,6 +173,9 @@ class SkinMinervaTest extends MediaWikiTestCase {
$moduleName, $expected
) {
$skin = new SkinMinerva();
$skin->setSkinOptions( [
SkinMinerva::OPTION_AMC => false,
] );
$title = Title::newFromText( 'Test' );
$testContext = RequestContext::getMain();
$testContext->setTitle( $title );