-
Notifications
You must be signed in to change notification settings - Fork 180
Expand file tree
/
Copy pathdirective-basic-test.js
More file actions
50 lines (38 loc) · 1.53 KB
/
Copy pathdirective-basic-test.js
File metadata and controls
50 lines (38 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*jshint undef: false */
describe('Breadcrumb directive with basic conf', function() {
var element, scope;
beforeEach(function() {
module('ncy-basic-conf');
});
beforeEach(inject(function($rootScope, $compile) {
element = angular.element('<ncy-breadcrumb />');
var compile = $compile(element);
scope = $rootScope.$new();
compile(scope);
scope.$digest();
}));
it('renders the correct state chain', inject(function() {
goToState('D');
scope.$emit('$stateChangeSuccess');
scope.$digest();
console.info('Directive content : ' + element.text());
expect(element.text()).toContain('State A');
expect(element.text()).toContain('State B');
expect(element.text()).toContain('State C');
expect(element.text()).toContain('State D');
expect(element.children().length).toBe(4);
expect(element.find('a').length).toBe(3);
expect(element.find('a').eq(0).attr('href')).toBe('#/a');
expect(element.find('a').eq(1).attr('href')).toBe('#/a/b');
expect(element.find('a').eq(2).attr('href')).toBe('#/a/b/c');
}));
it('should work with one state', inject(function() {
goToState('A');
scope.$emit('$stateChangeSuccess');
scope.$digest();
console.info('Directive content : ' + element.text());
expect(element.text()).toContain('State A');
expect(element.children().length).toBe(1);
expect(element.find('a').length).toBe(0);
}));
});