mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-13 22:41:32 -05:00
739443bb72
no issue - standardize on "{TestType}: {ModuleType}: {module-name}" for test description strings - standardize on `{module-name}-test.js` for test file names - fix deprecation notices for ember component unit tests without explicit `unit: test` or `needs: []`
47 lines
1.4 KiB
JavaScript
47 lines
1.4 KiB
JavaScript
/* jshint expr:true */
|
|
import Ember from 'ember';
|
|
import { expect } from 'chai';
|
|
import {
|
|
describeComponent,
|
|
it
|
|
}
|
|
from 'ember-mocha';
|
|
|
|
describeComponent(
|
|
'gh-notifications',
|
|
'Unit: Component: gh-notifications', {
|
|
unit: true,
|
|
needs: ['component:gh-notification']
|
|
},
|
|
function () {
|
|
beforeEach(function () {
|
|
// Stub the notifications service
|
|
var notifications = Ember.Object.create();
|
|
notifications.notifications = Ember.A();
|
|
notifications.notifications.pushObject({message: 'First', type: 'error'});
|
|
notifications.notifications.pushObject({message: 'Second', type: 'warn'});
|
|
|
|
this.subject().set('notifications', notifications);
|
|
});
|
|
|
|
it('renders', function () {
|
|
// creates the component instance
|
|
var component = this.subject();
|
|
expect(component._state).to.equal('preRender');
|
|
|
|
// renders the component on the page
|
|
this.render();
|
|
expect(component._state).to.equal('inDOM');
|
|
|
|
expect(this.$().prop('tagName')).to.equal('ASIDE');
|
|
expect(this.$().hasClass('gh-notifications')).to.be.true;
|
|
expect(this.$().children().length).to.equal(2);
|
|
|
|
Ember.run(function () {
|
|
component.set('notifications.notifications', Ember.A());
|
|
});
|
|
|
|
expect(this.$().children().length).to.equal(0);
|
|
});
|
|
}
|
|
);
|