mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-17 19:21:39 +00:00
dcdee45861
Drop the checks for number of assertions Bug: T174598 Change-Id: I82728a389d733900144786c149239856562a8c46
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', 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]', 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', 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 ) );
|