@skyux/modals
Version:
This library was generated with [Nx](https://nx.dev).
294 lines (282 loc) • 8.9 kB
TypeScript
import { ComponentFixture } from '@angular/core/testing';
import { BaseHarnessFilters, ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
import { SkyConfirmButtonStyleType, SkyConfirmType, SkyConfirmConfig, SkyConfirmCloseEventArgs, SkyModalCloseArgs } from '@skyux/modals';
import { SkyComponentHarness, SkyHarnessFilters } from '@skyux/core/testing';
import * as i0 from '@angular/core';
import { Type } from '@angular/core';
/**
* Allows interaction with a SKY UX modal component.
* @deprecated Use `SkyModalHarness` instead.
* @internal
*/
declare class SkyModalFixture {
#private;
constructor(fixture: ComponentFixture<unknown>, skyTestId: string);
/**
* The modal component's ARIA describedby attribute.
*/
get ariaDescribedBy(): string | undefined;
/**
* The modal component's ARIA labelledby attribute.
*/
get ariaLabelledBy(): string | undefined;
/**
* The modal component's role attribute.
*/
get ariaRole(): string | undefined;
/**
* Whether or not the modal is a full page modal.
*/
get fullPage(): boolean;
/**
* The size of the modal.
*/
get size(): string | undefined;
/**
* Whether or not the modal is set up for tiled content.
*/
get tiledBody(): boolean;
/**
* Clicks the modal header's "close" button.
*/
clickHeaderCloseButton(): void;
/**
* Clicks the modal header's "help" button.
*/
clickHelpButton(): void;
/**
* Returns the main modal element.
*/
getModalDiv(): any;
/**
* Returns the modal's content element.
*/
getModalContentEl(): any;
/**
* Returns the modal's footer element.
*/
getModalFooterEl(): any;
/**
* Returns the modal's header element.
*/
getModalHeaderEl(): any;
}
/**
* A set of criteria that can be used to filter a list of SkyConfirmButtonHarness instances.
*/
interface SkyConfirmButtonHarnessFilters extends Omit<BaseHarnessFilters, 'selector'> {
/**
* Only find instances whose content matches the given value.
*/
text?: string | RegExp;
/**
* Only find instances whose style matches the given value.
*/
styleType?: string;
}
/**
* Harness for interacting with a confirm component in tests.
*/
declare class SkyConfirmButtonHarness extends ComponentHarness {
/**
* @internal
*/
static hostSelector: string;
/**
* Gets a `HarnessPredicate` that can be used to search for a
* `SkyConfirmButtonHarness` that meets certain criteria.
*/
static with(filters: SkyConfirmButtonHarnessFilters): HarnessPredicate<SkyConfirmButtonHarness>;
/**
* Clicks the confirm button.
*/
click(): Promise<void>;
/**
* Gets the button style of the confirm button.
*/
getStyleType(): Promise<SkyConfirmButtonStyleType>;
/**
* Gets the text content of the confirm button.
*/
getText(): Promise<string>;
}
/**
* Harness for interacting with a confirm component in tests.
*/
declare class SkyConfirmHarness extends SkyComponentHarness {
#private;
/**
* @internal
*/
static hostSelector: string;
/**
* Clicks a confirm button.
*/
clickCustomButton(filters: SkyConfirmButtonHarnessFilters): Promise<void>;
/**
* Clicks a confirm button.
*/
clickOkButton(): Promise<void>;
/**
* Gets the body of the confirm component.
*/
getBodyText(): Promise<string | undefined>;
/**
* Gets a specific confirm custom button based on the filter criteria.
* @param filter The filter criteria.
*/
getCustomButton(filter: SkyConfirmButtonHarnessFilters): Promise<SkyConfirmButtonHarness>;
/**
* Gets an array of confirm custom buttons based on the filter criteria.
* If no filter is provided, returns all confirm custom buttons.
* @param filters The optional filter criteria.
*/
getCustomButtons(filters?: SkyConfirmButtonHarnessFilters): Promise<SkyConfirmButtonHarness[]>;
/**
* Gets the message of the confirm component.
*/
getMessageText(): Promise<string>;
/**
* Gets the type of the confirm component.
*/
getType(): Promise<SkyConfirmType>;
/**
* Whether the whitespace is preserved on the confirm component.
*/
isWhiteSpacePreserved(): Promise<boolean>;
}
/**
* A controller to be injected into tests, which mocks the confirm service
* and handles interactions with confirm dialogs.
*/
declare abstract class SkyConfirmTestingController {
/**
* Closes the confirm dialog with the "cancel" action.
*/
abstract cancel(): void;
/**
* Throws if a confirm dialog is open.
*/
abstract expectNone(): void;
/**
* Throws if the open confirm dialog does not match the provided configuration.
* @param config
*/
abstract expectOpen(config: SkyConfirmConfig): void;
/**
* Closes the confirm dialog with the provided action.
*/
abstract close(args: SkyConfirmCloseEventArgs): void;
/**
* Closes the confirm dialog with the "ok" action.
*/
abstract ok(): void;
}
/**
* Configures the `SkyConfirmTestingController` as the backend for the `SkyConfirmService`.
*/
declare class SkyConfirmTestingModule {
static ɵfac: i0.ɵɵFactoryDeclaration<SkyConfirmTestingModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<SkyConfirmTestingModule, never, never, never>;
static ɵinj: i0.ɵɵInjectorDeclaration<SkyConfirmTestingModule>;
}
/**
* A controller to be injected into tests, which mocks the modal service
* and handles interactions with modal instances. For testing interactions
* with the modal component itself, use the `SkyModalHarness`.
*/
declare abstract class SkyModalTestingController {
/**
* Closes the topmost modal with the provided arguments.
* @param args Arguments to pass to the modal's close event.
*/
abstract closeTopModal(args?: SkyModalCloseArgs): void;
/**
* Throws if the provided value does not match the number of open modals.
*/
abstract expectCount(value: number): void;
/**
* Throws if modals are open.
*/
abstract expectNone(): void;
/**
* Throws if the given criteria does not match the topmost open modal.
*/
abstract expectOpen<TComponent>(component: Type<TComponent>): void;
}
/**
* Configures the `SkyModalTestingController` as the implementation for the `SkyModalService`.
*/
declare class SkyModalTestingModule {
static ɵfac: i0.ɵɵFactoryDeclaration<SkyModalTestingModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<SkyModalTestingModule, never, never, never>;
static ɵinj: i0.ɵɵInjectorDeclaration<SkyModalTestingModule>;
}
/**
* A set of criteria that can be used to filter a list of SkyModalHarness instances.
*/
interface SkyModalHarnessFilters extends SkyHarnessFilters {
}
/**
* Harness for interacting with a modal component in tests.
*/
declare class SkyModalHarness extends SkyComponentHarness {
#private;
/**
* @internal
*/
static hostSelector: string;
/**
* Gets a `HarnessPredicate` that can be used to search for a
* `SkyModalHarness` that meets certain criteria
*/
static with(filters: SkyModalHarnessFilters): HarnessPredicate<SkyModalHarness>;
/**
* Clicks the help inline button.
*/
clickHelpInline(): Promise<void>;
/**
* Gets the aria-describedBy property of the modal.
* @deprecated
*/
getAriaDescribedBy(): Promise<string | null>;
/**
* Gets the aria-labelledBy property of the modal.
* @deprecated
*/
getAriaLabelledBy(): Promise<string | null>;
/**
* Gets the role of the modal.
*/
getAriaRole(): Promise<string | null>;
/**
* Gets the modal's heading text.
*/
getHeadingText(): Promise<string | undefined>;
/**
* Gets the help popover content.
*/
getHelpPopoverContent(): Promise<string | undefined>;
/**
* Gets the help popover title.
*/
getHelpPopoverTitle(): Promise<string | undefined>;
/**
* Gets the modal size.
*/
getSize(): Promise<string>;
/**
* Gets the wrapper class of the modal.
*/
getWrapperClass(): Promise<string | undefined>;
/**
* Whether the modal is full page.
*/
isFullPage(): Promise<boolean>;
/**
* Whether the modal has {@link SkyModalIsDirtyDirective.isDirty} set to dirty.
*/
isDirty(): Promise<boolean>;
}
export { SkyConfirmButtonHarness, SkyConfirmHarness, SkyConfirmTestingController, SkyConfirmTestingModule, SkyModalFixture, SkyModalHarness, SkyModalTestingController, SkyModalTestingModule };
export type { SkyConfirmButtonHarnessFilters, SkyModalHarnessFilters };