test(router): add a test checking that guards work for child routes

This commit is contained in:
vsavkin
2016-06-15 15:45:42 -07:00
parent 9a67f38728
commit cdbf67ee05
3 changed files with 40 additions and 5 deletions

View File

@ -1,5 +1,5 @@
import {Directive, HostBinding, HostListener, Input, OnChanges} from '@angular/core';
import {LocationStrategy} from '@angular/common';
import {Directive, HostBinding, HostListener, Input, OnChanges} from '@angular/core';
import {Router} from '../router';
import {ActivatedRoute} from '../router_state';
@ -47,7 +47,9 @@ export class RouterLink implements OnChanges {
/**
* @internal
*/
constructor(private router: Router, private route: ActivatedRoute, private locationStrategy: LocationStrategy) {}
constructor(
private router: Router, private route: ActivatedRoute,
private locationStrategy: LocationStrategy) {}
@Input()
set routerLink(data: any[]|string) {
@ -60,7 +62,7 @@ export class RouterLink implements OnChanges {
ngOnChanges(changes: {}): any { this.updateTargetUrlAndHref(); }
@HostListener("click", ["$event.button", "$event.ctrlKey", "$event.metaKey"])
@HostListener('click', ['$event.button', '$event.ctrlKey', '$event.metaKey'])
onClick(button: number, ctrlKey: boolean, metaKey: boolean): boolean {
if (button !== 0 || ctrlKey || metaKey) {
return true;