parent
90c223591f
commit
a006c1418a
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import {LocationStrategy} from '@angular/common';
|
||||
import {Directive, HostBinding, HostListener, Input, OnChanges, OnDestroy} from '@angular/core';
|
||||
import {Attribute, Directive, ElementRef, HostBinding, HostListener, Input, OnChanges, OnDestroy, Renderer} from '@angular/core';
|
||||
import {Subscription} from 'rxjs/Subscription';
|
||||
|
||||
import {NavigationEnd, Router} from '../router';
|
||||
|
@ -89,7 +89,13 @@ export class RouterLink {
|
|||
@Input() replaceUrl: boolean;
|
||||
private commands: any[] = [];
|
||||
|
||||
constructor(private router: Router, private route: ActivatedRoute) {}
|
||||
constructor(
|
||||
private router: Router, private route: ActivatedRoute,
|
||||
@Attribute('tabindex') tabIndex: string, renderer: Renderer, el: ElementRef) {
|
||||
if (tabIndex == null) {
|
||||
renderer.setElementAttribute(el.nativeElement, 'tabindex', '0');
|
||||
}
|
||||
}
|
||||
|
||||
@Input()
|
||||
set routerLink(data: any[]|string) {
|
||||
|
|
|
@ -1031,8 +1031,9 @@ describe('Integration', () => {
|
|||
advance(fixture);
|
||||
expect(fixture.nativeElement).toHaveText('team 22 [ link, right: ]');
|
||||
|
||||
const native = fixture.nativeElement.querySelector('button');
|
||||
native.click();
|
||||
const button = fixture.nativeElement.querySelector('button');
|
||||
expect(button.getAttribute('tabindex')).toEqual('0');
|
||||
button.click();
|
||||
advance(fixture);
|
||||
|
||||
expect(fixture.nativeElement).toHaveText('team 33 [ simple, right: ]');
|
||||
|
|
|
@ -249,7 +249,7 @@ export declare class RouterLink {
|
|||
routerLink: any[] | string;
|
||||
skipLocationChange: boolean;
|
||||
urlTree: UrlTree;
|
||||
constructor(router: Router, route: ActivatedRoute);
|
||||
constructor(router: Router, route: ActivatedRoute, tabIndex: string, renderer: Renderer, el: ElementRef);
|
||||
onClick(): boolean;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue