2015-10-07 17:44:23 +03:00
|
|
|
/* jshint expr:true */
|
|
|
|
import { expect } from 'chai';
|
|
|
|
import {
|
|
|
|
describeComponent,
|
|
|
|
it
|
|
|
|
} from 'ember-mocha';
|
|
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
|
|
import Ember from 'ember';
|
|
|
|
|
2015-10-28 14:36:45 +03:00
|
|
|
const {Service, run} = Ember;
|
|
|
|
const emberA = Ember.A;
|
|
|
|
|
|
|
|
let notificationsStub = Service.extend({
|
|
|
|
notifications: emberA()
|
|
|
|
});
|
2015-10-07 17:44:23 +03:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2015-10-28 14:36:45 +03:00
|
|
|
this.set('notifications.notifications', emberA());
|
2015-10-07 17:44:23 +03:00
|
|
|
expect(this.$('.gh-notifications').children().length).to.equal(0);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
);
|