mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-25 06:36:32 +00:00
d342cb32ef
Use the Button.mustache partial in the PageActionsMenu.mustache template. This converts the page actions menu to use the Button template in a way that doesn't change the existing HTML. The mw-ui-icon-element and mw-ui-icon-with-label-desktop classes are placed onto the Button.mustache markup. Bug: T342908 Change-Id: Ib5dadd929eea2e72a24e061c4174348615890617
41 lines
1.6 KiB
JavaScript
41 lines
1.6 KiB
JavaScript
/* eslint-disable no-jquery/no-class-state */
|
|
( function () {
|
|
var watchstar = require( '../../../resources/skins.minerva.scripts/watchstar.js' ),
|
|
toggleClasses = watchstar.test.toggleClasses,
|
|
WATCHED_CLASS = watchstar.test.WATCHED_ICON_CLASS,
|
|
TEMP_WATCHED_CLASS = watchstar.test.TEMP_WATCHED_ICON_CLASS,
|
|
UNWATCHED_CLASS = watchstar.test.UNWATCHED_ICON_CLASS;
|
|
|
|
QUnit.module( 'Minerva Watchstar' );
|
|
|
|
function createElemWithClass( cssClass, iconClass ) {
|
|
const $icon = $( '<span>' ).addClass( `minerva-icon ${iconClass}` );
|
|
return $( '<div/>' ).addClass( cssClass ).append( $icon );
|
|
}
|
|
|
|
QUnit.test( 'toggleClasses() from watched to unwatched', function ( assert ) {
|
|
var $elem = createElemWithClass( WATCHED_CLASS );
|
|
toggleClasses( $elem, false );
|
|
assert.true( $elem.find( '.minerva-icon' ).hasClass( UNWATCHED_CLASS ) );
|
|
} );
|
|
|
|
QUnit.test( 'toggleClasses() from unwatched to watched', function ( assert ) {
|
|
var $elem = createElemWithClass( UNWATCHED_CLASS );
|
|
toggleClasses( $elem, true, null );
|
|
assert.true( $elem.find( '.minerva-icon' ).hasClass( WATCHED_CLASS ) );
|
|
} );
|
|
|
|
QUnit.test( 'toggleClasses() from unwatched to temp watched', function ( assert ) {
|
|
var $elem = createElemWithClass( UNWATCHED_CLASS );
|
|
toggleClasses( $elem, true, 'expiry' );
|
|
assert.true( $elem.find( '.minerva-icon' ).hasClass( TEMP_WATCHED_CLASS ) );
|
|
} );
|
|
|
|
QUnit.test( 'toggleClasses() from temp watched to watched', function ( assert ) {
|
|
var $elem = createElemWithClass( TEMP_WATCHED_CLASS );
|
|
toggleClasses( $elem, true, null );
|
|
assert.true( $elem.find( '.minerva-icon' ).hasClass( WATCHED_CLASS ) );
|
|
} );
|
|
|
|
}() );
|