mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-20 17:32:15 +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
45 lines
1.5 KiB
JavaScript
45 lines
1.5 KiB
JavaScript
/* jshint expr:true */
|
|
import { expect } from 'chai';
|
|
import {
|
|
describeComponent,
|
|
it
|
|
} from 'ember-mocha';
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
|
|
describeComponent(
|
|
'gh-notification',
|
|
'Integration: Component: gh-notification',
|
|
{
|
|
integration: true
|
|
},
|
|
function () {
|
|
it('renders', function () {
|
|
this.set('message', {message: 'Test message', type: 'success'});
|
|
|
|
this.render(hbs`{{gh-notification message=message}}`);
|
|
|
|
expect(this.$('article.gh-notification')).to.have.length(1);
|
|
let $notification = this.$('.gh-notification');
|
|
|
|
expect($notification.hasClass('gh-notification-passive')).to.be.true;
|
|
expect($notification.text()).to.match(/Test message/);
|
|
});
|
|
|
|
it('maps message types to CSS classes', function () {
|
|
this.set('message', {message: 'Test message', type: 'success'});
|
|
|
|
this.render(hbs`{{gh-notification message=message}}`);
|
|
let $notification = this.$('.gh-notification');
|
|
|
|
this.set('message.type', 'success');
|
|
expect($notification.hasClass('gh-notification-green'), 'success class isn\'t green').to.be.true;
|
|
|
|
this.set('message.type', 'error');
|
|
expect($notification.hasClass('gh-notification-red'), 'success class isn\'t red').to.be.true;
|
|
|
|
this.set('message.type', 'warn');
|
|
expect($notification.hasClass('gh-notification-yellow'), 'success class isn\'t yellow').to.be.true;
|
|
});
|
|
}
|
|
);
|