Ghost/ghost/admin/tests/unit/components/gh-alert-test.js

27 lines
902 B
JavaScript
Raw Normal View History

import sinon from 'sinon';
2016-11-24 01:50:57 +03:00
import {describe, it} from 'mocha';
import {expect} from 'chai';
2016-11-24 01:50:57 +03:00
import {setupComponentTest} from 'ember-mocha';
2016-11-24 01:50:57 +03:00
describe('Unit: Component: gh-alert', function () {
setupComponentTest('gh-alert', {
2017-03-29 01:22:02 +03:00
unit: true,
// specify the other units that are required for this test
needs: ['service:notifications', 'helper:inline-svg']
2016-11-24 01:50:57 +03:00
});
2016-11-24 01:50:57 +03:00
it('closes notification through notifications service', function () {
let component = this.subject();
let notifications = {};
let notification = {message: 'Test close', type: 'success'};
2016-11-24 01:50:57 +03:00
notifications.closeNotification = sinon.spy();
component.set('notifications', notifications);
component.set('message', notification);
2016-11-24 01:50:57 +03:00
this.$().find('button').click();
expect(notifications.closeNotification.calledWith(notification)).to.be.true;
});
});