fix(sideMenu): enable menu w/ different historyId back view

This commit is contained in:
Adam Bradley
2014-12-03 23:28:00 -06:00
parent 74cc98039b
commit 6a1c53301c
3 changed files with 65 additions and 5 deletions

View File

@@ -170,6 +170,55 @@ describe('Ionic Angular Side Menu', function() {
expect(ctrl.isDraggableTarget(e)).toBe(true);
}));
it('should isDraggableTarget w/ enableMenuWithBackViews', inject(function($compile, $rootScope, $ionicHistory) {
var el = $compile('<ion-side-menus><ion-side-menu-content></ion-side-menu-content></ion-side-menus>')($rootScope.$new());
$rootScope.$apply();
var ctrl = el.controller('ionSideMenus');
var e = {
gesture: {
srcEvent: {
defaultPrevented: false
}
},
target: {
tagName: 'DIV',
dataset: {
preventScroll: false
}
}
};
ctrl.enableMenuWithBackViews(true);
expect(ctrl.isDraggableTarget(e)).toBe(true);
ctrl.enableMenuWithBackViews(false);
expect(ctrl.isDraggableTarget(e)).toBe(true);
ctrl.enableMenuWithBackViews(false);
$ionicHistory.currentView({historyId: 'root'});
$ionicHistory.backView({historyId: 'root'});
expect(ctrl.isDraggableTarget(e)).toBe(false);
ctrl.enableMenuWithBackViews(false);
$ionicHistory.currentView({historyId: 'root'});
$ionicHistory.backView(null);
expect(ctrl.isDraggableTarget(e)).toBe(true);
ctrl.enableMenuWithBackViews(true);
$ionicHistory.currentView({historyId: 'root'});
$ionicHistory.backView({historyId: 'root'});
expect(ctrl.isDraggableTarget(e)).toBe(true);
ctrl.enableMenuWithBackViews(false);
$ionicHistory.currentView({historyId: '003'});
$ionicHistory.backView({historyId: 'root'});
expect(ctrl.isDraggableTarget(e)).toBe(true);
}));
});
describe('Ionic Side Menu Content Directive', function () {