From 17416d7a07f54474013648d73e132e8779687e53 Mon Sep 17 00:00:00 2001 From: Andy Joslin Date: Tue, 25 Mar 2014 07:45:20 -0600 Subject: [PATCH] test(ionContent): add tests for has-* classNames --- .../test/directive/ionicContent.unit.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/js/ext/angular/test/directive/ionicContent.unit.js b/js/ext/angular/test/directive/ionicContent.unit.js index 7b7cc5b0cf..5d481d99c8 100644 --- a/js/ext/angular/test/directive/ionicContent.unit.js +++ b/js/ext/angular/test/directive/ionicContent.unit.js @@ -39,6 +39,27 @@ describe('Ionic Content directive', function() { expect(scope.foo).toHaveBeenCalled(); }); + ['header','subheader','footer','subfooter','tabs','tabs-top'].forEach(function(type) { + var scopeVar = '$has' + type.split('-').map(function(part) { + return part.charAt(0).toUpperCase() + part.substring(1); + }).join(''); + var className = 'has-'+type; + + it('should has-' + type + ' when ' + scopeVar + ' == true', function() { + var element = compile('')(scope.$new()); + scope = element.scope(); + + expect(element.hasClass(className)).toBe(false); + expect(scope[scopeVar]).toBeFalsy(); + + scope.$apply(scopeVar + ' = true'); + expect(element.hasClass(className)).toBe(true); + + scope.$apply(scopeVar + ' = false'); + expect(element.hasClass(className)).toBe(false); + }); + }); + it('should add padding classname', function() { var element = compile('')(scope); var scrollElement = element.find('.scroll');