mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 05:50:35 +03:00
c5a8a0c860
closes #5903, refs #5409 - switch alert/notification component tests from unit to integration where appropriate - rename `notifications.closeAll` to `notifications.clearAll` to better represent it's behaviour - add concept of a "key" to alerts/notifications and ability to close only specified keys through notifications service - close duplicate alerts/notifications before showing a new one - specify a key for all existing alerts - close failure alerts on successful retries - clear all currently displayed alerts on successful sign-in
43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
/* jshint expr:true */
|
|
import { expect } from 'chai';
|
|
import {
|
|
describeComponent,
|
|
it
|
|
} from 'ember-mocha';
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
import Ember from 'ember';
|
|
|
|
const {run} = Ember,
|
|
notificationsStub = Ember.Service.extend({
|
|
notifications: Ember.A()
|
|
});
|
|
|
|
describeComponent(
|
|
'gh-notifications',
|
|
'Integration: Component: gh-notifications',
|
|
{
|
|
integration: true
|
|
},
|
|
function () {
|
|
beforeEach(function () {
|
|
this.register('service:notifications', notificationsStub);
|
|
this.inject.service('notifications', {as: 'notifications'});
|
|
|
|
this.set('notifications.notifications', [
|
|
{message: 'First', type: 'error'},
|
|
{message: 'Second', type: 'warn'}
|
|
]);
|
|
});
|
|
|
|
it('renders', function () {
|
|
this.render(hbs`{{gh-notifications}}`);
|
|
expect(this.$('.gh-notifications').length).to.equal(1);
|
|
|
|
expect(this.$('.gh-notifications').children().length).to.equal(2);
|
|
|
|
this.set('notifications.notifications', Ember.A());
|
|
expect(this.$('.gh-notifications').children().length).to.equal(0);
|
|
});
|
|
}
|
|
);
|