Skip to content

Commit

Permalink
test(ionSideMenu): test transclusion of content's scope
Browse files Browse the repository at this point in the history
  • Loading branch information
ajoslin committed Feb 24, 2014
1 parent 991d3cf commit 7977d53
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion js/ext/angular/test/directive/ionicSideMenu.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ describe('Ionic Side Menu Directive', function () {

sideMenuCtrl = sideMenus.controller('ionSideMenus');

element = angular.element('<ion-side-menu side="left" is-enabled="enabledVal" width="widthVal">').appendTo(sideMenus);
element = angular.element(
'<ion-side-menu side="left" is-enabled="enabledVal" width="widthVal">' +
'<div class="content"></div>' +
'</div>'
).appendTo(sideMenus);
$compile(element)($rootScope);

scope = element.scope();
Expand All @@ -67,6 +71,12 @@ describe('Ionic Side Menu Directive', function () {
expect(sideMenuCtrl.left.bringUp).not.toBe(undefined);
});

it('should transclude content with same scope', function() {
var content = angular.element(element[0].querySelector('.content'));
expect(content.length).toBe(1);
expect(content.scope()).toBe(scope);
});

it('should watch isEnabled', function() {
expect(sideMenuCtrl.left.isEnabled).toBe(true);
scope.$apply('enabledVal = false');
Expand Down

0 comments on commit 7977d53

Please sign in to comment.