Skip to content

Instantly share code, notes, and snippets.

@chalettu
Created December 14, 2016 16:15
Show Gist options
  • Save chalettu/06c981e32c0d8ad2a0ee9ff23701d27f to your computer and use it in GitHub Desktop.
Save chalettu/06c981e32c0d8ad2a0ee9ff23701d27f to your computer and use it in GitHub Desktop.
Unit test for component
describe('detail-reveal component', function() {
beforeEach(function(){
module('app.components', 'gettext');
});
describe('controller', function() {
var controller;
var $componentController;
var bindings = {title: 'Test', detail: 'test detail', icon: 'testIconClass', translateTitle: false, rowClass: 'test'};
beforeEach(function(){
inject(function(_$componentController_,$transclude) {
$componentController = _$componentController_;
transclude = $transclude.$new();
ctrl = $componentController('detailReveal', {$transclude: transclude}, bindings);
}
)
}
);
it('is defined, accepts bindings', function() {
expect(ctrl).to.be.defined;
expect(ctrl.title).to.equal('Test');
expect(ctrl.detail).to.equal('test detail');
expect(ctrl.icon).to.equal('testIconClass');
expect(ctrl.translateTitle).to.equal(false);
expect(ctrl.rowClass).to.equal('test');
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment