Added first working karma unit test.

This commit is contained in:
Gunther Brunner
2014-08-21 17:48:57 +09:00
parent 5559352585
commit e78c7572e1
4 changed files with 46 additions and 28 deletions

View File

@@ -1,23 +1,22 @@
describe('clearButton', function () {
beforeEach(module('stf.clear-button'));
beforeEach(angular.mock.module(require('./').name))
var scope, compile;
var scope, compile
beforeEach(inject(function ($rootScope, $compile) {
scope = $rootScope.$new();
compile = $compile;
}));
scope = $rootScope.$new()
compile = $compile
}))
it('should ...', function () {
it('should display a text label', function () {
var element = compile('<clear-button />')(scope)
expect(element.find('span').text()).toBe('Clear')
})
/*
To test your directive, you need to create some html that would use your
directive, send that through compile() then compare the results.
it('should display a trash icon', function () {
var element = compile('<clear-button />')(scope)
expect(element.find('i')[0].getAttribute('class')).toMatch('fa-trash-o')
})
var element = compile('<div clear-button name="name">hi</div>')(scope);
expect(element.text()).toBe('hello, world');
*/
});
});
})