Skip to content

Commit 2b6e423

Browse files
committed
Revert "Merge pull request #165 from VilledeMontreal/feature/issue#164"
This reverts commit ff321f9, reversing changes made to a591fc3.
1 parent e80a99d commit 2b6e423

File tree

4 files changed

+47
-65
lines changed

4 files changed

+47
-65
lines changed
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
<nav class="bao-breadcrumb-nav" aria-label="Breadcrumb">
2-
<ol #container (cdkObserveContent)="onContentChange()">
3-
<ng-content></ng-content>
4-
</ol>
1+
<nav
2+
#container
3+
class="bao-breadcrumb-nav"
4+
aria-label="Breadcrumb"
5+
(cdkObserveContent)="onContentChange()"
6+
>
7+
<ng-content></ng-content>
58
</nav>

projects/angular-ui/src/lib/breadcrumb/breadcrumb.component.scss

Lines changed: 28 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,44 +9,36 @@ $margin-between-lines: 0.5rem;
99
display: inline-flex;
1010
flex-direction: row;
1111
flex-wrap: wrap;
12-
> ol {
13-
list-style: none;
14-
padding-left: 0;
15-
margin-bottom: 0;
16-
> li {
17-
line-height: 1rem;
18-
display: inline-flex;
19-
margin-bottom: 0;
20-
margin-right: $margin-between-links;
21-
&:last-child {
22-
margin-right: 0;
23-
&:after {
24-
content: none;
25-
}
26-
}
12+
> a {
13+
@include typo-interface-xsmall-bold;
14+
display: inline-flex;
15+
align-items: end;
16+
text-decoration: none;
17+
text-transform: uppercase;
18+
color: $neutral-secondary;
19+
margin-bottom: $margin-between-lines;
20+
margin-right: $margin-between-links;
21+
border-bottom: none;
22+
background-color: $transparent;
23+
&:hover {
24+
color: $action;
25+
}
26+
&:last-child {
27+
margin-right: 0;
2728
&:after {
28-
display: inline-block;
29-
content: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ADB5BD' fill-rule='evenodd'><path d='M12.586 12L9.293 8.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L12.586 12z'/></svg>");
30-
height: $size-xx-small;
31-
width: $size-xx-small;
32-
margin-left: $margin-between-links;
33-
color: $neutral-secondary;
34-
background-color: $transparent;
35-
cursor: default;
36-
flex-shrink: 0;
37-
}
38-
> a {
39-
@include typo-interface-xsmall-bold;
40-
align-items: end;
41-
text-decoration: none;
42-
text-transform: uppercase;
43-
color: $neutral-secondary;
44-
border-bottom: none;
45-
background-color: $transparent;
46-
&:hover {
47-
color: $action;
48-
}
29+
content: none;
4930
}
5031
}
32+
&:after {
33+
display: inline-block;
34+
content: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ADB5BD' fill-rule='evenodd'><path d='M12.586 12L9.293 8.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L12.586 12z'/></svg>");
35+
height: $size-xx-small;
36+
width: $size-xx-small;
37+
margin-left: $margin-between-links;
38+
color: $neutral-secondary;
39+
background-color: $transparent;
40+
cursor: default;
41+
flex-shrink: 0;
42+
}
5143
}
5244
}

projects/angular-ui/src/lib/breadcrumb/breadcrumb.component.spec.ts

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,15 @@ describe('BaoBreadcrumbComponent', () => {
3232
);
3333
});
3434

35-
it('should contains the exact html tag and attributes', () => {
36-
const nav = breadcrumbDebugElement.nativeElement.querySelector('nav');
37-
expect(nav).toBeTruthy();
38-
39-
const orderLists =
40-
breadcrumbDebugElement.children[0].nativeElement.querySelector('ol');
41-
expect(orderLists).toBeTruthy();
42-
43-
const lists = breadcrumbDebugElement.children[0].children[0].children;
44-
lists.forEach((el: DebugElement) => {
45-
expect(el.name).toBe('LI');
46-
expect(el.nativeElement.querySelector('a')).toBeTruthy();
35+
it('should apply appropriate attribute on navigation elements', () => {
36+
const navElements = Array.from(
37+
breadcrumbDebugElement.childNodes[0].nativeNode.childNodes
38+
);
39+
const lastElement = navElements.pop() as Element;
40+
navElements.forEach((el: Element) => {
41+
expect(el.ariaCurrent).toBe(null);
4742
});
48-
49-
const lastLink = lists.slice(-1).pop();
50-
expect(lastLink.children[0].nativeElement.ariaCurrent).toBe('page');
43+
expect(lastElement.ariaCurrent).toBe('page');
5144
});
5245
});
5346
});

projects/angular-ui/src/lib/breadcrumb/breadcrumb.component.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,17 @@ const LAST_NODE_ATTRIBUTE = { 'aria-current': 'page' };
2626
export class BaoBreadcrumbComponent implements AfterViewInit {
2727
@ViewChild('container', { static: false })
2828
private staticContainer: ElementRef;
29+
2930
constructor(private renderer: Renderer2) {}
31+
3032
public ngAfterViewInit() {
31-
this.createLiElement();
32-
}
33-
public onContentChange() {
3433
this.setLastLinkAttribute();
3534
}
3635

37-
private createLiElement() {
38-
const children = Array.from(this.staticContainer.nativeElement.children);
36+
public onContentChange() {
3937
this.setLastLinkAttribute();
40-
children.forEach(c => {
41-
const liElement = this.renderer.createElement('li');
42-
this.renderer.appendChild(liElement, c);
43-
this.renderer.appendChild(this.staticContainer.nativeElement, liElement);
44-
});
4538
}
39+
4640
private setLastLinkAttribute() {
4741
const children = Array.from(this.staticContainer.nativeElement.children);
4842
this.renderer.setAttribute(

0 commit comments

Comments
 (0)