')(scope).appendTo('body');
sideMenuCtrl = sideMenus.controller('sideMenus');
spyOn(sideMenuCtrl, '_handleDrag');
element = angular.element('').appendTo(sideMenus);
$compile(element)(scope);
scope.$digest();
}));
});
describe('Ionic Side Menu Directive', function () {
var element, scope, sideMenuCtrl;
beforeEach(module('ionic.ui.sideMenu'));
beforeEach(inject(function (_$compile_, _$rootScope_) {
var $compile = _$compile_;
var $rootScope = _$rootScope_.$new();
$rootScope.widthVal = 250;
$rootScope.enabledVal = true;
var sideMenus = $compile('')($rootScope);
sideMenuCtrl = sideMenus.controller('sideMenus');
element = angular.element('').appendTo(sideMenus);
$compile(element)($rootScope);
scope = element.scope();
scope.$digest();
}));
it('Should set attributes on the controller', function () {
expect(sideMenuCtrl.left.isEnabled).not.toBe(undefined);
expect(sideMenuCtrl.left.pushDown).not.toBe(undefined);
expect(sideMenuCtrl.left.bringUp).not.toBe(undefined);
});
it('should watch isEnabled', function() {
expect(sideMenuCtrl.left.isEnabled).toBe(true);
scope.$apply('enabledVal = false');
expect(sideMenuCtrl.left.isEnabled).toBe(false);
});
it('should watch width', function() {
expect(sideMenuCtrl.left.width).toBe(250);
expect(sideMenuCtrl.left.el.style.width).toBe('250px');
scope.$apply('widthVal = 222');
expect(sideMenuCtrl.left.width).toBe(222);
expect(sideMenuCtrl.left.el.style.width).toBe('222px');
});
});