feat($ionicBody): service to simplify body ele interaction

Many services/directives have to interact with the body element, and
each one has to write the same long code. The $ionicBody service
provides some useful methods to clean up and reduce redundant code.
This commit is contained in:
Adam Bradley
2014-08-26 22:23:07 -05:00
parent b69aa5485f
commit 2c3f1c9f02
10 changed files with 203 additions and 45 deletions

View File

@@ -84,6 +84,14 @@ describe('$ionicSideMenus controller', function() {
expect(ctrl.getOpenPercentage()).toEqual(-50);
});
it('should add/remove menu-open from the body class', inject(function($document) {
expect($document[0].body.classList.contains('menu-open')).toEqual(false);
ctrl.openPercentage(100);
expect($document[0].body.classList.contains('menu-open')).toEqual(true);
ctrl.openPercentage(0);
expect($document[0].body.classList.contains('menu-open')).toEqual(false);
}));
// Open
it('should toggle left', function() {
ctrl.toggleLeft();