2015-06-18 22:56:18 +01:00
|
|
|
/* jshint expr:true */
|
|
|
|
import { expect } from 'chai';
|
|
|
|
import {
|
|
|
|
describeComponent,
|
|
|
|
it
|
|
|
|
}
|
|
|
|
from 'ember-mocha';
|
|
|
|
import sinon from 'sinon';
|
|
|
|
|
|
|
|
describeComponent(
|
|
|
|
'gh-alert',
|
2015-10-06 17:31:03 +01:00
|
|
|
'Unit: Component: gh-alert',
|
|
|
|
{
|
|
|
|
unit: true
|
2015-06-18 22:56:18 +01:00
|
|
|
// specify the other units that are required for this test
|
|
|
|
// needs: ['component:foo', 'helper:bar']
|
|
|
|
},
|
|
|
|
function () {
|
|
|
|
it('closes notification through notifications service', function () {
|
|
|
|
var component = this.subject(),
|
|
|
|
notifications = {},
|
|
|
|
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;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
);
|