Ghost/ghost/admin/tests/unit/components/gh-alert-test.js
2018-03-19 09:57:31 +00:00

27 lines
899 B
JavaScript

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