mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-12-05 02:59:00 +00:00
5263b09397
* Adds button hover/focus states to all Minerva button icons * Removes the deprecated mw-ui-icon-before selector Depends-On: I4eb28eae4c4e23d58f1f85bc41c0caf77197d8a1 Bug: T288678 Change-Id: I490534f9f704a733191b459c8ee071848c436001
58 lines
1.4 KiB
PHP
58 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Tests\MediaWiki\Minerva\Menu\Entries;
|
|
|
|
use MediaWiki\Minerva\Menu\Entries\HomeMenuEntry;
|
|
|
|
/**
|
|
* @group MinervaNeue
|
|
* @coversDefaultClass \MediaWiki\Minerva\Menu\Entries\HomeMenuEntry
|
|
*/
|
|
class HomeMenuEntryTest extends \MediaWikiUnitTestCase {
|
|
|
|
/**
|
|
* @covers ::__construct
|
|
* @covers ::getName
|
|
* @covers ::getCSSClasses
|
|
* @covers ::getComponents
|
|
*/
|
|
public function testConstruct() {
|
|
$name = 'foo';
|
|
$text = 'bar';
|
|
$url = 'http://baz';
|
|
$entry = new HomeMenuEntry( $name, $text, $url );
|
|
$this->assertSame( $name, $entry->getName() );
|
|
$this->assertSame( [], $entry->getCSSClasses() );
|
|
$this->assertSame( [ [
|
|
'text' => $text,
|
|
'href' => $url,
|
|
'icon' => 'minerva-foo',
|
|
'data-event-name' => 'menu.foo'
|
|
] ], $entry->getComponents() );
|
|
}
|
|
|
|
/**
|
|
* @covers ::overrideCssClass
|
|
* @covers ::overrideText
|
|
* @covers ::getComponents
|
|
*/
|
|
public function testOverride() {
|
|
$entry = new HomeMenuEntry( 'foo', 'bar', 'http://baz' );
|
|
$component = current( $entry->getComponents() );
|
|
$this->assertSame( 'bar', $component['text'] );
|
|
$this->assertSame(
|
|
'minerva-foo',
|
|
$component['icon']
|
|
);
|
|
$entry->overrideText( 'blah' )
|
|
->overrideCssClass( 'classy' );
|
|
$component = current( $entry->getComponents() );
|
|
$this->assertSame( 'blah', $component['text'] );
|
|
$this->assertSame(
|
|
'classy',
|
|
$component['class']
|
|
);
|
|
}
|
|
|
|
}
|