mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-11 17:00:10 +00:00
build: Update linters
Change-Id: I9747097fdf725992710f97d4ce4ea49fd611df1b
This commit is contained in:
parent
8fff5360d9
commit
2c089e075d
|
@ -10,6 +10,7 @@
|
||||||
"mediaWiki": false
|
"mediaWiki": false
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"dot-notation": [ "error", { "allowKeywords": true } ]
|
"dot-notation": [ "error", { "allowKeywords": true } ],
|
||||||
|
"max-len": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,7 +262,7 @@
|
||||||
var model;
|
var model;
|
||||||
|
|
||||||
for ( model in this.notificationModels ) {
|
for ( model in this.notificationModels ) {
|
||||||
if ( this.notificationModels.hasOwnProperty( model ) ) {
|
if ( Object.prototype.hasOwnProperty.call( this.notificationModels, model ) ) {
|
||||||
this.notificationModels[ model ].disconnect( this );
|
this.notificationModels[ model ].disconnect( this );
|
||||||
delete this.notificationModels[ model ];
|
delete this.notificationModels[ model ];
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
|
|
||||||
this.reset();
|
this.reset();
|
||||||
for ( source in sourceData ) {
|
for ( source in sourceData ) {
|
||||||
if ( sourceData.hasOwnProperty( source ) ) {
|
if ( Object.prototype.hasOwnProperty.call( sourceData, source ) ) {
|
||||||
this.setSourcePagesDetails( source, sourceData[ source ] );
|
this.setSourcePagesDetails( source, sourceData[ source ] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
13
package.json
13
package.json
|
@ -10,16 +10,17 @@
|
||||||
"selenium-daily": "npm run selenium-test"
|
"selenium-daily": "npm run selenium-test"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint-config-wikimedia": "0.5.0",
|
"eslint-config-wikimedia": "0.8.1",
|
||||||
"grunt": "1.0.1",
|
"eslint-plugin-qunit": "3.3.1",
|
||||||
|
"grunt": "1.0.3",
|
||||||
"grunt-banana-checker": "0.6.0",
|
"grunt-banana-checker": "0.6.0",
|
||||||
"grunt-contrib-watch": "1.0.0",
|
"grunt-contrib-watch": "1.0.0",
|
||||||
"grunt-eslint": "20.1.0",
|
"grunt-eslint": "21.0.0",
|
||||||
"grunt-jsonlint": "1.1.0",
|
"grunt-jsonlint": "1.1.0",
|
||||||
"grunt-stylelint": "0.9.0",
|
"grunt-stylelint": "0.10.1",
|
||||||
"grunt-svgmin": "5.0.0",
|
"grunt-svgmin": "5.0.0",
|
||||||
"stylelint": "8.2.0",
|
"stylelint": "9.2.0",
|
||||||
"stylelint-config-wikimedia": "0.4.2",
|
"stylelint-config-wikimedia": "0.4.3",
|
||||||
"wdio-mediawiki": "0.1.7",
|
"wdio-mediawiki": "0.1.7",
|
||||||
"wdio-mocha-framework": "0.5.13",
|
"wdio-mocha-framework": "0.5.13",
|
||||||
"wdio-spec-reporter": "0.1.4",
|
"wdio-spec-reporter": "0.1.4",
|
||||||
|
|
6
tests/qunit/.eslintrc.json
Normal file
6
tests/qunit/.eslintrc.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"extends": [
|
||||||
|
"wikimedia/qunit",
|
||||||
|
"../../.eslintrc.json"
|
||||||
|
]
|
||||||
|
}
|
|
@ -15,13 +15,13 @@
|
||||||
{ modelName: 'foo' }
|
{ modelName: 'foo' }
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
bundle.getCount(),
|
bundle.getCount(),
|
||||||
5,
|
5,
|
||||||
'Bundled items added to internal list'
|
'Bundled items added to internal list'
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
bundle.getName(),
|
bundle.getName(),
|
||||||
'foo',
|
'foo',
|
||||||
'Bundle name stored'
|
'Bundle name stored'
|
||||||
|
@ -33,13 +33,13 @@
|
||||||
'All ids present'
|
'All ids present'
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
bundle.isRead(),
|
bundle.isRead(),
|
||||||
false,
|
false,
|
||||||
'Bundle with all unread items is unread'
|
'Bundle with all unread items is unread'
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
bundle.hasUnseen(),
|
bundle.hasUnseen(),
|
||||||
true,
|
true,
|
||||||
'Bundle has unseen items'
|
'Bundle has unseen items'
|
||||||
|
@ -74,7 +74,7 @@
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
bundle.hasUnseen(),
|
bundle.hasUnseen(),
|
||||||
true,
|
true,
|
||||||
'Bundle has unseen'
|
'Bundle has unseen'
|
||||||
|
@ -85,20 +85,20 @@
|
||||||
bundledItems[ i ].toggleSeen( true );
|
bundledItems[ i ].toggleSeen( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
bundle.hasUnseen(),
|
bundle.hasUnseen(),
|
||||||
false,
|
false,
|
||||||
'Bundle does not have unseen after all items marked as seen'
|
'Bundle does not have unseen after all items marked as seen'
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
bundle.isRead(),
|
bundle.isRead(),
|
||||||
false,
|
false,
|
||||||
'Bundle is unread'
|
'Bundle is unread'
|
||||||
);
|
);
|
||||||
// Mark one item as read
|
// Mark one item as read
|
||||||
bundledItems[ 0 ].toggleRead( true );
|
bundledItems[ 0 ].toggleRead( true );
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
bundle.isRead(),
|
bundle.isRead(),
|
||||||
false,
|
false,
|
||||||
'Bundle is still unread if it has some unread items'
|
'Bundle is still unread if it has some unread items'
|
||||||
|
@ -108,7 +108,7 @@
|
||||||
for ( i = 0; i < bundledItems.length; i++ ) {
|
for ( i = 0; i < bundledItems.length; i++ ) {
|
||||||
bundledItems[ i ].toggleRead( true );
|
bundledItems[ i ].toggleRead( true );
|
||||||
}
|
}
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
bundle.isRead(),
|
bundle.isRead(),
|
||||||
true,
|
true,
|
||||||
'Bundle is marked as read if all items are read'
|
'Bundle is marked as read if all items are read'
|
||||||
|
|
|
@ -116,7 +116,7 @@
|
||||||
[ 'baz', 'bar', 'foo' ],
|
[ 'baz', 'bar', 'foo' ],
|
||||||
'Model source names exist in order'
|
'Model source names exist in order'
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.hasUnseen(),
|
model.hasUnseen(),
|
||||||
true,
|
true,
|
||||||
'hasUnseen is true if there are unseen items in any group'
|
'hasUnseen is true if there are unseen items in any group'
|
||||||
|
@ -129,14 +129,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
groupDefinitions[ 0 ].items[ 0 ].toggleSeen( false );
|
groupDefinitions[ 0 ].items[ 0 ].toggleSeen( false );
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.hasUnseen(),
|
model.hasUnseen(),
|
||||||
true,
|
true,
|
||||||
'hasUnseen is true even if only one item in one group is unseen'
|
'hasUnseen is true even if only one item in one group is unseen'
|
||||||
);
|
);
|
||||||
|
|
||||||
groupDefinitions[ 0 ].items[ 0 ].toggleSeen( true );
|
groupDefinitions[ 0 ].items[ 0 ].toggleSeen( true );
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.hasUnseen(),
|
model.hasUnseen(),
|
||||||
false,
|
false,
|
||||||
'hasUnseen is false if there are no unseen items in any of the groups'
|
'hasUnseen is false if there are no unseen items in any of the groups'
|
||||||
|
@ -209,7 +209,7 @@
|
||||||
numUnseenItems = model.getItems().filter( function ( item ) {
|
numUnseenItems = model.getItems().filter( function ( item ) {
|
||||||
return !item.isSeen();
|
return !item.isSeen();
|
||||||
} ).length;
|
} ).length;
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
numUnseenItems,
|
numUnseenItems,
|
||||||
numAllItems,
|
numAllItems,
|
||||||
'Starting state: all items are unseen'
|
'Starting state: all items are unseen'
|
||||||
|
@ -221,7 +221,7 @@
|
||||||
numUnseenItems = model.getItems().filter( function ( item ) {
|
numUnseenItems = model.getItems().filter( function ( item ) {
|
||||||
return !item.isSeen();
|
return !item.isSeen();
|
||||||
} ).length;
|
} ).length;
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
numUnseenItems,
|
numUnseenItems,
|
||||||
numAllItems - groupDefinitions[ 0 ].items.length,
|
numAllItems - groupDefinitions[ 0 ].items.length,
|
||||||
'Only some items are seen'
|
'Only some items are seen'
|
||||||
|
@ -233,7 +233,7 @@
|
||||||
numUnseenItems = model.getItems().filter( function ( item ) {
|
numUnseenItems = model.getItems().filter( function ( item ) {
|
||||||
return !item.isSeen();
|
return !item.isSeen();
|
||||||
} ).length;
|
} ).length;
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
numUnseenItems,
|
numUnseenItems,
|
||||||
0,
|
0,
|
||||||
'All items are seen'
|
'All items are seen'
|
||||||
|
|
|
@ -52,28 +52,28 @@
|
||||||
QUnit.test( 'Changing filters', function ( assert ) {
|
QUnit.test( 'Changing filters', function ( assert ) {
|
||||||
var model = new mw.echo.dm.FiltersModel();
|
var model = new mw.echo.dm.FiltersModel();
|
||||||
|
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.getReadState(),
|
model.getReadState(),
|
||||||
'all',
|
'all',
|
||||||
'Initial value: all'
|
'Initial value: all'
|
||||||
);
|
);
|
||||||
|
|
||||||
model.setReadState( 'unread' );
|
model.setReadState( 'unread' );
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.getReadState(),
|
model.getReadState(),
|
||||||
'unread',
|
'unread',
|
||||||
'Changing state (unread)'
|
'Changing state (unread)'
|
||||||
);
|
);
|
||||||
|
|
||||||
model.setReadState( 'read' );
|
model.setReadState( 'read' );
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.getReadState(),
|
model.getReadState(),
|
||||||
'read',
|
'read',
|
||||||
'Changing state (read)'
|
'Changing state (read)'
|
||||||
);
|
);
|
||||||
|
|
||||||
model.setReadState( 'foo' );
|
model.setReadState( 'foo' );
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.getReadState(),
|
model.getReadState(),
|
||||||
'read',
|
'read',
|
||||||
'Ignoring invalid state (foo)'
|
'Ignoring invalid state (foo)'
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
QUnit.test( 'Constructing the model', function ( assert ) {
|
QUnit.test( 'Constructing the model', function ( assert ) {
|
||||||
var model = new mw.echo.dm.NotificationGroupsList();
|
var model = new mw.echo.dm.NotificationGroupsList();
|
||||||
|
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.getTimestamp(),
|
model.getTimestamp(),
|
||||||
0,
|
0,
|
||||||
'Empty group has timestamp 0'
|
'Empty group has timestamp 0'
|
||||||
|
@ -59,14 +59,14 @@
|
||||||
groupDefinitions[ i ].items
|
groupDefinitions[ i ].items
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.getItemCount(),
|
model.getItemCount(),
|
||||||
i + 1,
|
i + 1,
|
||||||
'Group number increases after addGroup ("' + groupDefinitions[ i ].name + '")'
|
'Group number increases after addGroup ("' + groupDefinitions[ i ].name + '")'
|
||||||
);
|
);
|
||||||
|
|
||||||
group = model.getGroupByName( groupDefinitions[ i ].name );
|
group = model.getGroupByName( groupDefinitions[ i ].name );
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
group.getName(),
|
group.getName(),
|
||||||
groupDefinitions[ i ].name,
|
groupDefinitions[ i ].name,
|
||||||
'Group exists after addGroup ("' + groupDefinitions[ i ].name + '")'
|
'Group exists after addGroup ("' + groupDefinitions[ i ].name + '")'
|
||||||
|
@ -76,12 +76,12 @@
|
||||||
// Remove group
|
// Remove group
|
||||||
model.removeGroup( groupDefinitions[ 0 ].name );
|
model.removeGroup( groupDefinitions[ 0 ].name );
|
||||||
|
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.getItemCount(),
|
model.getItemCount(),
|
||||||
groupDefinitions.length - 1,
|
groupDefinitions.length - 1,
|
||||||
'Group number decreased after removeGroup'
|
'Group number decreased after removeGroup'
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.getGroupByName( groupDefinitions[ 0 ] ),
|
model.getGroupByName( groupDefinitions[ 0 ] ),
|
||||||
null,
|
null,
|
||||||
'Removed group is no longer in the list'
|
'Removed group is no longer in the list'
|
||||||
|
@ -90,7 +90,7 @@
|
||||||
// Removing the last item from a group should remove the group
|
// Removing the last item from a group should remove the group
|
||||||
group = model.getGroupByName( 'baz' );
|
group = model.getGroupByName( 'baz' );
|
||||||
group.discardItems( groupDefinitions[ 2 ].items );
|
group.discardItems( groupDefinitions[ 2 ].items );
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.getGroupByName( 'baz' ),
|
model.getGroupByName( 'baz' ),
|
||||||
null,
|
null,
|
||||||
'Empty group is no longer in the list'
|
'Empty group is no longer in the list'
|
||||||
|
|
|
@ -69,24 +69,24 @@
|
||||||
new mw.echo.dm.NotificationItem( 5, { type: 'message', timestamp: '201609190500', read: true, seen: false } )
|
new mw.echo.dm.NotificationItem( 5, { type: 'message', timestamp: '201609190500', read: true, seen: false } )
|
||||||
];
|
];
|
||||||
|
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.getCount(),
|
model.getCount(),
|
||||||
0,
|
0,
|
||||||
'Model list starts empty'
|
'Model list starts empty'
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.getTimestamp(),
|
model.getTimestamp(),
|
||||||
'200101010000',
|
'200101010000',
|
||||||
'Model timestamp is its default'
|
'Model timestamp is its default'
|
||||||
);
|
);
|
||||||
|
|
||||||
model.setItems( items );
|
model.setItems( items );
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.getCount(),
|
model.getCount(),
|
||||||
6,
|
6,
|
||||||
'Item list setup'
|
'Item list setup'
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.getTimestamp(),
|
model.getTimestamp(),
|
||||||
'201609190100',
|
'201609190100',
|
||||||
'Model timestamp is the latest unread item\'s timestamp'
|
'Model timestamp is the latest unread item\'s timestamp'
|
||||||
|
|
|
@ -82,12 +82,12 @@
|
||||||
|
|
||||||
model.setAllSources( sources );
|
model.setAllSources( sources );
|
||||||
|
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.getCurrentSource(),
|
model.getCurrentSource(),
|
||||||
'local',
|
'local',
|
||||||
'Default source is local'
|
'Default source is local'
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.getCurrentPage(),
|
model.getCurrentPage(),
|
||||||
null,
|
null,
|
||||||
'Default page is null'
|
'Default page is null'
|
||||||
|
@ -97,12 +97,12 @@
|
||||||
[ 'local', 'hewiki' ],
|
[ 'local', 'hewiki' ],
|
||||||
'Source array includes all sources'
|
'Source array includes all sources'
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.getSourceTitle( 'hewiki' ),
|
model.getSourceTitle( 'hewiki' ),
|
||||||
'Hebrew Wikipedia',
|
'Hebrew Wikipedia',
|
||||||
'Source title'
|
'Source title'
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.getSourceTotalCount( 'hewiki' ),
|
model.getSourceTotalCount( 'hewiki' ),
|
||||||
15,
|
15,
|
||||||
'Source total count'
|
'Source total count'
|
||||||
|
@ -157,12 +157,12 @@
|
||||||
// Change source
|
// Change source
|
||||||
model.setCurrentSourcePage( 'hewiki', 'User:Bar' );
|
model.setCurrentSourcePage( 'hewiki', 'User:Bar' );
|
||||||
|
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.getCurrentSource(),
|
model.getCurrentSource(),
|
||||||
'hewiki',
|
'hewiki',
|
||||||
'Source changed successfully'
|
'Source changed successfully'
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.getCurrentPage(),
|
model.getCurrentPage(),
|
||||||
'User:Bar',
|
'User:Bar',
|
||||||
'Page changed successfully'
|
'Page changed successfully'
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
for ( i = 0; i < cases.length; i++ ) {
|
for ( i = 0; i < cases.length; i++ ) {
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.getCappedNotificationCount( cases[ i ].input ),
|
model.getCappedNotificationCount( cases[ i ].input ),
|
||||||
cases[ i ].output,
|
cases[ i ].output,
|
||||||
'Capped notifications count: ' +
|
'Capped notifications count: ' +
|
||||||
|
@ -35,21 +35,21 @@
|
||||||
model.setCount( 50 );
|
model.setCount( 50 );
|
||||||
|
|
||||||
model.estimateChange( -10 );
|
model.estimateChange( -10 );
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.getCount(),
|
model.getCount(),
|
||||||
40, // 50-10
|
40, // 50-10
|
||||||
'Estimation within range'
|
'Estimation within range'
|
||||||
);
|
);
|
||||||
|
|
||||||
model.estimateChange( 70 );
|
model.estimateChange( 70 );
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.getCount(),
|
model.getCount(),
|
||||||
100, // Estimation reached above cap - cap is set
|
100, // Estimation reached above cap - cap is set
|
||||||
'Estimation brings count to cap'
|
'Estimation brings count to cap'
|
||||||
);
|
);
|
||||||
|
|
||||||
model.estimateChange( -10 );
|
model.estimateChange( -10 );
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
model.getCount(),
|
model.getCount(),
|
||||||
100, // We are already above cap, count will not change
|
100, // We are already above cap, count will not change
|
||||||
'Estimation while counter is outside of cap - no change'
|
'Estimation while counter is outside of cap - no change'
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
( function ( $, mw ) {
|
( function ( $, mw ) {
|
||||||
QUnit.module( 'ext.echo.overlay', {
|
QUnit.module( 'ext.echo.overlay', {
|
||||||
setup: function () {
|
beforeEach: function () {
|
||||||
var ApiStub;
|
var ApiStub;
|
||||||
|
|
||||||
this.$badge = $( '<a class="mw-echo-notifications-badge mw-echo-unseen-notifications">1</a>' );
|
this.$badge = $( '<a class="mw-echo-notifications-badge mw-echo-unseen-notifications">1</a>' );
|
||||||
|
@ -198,7 +198,7 @@
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
QUnit.test( 'mw.echo.overlay.buildOverlay', 7, function ( assert ) {
|
QUnit.test( 'mw.echo.overlay.buildOverlay', function ( assert ) {
|
||||||
var $overlay;
|
var $overlay;
|
||||||
this.sandbox.stub( mw.echo.overlay, 'api', new this.ApiStub() );
|
this.sandbox.stub( mw.echo.overlay, 'api', new this.ApiStub() );
|
||||||
mw.echo.overlay.buildOverlay( function ( $o ) {
|
mw.echo.overlay.buildOverlay( function ( $o ) {
|
||||||
|
@ -216,7 +216,7 @@
|
||||||
false, 'The badge no longer indicates new messages.' );
|
false, 'The badge no longer indicates new messages.' );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
QUnit.test( 'mw.echo.overlay.buildOverlay with messages', 5, function ( assert ) {
|
QUnit.test( 'mw.echo.overlay.buildOverlay with messages', function ( assert ) {
|
||||||
var $overlay;
|
var $overlay;
|
||||||
this.sandbox.stub( mw.echo.overlay, 'api', new this.ApiStub( 'no-new-messages' ) );
|
this.sandbox.stub( mw.echo.overlay, 'api', new this.ApiStub( 'no-new-messages' ) );
|
||||||
mw.echo.overlay.buildOverlay( function ( $o ) {
|
mw.echo.overlay.buildOverlay( function ( $o ) {
|
||||||
|
@ -232,7 +232,7 @@
|
||||||
false, 'The notification button class is updated with the default switch to alert tab.' );
|
false, 'The notification button class is updated with the default switch to alert tab.' );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
QUnit.test( 'Switch tabs on overlay. 1 unread alert, no unread messages.', 7, function ( assert ) {
|
QUnit.test( 'Switch tabs on overlay. 1 unread alert, no unread messages.', function ( assert ) {
|
||||||
var $overlay, $tabs;
|
var $overlay, $tabs;
|
||||||
|
|
||||||
this.sandbox.stub( mw.echo.overlay, 'api', new this.ApiStub( 'no-new-messages' ) );
|
this.sandbox.stub( mw.echo.overlay, 'api', new this.ApiStub( 'no-new-messages' ) );
|
||||||
|
@ -259,7 +259,7 @@
|
||||||
true, 'Second tab has active class .as it is the only clickable tab' );
|
true, 'Second tab has active class .as it is the only clickable tab' );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
QUnit.test( 'Unread message behaviour', 5, function ( assert ) {
|
QUnit.test( 'Unread message behaviour', function ( assert ) {
|
||||||
var $overlay;
|
var $overlay;
|
||||||
|
|
||||||
this.sandbox.stub( mw.echo.overlay, 'api', new this.ApiStub( 'with-new-messages' ) );
|
this.sandbox.stub( mw.echo.overlay, 'api', new this.ApiStub( 'with-new-messages' ) );
|
||||||
|
@ -282,7 +282,7 @@
|
||||||
'There are no notifications now so no need for button.' );
|
'There are no notifications now so no need for button.' );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
QUnit.test( 'Mark as read.', 8, function ( assert ) {
|
QUnit.test( 'Mark as read.', function ( assert ) {
|
||||||
var $overlay;
|
var $overlay;
|
||||||
this.$badge.text( '8' );
|
this.$badge.text( '8' );
|
||||||
this.sandbox.stub( mw.echo.overlay, 'api', new this.ApiStub( 'with-new-messages' ) );
|
this.sandbox.stub( mw.echo.overlay, 'api', new this.ApiStub( 'with-new-messages' ) );
|
||||||
|
@ -311,7 +311,7 @@
|
||||||
assert.strictEqual( this.$badge.text(), '6', 'Now 6 unread notifications.' );
|
assert.strictEqual( this.$badge.text(), '6', 'Now 6 unread notifications.' );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
QUnit.test( 'Tabs when there is overflow.', 2, function ( assert ) {
|
QUnit.test( 'Tabs when there is overflow.', function ( assert ) {
|
||||||
var $overlay;
|
var $overlay;
|
||||||
this.sandbox.stub( mw.echo.overlay, 'api', new this.ApiStub( 'with-new-messages', 50 ) );
|
this.sandbox.stub( mw.echo.overlay, 'api', new this.ApiStub( 'with-new-messages', 50 ) );
|
||||||
mw.echo.overlay.buildOverlay( function ( $o ) {
|
mw.echo.overlay.buildOverlay( function ( $o ) {
|
||||||
|
@ -324,7 +324,7 @@
|
||||||
assert.strictEqual( $overlay.find( '.mw-echo-unread' ).length, 8, 'There are 8 unread notifications.' );
|
assert.strictEqual( $overlay.find( '.mw-echo-unread' ).length, 8, 'There are 8 unread notifications.' );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
QUnit.test( 'Switching tabs visibility', 4, function ( assert ) {
|
QUnit.test( 'Switching tabs visibility', function ( assert ) {
|
||||||
var $overlay;
|
var $overlay;
|
||||||
|
|
||||||
this.sandbox.stub( mw.echo.overlay, 'api', new this.ApiStub( 'with-new-messages' ) );
|
this.sandbox.stub( mw.echo.overlay, 'api', new this.ApiStub( 'with-new-messages' ) );
|
||||||
|
|
Loading…
Reference in a new issue