Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(icon): add e2e icon tests #794

Merged
merged 1 commit into from
Jul 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {}