2015-10-07 17:44:23 +03:00
|
|
|
/* jshint expr:true */
|
2016-11-14 16:16:51 +03:00
|
|
|
import {expect} from 'chai';
|
2016-11-24 01:50:57 +03:00
|
|
|
import {describe, it} from 'mocha';
|
|
|
|
import {setupComponentTest} from 'ember-mocha';
|
2015-10-07 17:44:23 +03:00
|
|
|
import hbs from 'htmlbars-inline-precompile';
|
2016-06-30 13:21:47 +03:00
|
|
|
import Service from 'ember-service';
|
|
|
|
import {A as emberA} from 'ember-array/utils';
|
2015-10-28 14:36:45 +03:00
|
|
|
|
|
|
|
let notificationsStub = Service.extend({
|
|
|
|
notifications: emberA()
|
|
|
|
});
|
2015-10-07 17:44:23 +03:00
|
|
|
|
2016-11-24 01:50:57 +03:00
|
|
|
describe('Integration: Component: gh-notifications', function () {
|
|
|
|
setupComponentTest('gh-notifications', {
|
2015-10-07 17:44:23 +03:00
|
|
|
integration: true
|
2016-11-24 01:50:57 +03:00
|
|
|
});
|
2015-10-07 17:44:23 +03:00
|
|
|
|
2016-11-24 01:50:57 +03:00
|
|
|
beforeEach(function () {
|
|
|
|
this.register('service:notifications', notificationsStub);
|
|
|
|
this.inject.service('notifications', {as: 'notifications'});
|
2015-10-07 17:44:23 +03:00
|
|
|
|
2016-11-24 01:50:57 +03:00
|
|
|
this.set('notifications.notifications', [
|
|
|
|
{message: 'First', type: 'error'},
|
|
|
|
{message: 'Second', type: 'warn'}
|
|
|
|
]);
|
|
|
|
});
|
2015-10-07 17:44:23 +03:00
|
|
|
|
2016-11-24 01:50:57 +03:00
|
|
|
it('renders', function () {
|
|
|
|
this.render(hbs`{{gh-notifications}}`);
|
|
|
|
expect(this.$('.gh-notifications').length).to.equal(1);
|
2015-10-07 17:44:23 +03:00
|
|
|
|
2016-11-24 01:50:57 +03:00
|
|
|
expect(this.$('.gh-notifications').children().length).to.equal(2);
|
|
|
|
|
|
|
|
this.set('notifications.notifications', emberA());
|
|
|
|
expect(this.$('.gh-notifications').children().length).to.equal(0);
|
|
|
|
});
|
|
|
|
});
|