mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-30 00:45:03 +00:00
c5f38e466d
Changes: - added support of event-data-name to toggle list and all menu entries - track main menu open actions - prefix all menu interactions with `menu.` - prefix menu opening with `ui.` - track tab clicks (also a part of new ui) - track notification icon clicks We're not tracking the Download icon as it has it's own instrumentation. Bug: T220016 Change-Id: I442103c1f8967c6710429329f024f266c9b11ea6
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,
|
|
'class' => 'mw-ui-icon mw-ui-icon-before mw-ui-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(
|
|
'mw-ui-icon mw-ui-icon-before mw-ui-icon-minerva-foo',
|
|
$component['class']
|
|
);
|
|
$entry->overrideText( 'blah' )
|
|
->overrideCssClass( 'classy' );
|
|
$component = current( $entry->getComponents() );
|
|
$this->assertSame( 'blah', $component['text'] );
|
|
$this->assertSame(
|
|
'classy',
|
|
$component['class']
|
|
);
|
|
}
|
|
|
|
}
|