-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix(nav-bar): null check tabs when updating nav-bar #9071
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -175,6 +175,17 @@ describe('mdNavBar', function() { | |
expect(getTab('tab2').attr('ui-sref-opts')) | ||
.toBe('{"reload":true,"notify":true}'); | ||
}); | ||
|
||
it('does not update tabs if tab controller is undefined', function() { | ||
$scope.selectedTabRoute = 'tab1'; | ||
|
||
spyOn(Object.getPrototypeOf(ctrl), '_updateInkBarStyles'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pretty sure the Object.getPrototypeOf indirection is unnecessary. Can you remove the 3 instances in this test? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems to actually be necessary for some reason. Just ran a few tests: The expect can be modified to utilize the ctrl object instead and the test passes as expected. Any ideas? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for trying; this is ok. |
||
spyOn(Object.getPrototypeOf(ctrl), '_getTabs').and.returnValue(null); | ||
createTabs(); | ||
|
||
expect(ctrl._updateInkBarStyles) | ||
.not.toHaveBeenCalled(); | ||
}); | ||
}); | ||
|
||
describe('inkbar', function() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a comment here explaining why tabs might be null?