mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
chore(icon): add e2e tests (#794)
This commit is contained in:
committed by
Jeremy Elbourn
parent
8474119d89
commit
a18fd7ccc4
@@ -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,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>
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<section>
|
||||
<md-icon class="md-24" id="test-icon">favorite</md-icon>
|
||||
</section>
|
||||
@@ -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 {}
|
||||
Reference in New Issue
Block a user