Skip to content

Commit 45eb170

Browse files
authored
Merge pull request #2212 from kush-savani/issue2185
fix: set default aria-label for breadcrumb nav
2 parents 18dc480 + 5d0b098 commit 45eb170

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

src/breadcrumb/breadcrumb.component.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Component } from "@angular/core";
22
import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
33
import { async, ComponentFixture, TestBed } from "@angular/core/testing";
44
import { FormsModule } from "@angular/forms";
5+
import { I18nModule } from "../i18n/index";
56
import { By } from "@angular/platform-browser";
67
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from "@angular/platform-browser-dynamic/testing";
78

@@ -61,7 +62,10 @@ describe("Breadcrumb", () => {
6162
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
6263

6364
TestBed.configureTestingModule({
64-
imports: [FormsModule],
65+
imports: [
66+
FormsModule,
67+
I18nModule
68+
],
6569
schemas: [CUSTOM_ELEMENTS_SCHEMA],
6670
declarations: [
6771
Breadcrumb,

src/breadcrumb/breadcrumb.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import {
1212

1313
import { BreadcrumbItem } from "./breadcrumb-item.interface";
1414
import { BreadcrumbItemComponent } from "./breadcrumb-item.component";
15-
import { DomSanitizer } from "@angular/platform-browser";
1615
import { Router } from "@angular/router";
16+
import { I18n } from "carbon-components-angular/i18n";
1717

1818
const MINIMUM_OVERFLOW_THRESHOLD = 4;
1919

@@ -122,7 +122,7 @@ export class Breadcrumb implements AfterContentInit {
122122

123123
@Input() noTrailingSlash = false;
124124

125-
@Input() ariaLabel: string;
125+
@Input() ariaLabel: string = this.i18n.get().BREADCRUMB.LABEL;
126126

127127
@Input()
128128
set skeleton(value: any) {
@@ -181,7 +181,7 @@ export class Breadcrumb implements AfterContentInit {
181181
protected _threshold: number;
182182
protected _skeleton = false;
183183

184-
constructor(protected domSanitizer: DomSanitizer, @Optional() protected router: Router) { }
184+
constructor(protected i18n: I18n, @Optional() protected router: Router) { }
185185

186186
ngAfterContentInit() {
187187
this.updateChildren();

src/breadcrumb/breadcrumb.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { NgModule } from "@angular/core";
22
import { CommonModule } from "@angular/common";
33

44
import { DialogModule } from "carbon-components-angular/dialog";
5+
import { I18nModule } from "carbon-components-angular/i18n";
56

67
import { Breadcrumb } from "./breadcrumb.component";
78
import { BreadcrumbItemComponent } from "./breadcrumb-item.component";
@@ -17,7 +18,8 @@ import { BreadcrumbItemComponent } from "./breadcrumb-item.component";
1718
],
1819
imports: [
1920
CommonModule,
20-
DialogModule
21+
DialogModule,
22+
I18nModule
2123
]
2224
})
2325
export class BreadcrumbModule { }

src/i18n/en.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ export default {
22
"BANNER": {
33
"CLOSE_BUTTON": "Close alert banner"
44
},
5+
"BREADCRUMB": {
6+
"LABEL": "Breadcrumb"
7+
},
58
"CALENDAR": {
69
"MONTHS": {
710
"JANUARY": "January",

0 commit comments

Comments
 (0)