Permalink
Browse files

Pridany prvni unit testy pro testovani direktivy inline

  • Loading branch information...
1 parent f49c4a4 commit c8d742ff969cb3156b4f3b62df6736f2b8fb4c1f @JakubMrozek committed Dec 3, 2012

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -1,14 +0,0 @@
-'use strict';
-
-describe('IndexIndexCtrl', function(){
-
- var indexCtrl;
- beforeEach(function(){
- var indexCtrl = new IndexIndexCtrl();
- });
-
- it('...', function(){
- //prvni testy
- });
-
-});
@@ -0,0 +1,43 @@
+describe('inline', function() {
+ var elm, scope;
+
+ beforeEach(module('zdrojak'));
+
+ beforeEach(inject(function($rootScope, $compile) {
+
+ elm = angular.element(
+ '<p>' +
+ '<inline value="testvalue" action="update">' +
+ '</inline>' +
+ '</p>');
+
+ scope = $rootScope;
+ $compile(elm)(scope);
+ scope.$digest();
+
+ scope.$apply(function() {
+ scope.testvalue = 'Lorem ipsum';
+ });
+
+ }));
+
+ it('pri inicializaci zobrazi data z modelu v direktive', inject(function() {
+ expect(elm.find('span').eq(0).text()).toBe('Lorem ipsum');
+ }));
+
+ it('po kliknuti na element zobrazi pole pro editaci', inject(function() {
+ expect(elm.find('span').css('display')).not.toBe('none');
+ expect(elm.find('input').css('display')).toBe('none');
+ expect(elm.find('textarea').css('display')).toBe('none');
+
+ elm.find('span').click();
+
+ expect(elm.find('span').css('display')).toBe('none');
+ expect(elm.find('input').css('display')).not.toBe('none');
+ expect(elm.find('textarea').css('display')).toBe('none');
+ }));
+
+ it('po kliknuti na element zobrazi pole pro editaci', inject(function() {
+ elm.find('span').click();
+ }));
+});
View
@@ -8,8 +8,10 @@ basePath = '';
// list of files / patterns to load in the browser
files = [
- MOCHA,
- MOCHA_ADAPTER,
+ JASMINE,
+ JASMINE_ADAPTER,
+
+ 'public/lib/jquery-1.8.3.min.js',
'public/lib/angular/angular.js',
'public/lib/angular/angular-*.js',
'test/frontend/lib/angular/angular-mocks.js',

0 comments on commit c8d742f

Please sign in to comment.