Skip to content

refactor(platform): change deprecated APIs for version 10 #19347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/cdk/a11y/focus-trap/focus-trap.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Platform} from '@angular/cdk/platform';
import {Component, PLATFORM_ID, ViewChild} from '@angular/core';
import {Component, ViewChild} from '@angular/core';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import {A11yModule, FocusTrap, CdkTrapFocus} from '../index';

Expand Down Expand Up @@ -48,9 +48,9 @@ describe('FocusTrap', () => {
// focus event handler directly.
const result = focusTrapInstance.focusLastTabbableElement();

const platformId = TestBed.inject(PLATFORM_ID);
const platform = TestBed.inject(Platform);
// In iOS button elements are never tabbable, so the last element will be the input.
const lastElement = new Platform(platformId).IOS ? 'input' : 'button';
const lastElement = platform.IOS ? 'input' : 'button';

expect(document.activeElement!.nodeName.toLowerCase())
.toBe(lastElement, `Expected ${lastElement} element to be focused`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import {
HighContrastModeDetector, WHITE_ON_BLACK_CSS_CLASS,
} from './high-contrast-mode-detector';
import {Platform} from '@angular/cdk/platform';
import {inject} from '@angular/core/testing';


describe('HighContrastModeDetector', () => {
let fakePlatform: Platform;

beforeEach(() => {
fakePlatform = new Platform();
});
beforeEach(inject([Platform], (p: Platform) => {
fakePlatform = p;
}));

it('should detect NONE for non-browser platforms', () => {
fakePlatform.isBrowser = false;
Expand Down
Loading