Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ncyBreadcrumb): display the correct breadcrumb in case of direct …
…access When the breadcrumb relies on nested views, the $viewContentLoaded event used by the directive occurs many times. The event related to the deepest view (the correct one for the breadcrumb) is not necessary the last one. We use the '$id' property to get the 'lastly created' scope. Closes #10
- Loading branch information
Showing
4 changed files
with
92 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/*jshint undef: false */ | ||
|
||
describe('The scope', function() { | ||
|
||
beforeEach(function() { | ||
module('ncy-basic-conf'); | ||
}); | ||
|
||
it('00A is older than 001', function() { | ||
expect(isAOlderThanB('00A', '001')).toBe(true); | ||
}); | ||
|
||
it('010 is older than 00Y', function() { | ||
expect(isAOlderThanB('010', '00Y')).toBe(true); | ||
}); | ||
|
||
it('01P is older than 010', function() { | ||
expect(isAOlderThanB('01P', '010')).toBe(true); | ||
}); | ||
|
||
it('FOO is older than BAR', function() { | ||
expect(isAOlderThanB('FOO', 'BAR')).toBe(true); | ||
}); | ||
|
||
it('F00 is older than BAR', function() { | ||
expect(isAOlderThanB('F00', 'BAR')).toBe(true); | ||
}); | ||
|
||
it('0000 is older than ZZZ', function() { | ||
expect(isAOlderThanB('0000', 'ZZZ')).toBe(true); | ||
}); | ||
|
||
it('(newly created) is always older than the precedent one', inject(function($rootScope) { | ||
var scope = $rootScope.$new(); | ||
for(var i = 0; i < 100000; i++) { | ||
var newScope = $rootScope.$new(); | ||
var isOlder = isAOlderThanB(newScope.$id, scope.$id); | ||
expect(isOlder).toBe(true); | ||
if(!isOlder) { | ||
console.log(newScope.$id, scope.$id, isOlder, i); | ||
break; | ||
} | ||
scope = newScope; | ||
} | ||
})); | ||
|
||
}); |