@skyux/core
Version:
This library was generated with [Nx](https://nx.dev).
230 lines (212 loc) • 7.34 kB
TypeScript
import * as i0 from '@angular/core';
import { Provider } from '@angular/core';
import { SkyMediaQueryService, SkyMediaBreakpoints, SkyMediaQueryListener, SkyUIConfigService, SkyBreakpoint } from '@skyux/core';
import { BehaviorSubject, Subscription, Observable } from 'rxjs';
import { BaseHarnessFilters, ComponentHarness, ComponentHarnessConstructor, HarnessPredicate, HarnessQuery, TestElement } from '@angular/cdk/testing';
/**
* @internal
*/
declare class SkyCoreTestingModule {
static ɵfac: i0.ɵɵFactoryDeclaration<SkyCoreTestingModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<SkyCoreTestingModule, never, never, never>;
static ɵinj: i0.ɵɵInjectorDeclaration<SkyCoreTestingModule>;
}
/**
* @internal
* @deprecated Use `provideSkyMediaQueryTesting()` coupled with `SkyMediaQueryTestingController`.
*/
declare class MockSkyMediaQueryService extends SkyMediaQueryService {
static xs: string;
static sm: string;
static md: string;
static lg: string;
get current(): SkyMediaBreakpoints;
set current(breakpoints: SkyMediaBreakpoints);
currentMockSubject: BehaviorSubject<SkyMediaBreakpoints>;
protected currentBreakpoints: SkyMediaBreakpoints;
constructor();
subscribe(listener: SkyMediaQueryListener): Subscription;
fire(args: SkyMediaBreakpoints): void;
destroy(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<MockSkyMediaQueryService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<MockSkyMediaQueryService>;
}
/**
* @internal
*/
declare class MockSkyUIConfigService extends SkyUIConfigService {
getConfig(key: string, defaultConfig?: any): Observable<any>;
static ɵfac: i0.ɵɵFactoryDeclaration<MockSkyUIConfigService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<MockSkyUIConfigService>;
}
/**
* @internal
*/
declare const mockResizeObserverEntry: ResizeObserverEntry;
/**
* @internal
*/
declare const mockResizeObserverHandle: {
callback: ResizeObserverCallback;
emit: (entries: ResizeObserverEntry[], observer?: ResizeObserver) => void;
};
/**
* @internal
*/
declare function mockResizeObserver(): void;
/**
* Provides mocks for file reader testing.
* @internal
* @example
* ```typescript
* TestBed.configureTestingModule({
* providers: [provideSkyFileReaderTesting()]
* });
* ```
*/
declare function provideSkyFileReaderTesting(): Provider[];
/**
* Provides methods for validating global help in unit tests.
*/
declare class SkyHelpTestingController {
#private;
/**
* Validates the current help key and throws an error if the current help key does not match the expected help key.
* @param expectedHelpKey The expected help key.
*/
expectCurrentHelpKey(expectedHelpKey: string | undefined): void;
/**
* Close the current help.
*/
closeHelp(): void;
}
/**
* Mocks SkyHelpService to enable testing of global help.
*/
declare class SkyHelpTestingModule {
static ɵfac: i0.ɵɵFactoryDeclaration<SkyHelpTestingModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<SkyHelpTestingModule, never, never, never>;
static ɵinj: i0.ɵɵInjectorDeclaration<SkyHelpTestingModule>;
}
/**
* A controller to be injected into tests, which mocks the
* `SkyMediaQueryService` and handles interactions with breakpoints.
*/
declare class SkyMediaQueryTestingController {
#private;
/**
* Emits the provided breakpoint to all subscribers.
*/
setBreakpoint(breakpoint: SkyBreakpoint): void;
static ɵfac: i0.ɵɵFactoryDeclaration<SkyMediaQueryTestingController, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<SkyMediaQueryTestingController>;
}
/**
* Adds mocks to allow interactions with breakpoints in tests.
*/
declare function provideSkyMediaQueryTesting(): Provider[];
/**
* A set of criteria that can be used to filter a list of `SkyComponentHarness` instances.
*/
interface SkyHarnessFilters extends BaseHarnessFilters {
/**
* Only find instances whose `data-sky-id` attribute matches the given value.
*/
dataSkyId?: string | RegExp;
}
/**
* @internal
*/
declare abstract class SkyComponentHarness extends ComponentHarness {
#private;
protected static getDataSkyIdPredicate<T extends SkyComponentHarness>(this: ComponentHarnessConstructor<T>, filters: SkyHarnessFilters): HarnessPredicate<T>;
}
/**
* @internal
*/
declare abstract class SkyQueryableComponentHarness extends SkyComponentHarness {
/**
* Returns a child harness or throws an error if not found.
*/
queryHarness<T extends ComponentHarness>(query: HarnessQuery<T>): Promise<T>;
/**
* Returns a child harness or null if not found.
*/
queryHarnessOrNull<T extends ComponentHarness>(query: HarnessQuery<T>): Promise<T | null>;
/**
* Returns child harnesses.
*/
queryHarnesses<T extends ComponentHarness>(harness: HarnessQuery<T>): Promise<T[]>;
/**
* Returns a child test element or throws an error if not found.
*/
querySelector(selector: string): Promise<TestElement>;
/**
* Returns a child test element or null if not found.
*/
querySelectorOrNull(selector: string): Promise<TestElement | null>;
/**
* Returns child test elements.
*/
querySelectorAll(selector: string): Promise<TestElement[]>;
}
/**
* A set of criteria that can be used to filter a list of SkyOverlayHarness instances.
* @internal
*/
interface SkyOverlayHarnessFilters extends BaseHarnessFilters {
}
/**
* Harness for interacting with an overlay component in tests.
* @internal
*/
declare class SkyOverlayHarness extends SkyQueryableComponentHarness {
/**
* @internal
*/
static hostSelector: string;
/**
* Gets a `HarnessPredicate` that can be used to search for a
* `SkyOverlayHarness` that meets certain criteria.
*/
static with(filters: SkyOverlayHarnessFilters): HarnessPredicate<SkyOverlayHarness>;
}
declare class SkyHarnessUtility {
static getBackgroundImageUrl(el: TestElement): Promise<string | undefined>;
}
/**
* Harness used to interact with native input elements in tests.
*/
declare class SkyInputHarness extends ComponentHarness {
/**
* Blurs the input.
*/
blur(): Promise<void>;
/**
* Clears the input value.
*/
clear(): Promise<void>;
/**
* Focuses the input.
*/
focus(): Promise<void>;
/**
* Gets the value of the input.
*/
getValue(): Promise<string>;
/**
* Whether the input is disabled.
*/
isDisabled(): Promise<boolean>;
/**
* Whether the input is focused.
*/
isFocused(): Promise<boolean>;
/**
* Sets the value of the input. The value will be set by simulating key
* presses that correspond to the given value.
*/
setValue(value: string): Promise<void>;
}
export { MockSkyMediaQueryService, MockSkyUIConfigService, SkyComponentHarness, SkyCoreTestingModule, SkyHarnessUtility, SkyHelpTestingController, SkyHelpTestingModule, SkyInputHarness, SkyMediaQueryTestingController, SkyOverlayHarness, SkyQueryableComponentHarness, mockResizeObserver, mockResizeObserverEntry, mockResizeObserverHandle, provideSkyFileReaderTesting, provideSkyMediaQueryTesting };
export type { SkyHarnessFilters, SkyOverlayHarnessFilters };