mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-16 10:50:52 +00:00
2cc9516cde
This is programmatic output from python3 scripts/migrate.py This will result in a Minerva skin dependent on MobileFrontend. Post merge we will rename message keys to have minerva- prefix Bug: T166748 Change-Id: Iff1f7e63e796cc5d4a6d2ab0370e0c33248d2fce
53 lines
1.8 KiB
JavaScript
53 lines
1.8 KiB
JavaScript
( function ( M ) {
|
|
var OverlayManager = M.require( 'mobile.startup/OverlayManager' ),
|
|
NotificationBadge = M.require( 'skins.minerva.notifications/NotificationBadge' );
|
|
|
|
QUnit.module( 'Minerva NotificationBadge', {
|
|
setup: function () {
|
|
this.router = require( 'mediawiki.router' );
|
|
this.OverlayManager = new OverlayManager( this.router );
|
|
}
|
|
} );
|
|
|
|
QUnit.test( '#setCount', 2, function ( assert ) {
|
|
var initialClassExpectationsMet,
|
|
badge = new NotificationBadge( {
|
|
overlayManager: this.OverlayManager,
|
|
hasNotifications: true,
|
|
hasUnseenNotifications: true,
|
|
notificationCount: 5
|
|
} );
|
|
initialClassExpectationsMet = badge.$el.find( '.mw-ui-icon' ).length === 0 &&
|
|
badge.$el.find( '.zero' ).length === 0;
|
|
|
|
badge.setCount( 0 );
|
|
assert.ok( initialClassExpectationsMet, 'No icon and no zero class' );
|
|
assert.ok( badge.$el.find( '.zero' ).length === 1, 'A zero class is present on the badge' );
|
|
} );
|
|
|
|
QUnit.test( '#render [hasUnseenNotifications]', 1, function ( assert ) {
|
|
var badge = new NotificationBadge( {
|
|
notificationCount: 0,
|
|
overlayManager: this.OverlayManager,
|
|
hasNotifications: false,
|
|
hasUnseenNotifications: false
|
|
} );
|
|
assert.ok( badge.$el.find( '.mw-ui-icon' ).length === 1, 'A bell icon is visible' );
|
|
} );
|
|
|
|
QUnit.test( '#markAsSeen', 2, function ( assert ) {
|
|
var badge = new NotificationBadge( {
|
|
notificationCount: 2,
|
|
overlayManager: this.OverlayManager,
|
|
hasNotifications: true,
|
|
hasUnseenNotifications: true
|
|
} );
|
|
// Badge resets counter to zero
|
|
badge.setCount( 0 );
|
|
assert.ok( badge.$el.find( '.mw-ui-icon' ).length === 0, 'The bell icon is not visible' );
|
|
badge.markAsSeen();
|
|
assert.ok( badge.$el.find( '.notification-unseen' ).length === 0,
|
|
'Unseen class disappears after markAsSeen called.' );
|
|
} );
|
|
}( mw.mobileFrontend ) );
|