2012-03-08 23:00:38 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
2012-04-09 18:20:55 +00:00
|
|
|
describe('ngShow / ngHide', function() {
|
2012-03-08 23:00:38 +00:00
|
|
|
var element;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
afterEach(function() {
|
|
|
|
|
dealoc(element);
|
|
|
|
|
});
|
|
|
|
|
|
2012-04-09 18:20:55 +00:00
|
|
|
describe('ngShow', function() {
|
2012-03-08 23:00:38 +00:00
|
|
|
it('should show and hide an element', inject(function($rootScope, $compile) {
|
2012-03-09 08:00:05 +00:00
|
|
|
element = jqLite('<div ng-show="exp"></div>');
|
2012-03-08 23:00:38 +00:00
|
|
|
element = $compile(element)($rootScope);
|
|
|
|
|
$rootScope.$digest();
|
|
|
|
|
expect(isCssVisible(element)).toEqual(false);
|
|
|
|
|
$rootScope.exp = true;
|
|
|
|
|
$rootScope.$digest();
|
|
|
|
|
expect(isCssVisible(element)).toEqual(true);
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it('should make hidden element visible', inject(function($rootScope, $compile) {
|
2012-03-09 08:00:05 +00:00
|
|
|
element = jqLite('<div style="display: none" ng-show="exp"></div>');
|
2012-03-08 23:00:38 +00:00
|
|
|
element = $compile(element)($rootScope);
|
|
|
|
|
expect(isCssVisible(element)).toBe(false);
|
|
|
|
|
$rootScope.exp = true;
|
|
|
|
|
$rootScope.$digest();
|
|
|
|
|
expect(isCssVisible(element)).toBe(true);
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
|
2012-04-09 18:20:55 +00:00
|
|
|
describe('ngHide', function() {
|
2012-03-08 23:00:38 +00:00
|
|
|
it('should hide an element', inject(function($rootScope, $compile) {
|
2012-03-09 08:00:05 +00:00
|
|
|
element = jqLite('<div ng-hide="exp"></div>');
|
2012-03-08 23:00:38 +00:00
|
|
|
element = $compile(element)($rootScope);
|
|
|
|
|
expect(isCssVisible(element)).toBe(true);
|
|
|
|
|
$rootScope.exp = true;
|
|
|
|
|
$rootScope.$digest();
|
|
|
|
|
expect(isCssVisible(element)).toBe(false);
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
});
|