-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds localization to dropdowns and bookmarks menu
- Loading branch information
Showing
11 changed files
with
87 additions
and
8 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
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,48 @@ | ||
import { Component, Type } from "@angular/core"; | ||
import { ComponentFixture, TestBed } from "@angular/core/testing"; | ||
import { FormsModule } from "@angular/forms"; | ||
import { By } from "@angular/platform-browser"; | ||
import { I18nTestingModule } from "@batch-flask/core/testing"; | ||
import { ButtonsModule } from "../buttons"; | ||
import { DropdownComponent } from "./dropdown.component"; | ||
|
||
describe("DropdownComponent", () => { | ||
let fixture: ComponentFixture<Component>; | ||
|
||
function createComponent(comp: Type<Component>) { | ||
TestBed.configureTestingModule({ | ||
imports: [FormsModule, ButtonsModule, I18nTestingModule], | ||
declarations: [DropdownComponent, comp], | ||
}); | ||
fixture = TestBed.createComponent(comp); | ||
fixture.detectChanges(); | ||
} | ||
|
||
function $(selector) { | ||
return fixture.debugElement.query(By.css("bl-dropdown")) | ||
.nativeElement.querySelector(selector); | ||
} | ||
|
||
it("uses a default title", () => { | ||
createComponent(TestComponent); | ||
|
||
expect($(".dropdown-btn-container").getAttribute("title")) | ||
.toEqual("dropdown.button-title"); | ||
}); | ||
it("uses a host button title", () => { | ||
createComponent(TestComponentWithButton); | ||
|
||
expect($(".dropdown-btn-container").getAttribute("title")) | ||
.toEqual("Host title"); | ||
}); | ||
}); | ||
|
||
@Component({ template: `<bl-dropdown [title]="title"></bl-dropdown>` }) | ||
class TestComponent { } | ||
|
||
@Component({ | ||
template: `<bl-dropdown [title]="title"> | ||
<div bl-dropdown-btn button-title="Host title">Button</div> | ||
</bl-dropdown>` | ||
}) | ||
class TestComponentWithButton { } |
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,2 @@ | ||
dropdown: | ||
button-title: Dropdown button |
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
3 changes: 3 additions & 0 deletions
3
src/@batch-flask/ui/sidebar/sidebar-bookmarks/sidebar-bookmarks.i18n.yml
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,3 @@ | ||
sidebar-bookmarks: | ||
dropdown-button-title: Toggle bookmarks menu | ||
no-references: No bookmark references |
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