Skip to content

Commit

Permalink
chore(icon): add e2e tests (#794)
Browse files Browse the repository at this point in the history
  • Loading branch information
jesselpalmer authored and jelbourn committed Jul 11, 2016
1 parent 8474119 commit a18fd7c
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 1 deletion.
28 changes: 28 additions & 0 deletions e2e/components/icon/icon.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
describe('icon', () => {
describe('font icons by ligature', () => {
let testIcon: any;

beforeEach(() => {
browser.get('/icon');
testIcon = element(by.id('test-icon'));
});

it('should have the correct aria-label when used', () => {
testIcon.getAttribute('aria-label').then((attr: string) => {
expect(attr).toEqual('favorite');
});
});

it('should have the correct class when used', () => {
testIcon.getAttribute('class').then((attr: string) => {
expect(attr).toEqual('md-24 material-icons');
});
});

it('should have the correct role when used', () => {
testIcon.getAttribute('role').then((attr: string) => {
expect(attr).toEqual('img');
});
});
});
});
1 change: 1 addition & 0 deletions src/e2e-app/e2e-app/e2e-app.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<a md-list-item [routerLink]="['button']">Button</a>
<a md-list-item [routerLink]="['tabs']">Tabs</a>
<a md-list-item [routerLink]="['icon']">Icon</a>

<router-outlet></router-outlet>
3 changes: 2 additions & 1 deletion src/e2e-app/e2e-app/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import {provideRouter, RouterConfig} from '@angular/router';
import {Home} from './e2e-app';
import {ButtonE2E} from '../button/button-e2e';
import {BasicTabs} from '../tabs/tabs-e2e';

import {IconE2E} from '../icon/icon-e2e';

export const routes: RouterConfig = [
{path: '', component: Home},
{path: 'button', component: ButtonE2E},
{path: 'tabs', component: BasicTabs},
{path: 'icon', component: IconE2E}
];

export const E2E_APP_ROUTE_PROVIDER = provideRouter(routes);
3 changes: 3 additions & 0 deletions src/e2e-app/icon/icon-e2e.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<section>
<md-icon class="md-24" id="test-icon">favorite</md-icon>
</section>
10 changes: 10 additions & 0 deletions src/e2e-app/icon/icon-e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {Component} from '@angular/core';
import {MD_ICON_DIRECTIVES} from '@angular2-material/icon/icon';

@Component({
moduleId: module.id,
selector: 'icon-e2e',
templateUrl: 'icon-e2e.html',
directives: [MD_ICON_DIRECTIVES]
})
export class IconE2E {}

0 comments on commit a18fd7c

Please sign in to comment.