-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add the scope-based ncyBreadcrumbIgnore flag
Provide the way to ignore some views when rendering breadcrumbs. To achieve this the property ncyBreadcrumbIgnore should be set to true on the view controller scope. Closes #42 #62
- Loading branch information
kazinov
committed
Aug 7, 2015
1 parent
da3fecd
commit 934c552
Showing
5 changed files
with
175 additions
and
17 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
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,112 @@ | ||
/*jshint undef: false */ | ||
|
||
|
||
var element, scope; | ||
|
||
describe('Breadcrumb directive with abstract-interpolation conf', function() { | ||
|
||
beforeEach(function () { | ||
module('ncy-abstract-interpolation-conf'); | ||
}); | ||
|
||
describe('when ncyBreadcrumbIgnore is undefined on parent view scope', function () { | ||
describe('when the parent view located before child view ', function () { | ||
beforeEach(inject(function ($rootScope, $compile) { | ||
element = angular.element('<div><div ncy-breadcrumb=""></div><div ui-view="a"></div><div ui-view="b"></div></div>'); | ||
var compile = $compile(element); | ||
scope = $rootScope.$new(); | ||
compile(scope); | ||
scope.$digest(); | ||
})); | ||
|
||
it('renders the correct state chain and views content', inject(function () { | ||
goToState('A.B'); | ||
scope.$emit('$viewContentLoaded'); | ||
scope.$digest(); | ||
|
||
console.info('Directive content : ' + element.text()); | ||
|
||
expect(element.text()).toContain('State BBBView AView B'); | ||
})); | ||
}); | ||
|
||
describe('when the parent view located after child view ', function () { | ||
beforeEach(inject(function ($rootScope, $compile) { | ||
element = angular.element('<div><div ncy-breadcrumb=""></div><div ui-view="b"></div><div ui-view="a"></div></div>'); | ||
var compile = $compile(element); | ||
scope = $rootScope.$new(); | ||
compile(scope); | ||
scope.$digest(); | ||
})); | ||
|
||
it('renders the incorrect state chain', inject(function () { | ||
goToState('A.B'); | ||
scope.$emit('$viewContentLoaded'); | ||
scope.$digest(); | ||
|
||
console.info('Directive content : ' + element.text()); | ||
|
||
expect(element.text()).not.toContain('State BBB'); | ||
})); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('Breadcrumb directive with abstract-interpolation conf', function() { | ||
var controller; | ||
|
||
beforeEach(function () { | ||
module('ncy-abstract-interpolation-conf', function ($controllerProvider) { | ||
$controllerProvider.register('ACtrl', function ($scope) { | ||
$scope.ncyBreadcrumbIgnore = true; | ||
}); | ||
}); | ||
}); | ||
|
||
describe('when ncyBreadcrumbIgnore property equals true on parent view scope', function () { | ||
describe('when the parent view located before child view ', function () { | ||
beforeEach(inject(function ($rootScope, $compile, $controller) { | ||
controller = $controller; | ||
element = angular.element('<div><div ncy-breadcrumb=""></div><div ui-view="a"></div><div ui-view="b"></div></div>'); | ||
var compile = $compile(element); | ||
scope = $rootScope.$new(); | ||
|
||
compile(scope); | ||
scope.$digest(); | ||
})); | ||
|
||
it('renders the correct state chain and views content', inject(function () { | ||
goToState('A.B'); | ||
scope.$emit('$viewContentLoaded'); | ||
scope.$digest(); | ||
|
||
console.info('Directive content : ' + element.text()); | ||
|
||
expect(element.text()).toContain('State BBBView AView B'); | ||
})); | ||
}); | ||
|
||
describe('when the parent view located after child view ', function () { | ||
beforeEach(inject(function ($rootScope, $compile, $controller) { | ||
controller = $controller; | ||
element = angular.element('<div><div ncy-breadcrumb=""></div><div ui-view="b"></div><div ui-view="a"></div></div>'); | ||
var compile = $compile(element); | ||
scope = $rootScope.$new(); | ||
|
||
compile(scope); | ||
scope.$digest(); | ||
})); | ||
|
||
it('renders the correct state chain and views content', inject(function () { | ||
goToState('A.B'); | ||
scope.$emit('$viewContentLoaded'); | ||
scope.$digest(); | ||
|
||
console.info('Directive content : ' + element.text()); | ||
|
||
expect(element.text()).toContain('State BBBView BView A'); | ||
})); | ||
}); | ||
}); | ||
|
||
}); |