From 9f784dcc5a524000836c5e4cd7b3384e21963637 Mon Sep 17 00:00:00 2001 From: vsavkin Date: Tue, 3 May 2016 10:25:14 -0700 Subject: [PATCH] cleanup(router): fix e2e tests --- modules/@angular/router/src/directives/router_link.ts | 10 +++++----- .../playground/e2e_test/alt_routing/routing_spec.ts | 9 ++------- modules/playground/src/alt_routing/app/inbox-app.html | 2 +- modules/playground/src/alt_routing/app/inbox-app.ts | 1 + .../playground/src/alt_routing/app/inbox-detail.html | 2 +- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/modules/@angular/router/src/directives/router_link.ts b/modules/@angular/router/src/directives/router_link.ts index cf2ecaf00b..bb3d9e2343 100644 --- a/modules/@angular/router/src/directives/router_link.ts +++ b/modules/@angular/router/src/directives/router_link.ts @@ -22,7 +22,7 @@ import {ObservableWrapper} from '../facade/async'; @Directive({selector: '[routerLink]'}) export class RouterLink implements OnDestroy { @Input() target: string; - private _comands: any[] = []; + private _commands: any[] = []; private _subscription: any; @HostBinding() href: string; @@ -38,9 +38,9 @@ export class RouterLink implements OnDestroy { @Input() set routerLink(data: any[]|any) { if (isArray(data)) { - this._comands = data; + this._commands = data; } else { - this._comands = [data]; + this._commands = [data]; } this._updateTargetUrlAndHref(); } @@ -49,14 +49,14 @@ export class RouterLink implements OnDestroy { @HostListener("click") onClick(): boolean { if (!isString(this.target) || this.target == '_self') { - this._router.navigate(this._comands, this._routeSegment); + this._router.navigate(this._commands, this._routeSegment); return false; } return true; } private _updateTargetUrlAndHref(): void { - let tree = this._router.createUrlTree(this._comands, this._routeSegment); + let tree = this._router.createUrlTree(this._commands, this._routeSegment); if (isPresent(tree)) { this.href = this._router.serializeUrl(tree); this.isActive = this._router.urlTree.contains(tree); diff --git a/modules/playground/e2e_test/alt_routing/routing_spec.ts b/modules/playground/e2e_test/alt_routing/routing_spec.ts index 2f5bcb3fdb..e3b343eb9d 100644 --- a/modules/playground/e2e_test/alt_routing/routing_spec.ts +++ b/modules/playground/e2e_test/alt_routing/routing_spec.ts @@ -7,12 +7,11 @@ function waitForElement(selector) { } describe('alt-routing inbox-app', () => { + var URL = 'all/playground/src/alt_routing/'; afterEach(verifyNoBrowserErrors); describe('index view', () => { - var URL = 'all/playground/src/alt_routing/'; - it('should list out the current collection of items', () => { browser.get(URL); waitForElement('.inbox-item-record'); @@ -31,8 +30,6 @@ describe('alt-routing inbox-app', () => { describe('drafts view', () => { - var URL = 'all/playground/src/alt_routing/#/drafts'; - it('should navigate to the drafts view when the drafts link is clicked', () => { browser.get(URL); waitForElement('.inbox-item-record'); @@ -55,8 +52,6 @@ describe('alt-routing inbox-app', () => { describe('detail view', () => { - var URL = 'all/playground/src/alt_routing/'; - it('should navigate to the detail view when an email is clicked', () => { browser.get(URL); waitForElement('#item-10'); @@ -83,7 +78,7 @@ describe('alt-routing inbox-app', () => { element(by.css('#item-10')).click(); waitForElement('.sort-button'); element(by.css('.sort-button')).click(); - expect(browser.getCurrentUrl()).toMatch(/\/;sort=date$/); + expect(browser.getCurrentUrl()).toContain(';sort=date'); waitForElement('.inbox-item-record'); expect(element(by.css(".inbox-item-record > a")).getAttribute("id")).toEqual("item-137"); }); diff --git a/modules/playground/src/alt_routing/app/inbox-app.html b/modules/playground/src/alt_routing/app/inbox-app.html index 9952ba9d7f..34880f6b11 100644 --- a/modules/playground/src/alt_routing/app/inbox-app.html +++ b/modules/playground/src/alt_routing/app/inbox-app.html @@ -1,5 +1,5 @@ - Inbox + Inbox Drafts diff --git a/modules/playground/src/alt_routing/app/inbox-app.ts b/modules/playground/src/alt_routing/app/inbox-app.ts index 30267cce3f..08f37791a2 100644 --- a/modules/playground/src/alt_routing/app/inbox-app.ts +++ b/modules/playground/src/alt_routing/app/inbox-app.ts @@ -156,6 +156,7 @@ class DraftsCmp { }) @Routes([ new Route({path: '/', component: InboxCmp}), + new Route({path: '/inbox', component: InboxCmp}), new Route({path: '/drafts', component: DraftsCmp}), new Route({path: '/detail/:id', component: InboxDetailCmp}) ]) diff --git a/modules/playground/src/alt_routing/app/inbox-detail.html b/modules/playground/src/alt_routing/app/inbox-detail.html index dec68799c2..38efc5e60b 100644 --- a/modules/playground/src/alt_routing/app/inbox-detail.html +++ b/modules/playground/src/alt_routing/app/inbox-detail.html @@ -18,7 +18,7 @@
- + View Latest Messages