Skip to content

Commit a18fd7c

Browse files
jesselpalmerjelbourn
authored andcommitted
chore(icon): add e2e tests (#794)
1 parent 8474119 commit a18fd7c

File tree

5 files changed

+44
-1
lines changed

5 files changed

+44
-1
lines changed

e2e/components/icon/icon.e2e.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
describe('icon', () => {
2+
describe('font icons by ligature', () => {
3+
let testIcon: any;
4+
5+
beforeEach(() => {
6+
browser.get('/icon');
7+
testIcon = element(by.id('test-icon'));
8+
});
9+
10+
it('should have the correct aria-label when used', () => {
11+
testIcon.getAttribute('aria-label').then((attr: string) => {
12+
expect(attr).toEqual('favorite');
13+
});
14+
});
15+
16+
it('should have the correct class when used', () => {
17+
testIcon.getAttribute('class').then((attr: string) => {
18+
expect(attr).toEqual('md-24 material-icons');
19+
});
20+
});
21+
22+
it('should have the correct role when used', () => {
23+
testIcon.getAttribute('role').then((attr: string) => {
24+
expect(attr).toEqual('img');
25+
});
26+
});
27+
});
28+
});

src/e2e-app/e2e-app/e2e-app.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<a md-list-item [routerLink]="['button']">Button</a>
22
<a md-list-item [routerLink]="['tabs']">Tabs</a>
3+
<a md-list-item [routerLink]="['icon']">Icon</a>
34

45
<router-outlet></router-outlet>

src/e2e-app/e2e-app/routes.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ import {provideRouter, RouterConfig} from '@angular/router';
22
import {Home} from './e2e-app';
33
import {ButtonE2E} from '../button/button-e2e';
44
import {BasicTabs} from '../tabs/tabs-e2e';
5-
5+
import {IconE2E} from '../icon/icon-e2e';
66

77
export const routes: RouterConfig = [
88
{path: '', component: Home},
99
{path: 'button', component: ButtonE2E},
1010
{path: 'tabs', component: BasicTabs},
11+
{path: 'icon', component: IconE2E}
1112
];
1213

1314
export const E2E_APP_ROUTE_PROVIDER = provideRouter(routes);

src/e2e-app/icon/icon-e2e.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<section>
2+
<md-icon class="md-24" id="test-icon">favorite</md-icon>
3+
</section>

src/e2e-app/icon/icon-e2e.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import {Component} from '@angular/core';
2+
import {MD_ICON_DIRECTIVES} from '@angular2-material/icon/icon';
3+
4+
@Component({
5+
moduleId: module.id,
6+
selector: 'icon-e2e',
7+
templateUrl: 'icon-e2e.html',
8+
directives: [MD_ICON_DIRECTIVES]
9+
})
10+
export class IconE2E {}

0 commit comments

Comments
 (0)