Ghost/ghost/admin/tests/integration/components/gh-alert-test.js
Kevin Ansfield a85f5fae35 Switch to eslint-plugin-ghost extending plugin:ghost/ember
no issue
- fix lint errors in lib/gh-koenig
- fix ghost:base eslint errors
- update ember plugin refs, remove ember-suave plugin refs
- remove old jshint refs
- add `lint:js` script
- switch to `eslint-plugin-ghost` extending `plugin:ghost/ember`
2018-01-12 12:17:56 +00:00

41 lines
1.4 KiB
JavaScript

import hbs from 'htmlbars-inline-precompile';
import {describe, it} from 'mocha';
import {expect} from 'chai';
import {setupComponentTest} from 'ember-mocha';
describe('Integration: Component: gh-alert', function () {
setupComponentTest('gh-alert', {
integration: true
});
it('renders', function () {
this.set('message', {message: 'Test message', type: 'success'});
this.render(hbs`{{gh-alert message=message}}`);
expect(this.$('article.gh-alert')).to.have.length(1);
let $alert = this.$('.gh-alert');
expect($alert.text()).to.match(/Test message/);
});
it('maps message types to CSS classes', function () {
this.set('message', {message: 'Test message', type: 'success'});
this.render(hbs`{{gh-alert message=message}}`);
let $alert = this.$('.gh-alert');
this.set('message.type', 'success');
expect($alert.hasClass('gh-alert-green'), 'success class isn\'t green').to.be.true;
this.set('message.type', 'error');
expect($alert.hasClass('gh-alert-red'), 'success class isn\'t red').to.be.true;
this.set('message.type', 'warn');
expect($alert.hasClass('gh-alert-blue'), 'success class isn\'t yellow').to.be.true;
this.set('message.type', 'info');
expect($alert.hasClass('gh-alert-blue'), 'success class isn\'t blue').to.be.true;
});
});