|
1 | 1 | import {async, ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing';
|
2 | 2 | import {Component, ViewChild, ViewChildren, QueryList} from '@angular/core';
|
3 | 3 | import {By} from '@angular/platform-browser';
|
4 |
| -import {dispatchFakeEvent, dispatchMouseEvent, createMouseEvent} from '@angular/cdk/testing'; |
| 4 | +import {dispatchFakeEvent, dispatchMouseEvent} from '@angular/cdk/testing'; |
5 | 5 | import {Direction, Directionality} from '@angular/cdk/bidi';
|
6 | 6 | import {Subject} from 'rxjs';
|
7 | 7 | import {MatTabLink, MatTabNav, MatTabsModule} from '../index';
|
@@ -150,21 +150,15 @@ describe('MatTabNavBar', () => {
|
150 | 150 | .toBe(true, 'Expected element to no longer be keyboard focusable if disabled.');
|
151 | 151 | });
|
152 | 152 |
|
153 |
| - it('should prevent default action for clicks if links are disabled', () => { |
| 153 | + it('should make disabled links unclickable', () => { |
154 | 154 | const tabLinkElement = fixture.debugElement.query(By.css('a')).nativeElement;
|
155 | 155 |
|
156 |
| - const mouseEvent = createMouseEvent('click'); |
157 |
| - spyOn(mouseEvent, 'preventDefault'); |
158 |
| - tabLinkElement.dispatchEvent(mouseEvent); |
159 |
| - expect(mouseEvent.preventDefault).not.toHaveBeenCalled(); |
| 156 | + expect(getComputedStyle(tabLinkElement).pointerEvents).not.toBe('none'); |
160 | 157 |
|
161 | 158 | fixture.componentInstance.disabled = true;
|
162 | 159 | fixture.detectChanges();
|
163 | 160 |
|
164 |
| - const mouseEventWhileDisabled = createMouseEvent('click'); |
165 |
| - spyOn(mouseEventWhileDisabled, 'preventDefault'); |
166 |
| - tabLinkElement.dispatchEvent(mouseEventWhileDisabled); |
167 |
| - expect(mouseEventWhileDisabled.preventDefault).toHaveBeenCalled(); |
| 161 | + expect(getComputedStyle(tabLinkElement).pointerEvents).toBe('none'); |
168 | 162 | });
|
169 | 163 |
|
170 | 164 | it('should show ripples for tab links', () => {
|
|
0 commit comments