-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: change autogenerated to false on dynamically setting a label (#101)
- Loading branch information
1 parent
ad6931e
commit 95506eb
Showing
5 changed files
with
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,35 @@ | ||
describe('simple-demo', () => { | ||
it('should contain breadcrumbs for books', () => { | ||
it('should show breadcrumbs within ngIf', () => { | ||
cy.visit('/'); | ||
// initially within ngIf and not shown | ||
cy.get('xng-breadcrumb').should('not.exist'); | ||
cy.get('button').contains('Toggle Breadcrumb Visibility').click(); | ||
cy.get('xng-breadcrumb').contains('Dashboard'); | ||
}); | ||
|
||
it("shouldn't have default seperator if Home breadcrumb is not defined", () => { | ||
// shouldn't have default seperator if Home breadcrumb is not defined | ||
cy.get('.xng-breadcrumb-list').contains('/').should('not.exist'); | ||
cy.get('a').contains('Order Details').click(); | ||
}); | ||
|
||
// Should show breadcrumbs when routeReuseStrategy is false | ||
it('should show breadcrumbs when routeReuseStrategy is false', () => { | ||
// Dashboard and Order Details use same component and routeReuseStrategy false still should get data | ||
cy.get('a').contains('Order Details').click(); | ||
cy.get('.xng-breadcrumb-list').contains('Order Details').should('exist'); | ||
cy.get('.xng-breadcrumb-list').contains('Company Name').should('exist'); | ||
}); | ||
|
||
it('should show breadcrumbs if dynamically set with autoGenerate false', () => { | ||
cy.get('a').contains('Order Items').click(); | ||
cy.get('.auto-generated-true .xng-breadcrumb-list') | ||
.contains('items') | ||
.should('exist'); | ||
cy.get('.auto-generated-false .xng-breadcrumb-list') | ||
.contains('items') | ||
.should('not.exist'); | ||
cy.get('button').contains('Set Order Items Label').click(); | ||
cy.get('.auto-generated-false .xng-breadcrumb-list') | ||
.contains('My Order Items') | ||
.should('exist'); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,12 +1,20 @@ | ||
<h2>xng-breadcrumb</h2> | ||
<h1>xng-breadcrumb</h1> | ||
<h2>Angular version {{ name }}</h2> | ||
|
||
<div *ngIf="showBreadcrumbs"> | ||
<xng-breadcrumb></xng-breadcrumb> | ||
<xng-breadcrumb class="auto-generated-true"></xng-breadcrumb> | ||
|
||
<h3>Auto generated: false</h3> | ||
<xng-breadcrumb | ||
[autoGenerate]="false" | ||
class="auto-generated-false" | ||
></xng-breadcrumb> | ||
</div> | ||
|
||
<router-outlet></router-outlet> | ||
|
||
<button (click)="toggleBreadcrumbVisibility()"> | ||
Toggle Breadcrumb Visibility | ||
</button> | ||
|
||
<button (click)="setOrderItemsLabel()">Set Order Items Label</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
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