import { ProviderToken } from '@angular/core'; import { NgtxElement } from '../core'; import { Maybe } from '../types'; import { CallOptions, CallSiteResolver, CssClass, EmissionOptions, EventDispatcher, Events, ExtensionFn, HtmlPropertiesOf, PropertiesOf, TargetRef, Token } from './types'; export declare const nativeEvent: (eventNameOrInstance: Events | Event) => (subject: NgtxElement) => void; export declare const componentMethod: (element: NgtxElement) => T; export declare const classMember: (name: P) => (element: NgtxElement) => T[P]; export declare const nativeMethod: (element: NgtxElement) => T; export declare const injected: (type: Token) => (element: NgtxElement) => T; export declare const debug: (opts?: DebugOptions) => ExtensionFn; export declare const clicked: (opts?: ClickOptions) => ExtensionFn; /** * Resolves the specified token from Angular's dependency injection and provides an API to further * work with that resolved instance. E.g. allows to change state or emit values on `Subject`s * (see examples below). * * --- * ### Examples * * ~~~ts * // setting state: * When(host).has(provider(AuthService).withState({ user: { name: 'Ann' } }))... * // emitting data on a subject located on that token: * When(host).has(provider(AuthService).emittingOnProperty$('user$', userObj))... * // emitting data on a token which itself is a kind of rxjs Subject: * When(host).has(provider(CurrentUser$).emitting$(userObj))... * ~~~ * * --- * @param provider The token to resolve from dependency injection and then work with. * @returns An api that allows to work with the resolved token. */ export declare const provider: (provider: ProviderToken) => { /** * Sets the specified state on the resolved token instance and calls the change detection afterwards. * * --- * ### Example * * ~~~ts * // setting state: * When(host).has(provider(AuthService).withState({ isLoggedIn: true }))... * ~~~ * --- * @param stateDef The state to set on the resolved token instance. */ withState: (stateDef: Partial>) => import("./types").ExtensionFnSignature & import("./types").ExtensionFnMarker; /** * Emits the given data on the specified property (which must be some kind of rxjs `Subject`) * and calls change detection after each emission. * * --- * ### Example * * ~~~ts * // emitting data on a subject located on that token: * When(host).has(provider(AuthService).emittingOnProperty$('isLoggedIn$', true))... * ~~~ * * --- * @param property The name of the property to emit data on (must be some kind of `Subject`) * @param value (Optional) The value that should be emitted on the property. */ emittingOnProperty$: (property: I, value?: any) => import("./types").ExtensionFnSignature & import("./types").ExtensionFnMarker; /** * Takes the given value and emits it on the resolved token instance, which must be some kind of rxjs `Subject` * and calls change detection after each emission. * * --- * ### Example * * ~~~ts * // emitting data on a token which itself is a kind of rxjs Subject: * When(host).has(provider(CurrentUser$).emitting$({ * name: 'Ann Smith', * email: 'ann.smith@company.com', * }))... * ~~~ * * --- * @param value The value to emit on the token (that itself must be some kind of rxjs `Subject`). */ emitting$: (value?: any) => import("./types").ExtensionFnSignature & import("./types").ExtensionFnMarker; }; export declare const detectChanges: (opts?: DetectChangesOptions) => import("./types").ExtensionFnSignature & import("./types").ExtensionFnMarker; export declare const callLifeCycleHook: (hooks: LifeCycleHookCalls) => ExtensionFn; export declare const waitFakeAsync: (durationOrMs?: "animationFrame" | number) => import("./types").ExtensionFnSignature & import("./types").ExtensionFnMarker; export declare const call: (resolver: CallSiteResolver, methodName: keyof Out, args?: any[]) => ExtensionFn; export declare const emit: (eventNameOrDispatcher: Events | EventDispatcher, arg?: any) => ExtensionFn; export declare const attributes: (stateDef: HtmlPropertiesOf | HtmlPropertiesOf[]) => ExtensionFn; export declare const state: (stateDef: PropertiesOf | PropertiesOf[]) => ExtensionFn; export declare const haveStyle: (styles: Partial | Partial[]) => import("./types").ExtensionFnSignature & import("./types").ExtensionFnMarker; export declare const haveCssClass: (cssClasses: CssClass | (CssClass | string[])[]) => ExtensionFn; export declare const beMissing: () => ExtensionFn; export declare const beFound: (opts?: FindingOptions) => ExtensionFn; interface haveCalledFn { (resolver: CallSiteResolver, methodName: keyof Out, opts?: CallOptions): ExtensionFn; (spy: T, opts?: CallOptions): ExtensionFn; } export declare const haveCalled: haveCalledFn; export declare const haveEmitted: (eventName: Events, opts?: EmissionOptions) => ExtensionFn; export declare const containText: (texts: Maybe | Maybe[] | ((index: number) => string)) => ExtensionFn; export declare const haveText: (texts: Maybe | Maybe[] | ((index: number) => string)) => ExtensionFn; export declare const haveAttributes: (stateDef: HtmlPropertiesOf | HtmlPropertiesOf[] | ((index: number) => HtmlPropertiesOf)) => ExtensionFn; export declare const haveState: (stateDef: PropertiesOf | PropertiesOf[] | ((index: number) => PropertiesOf)) => ExtensionFn; export interface DebugOptions { stateOf?: TargetRef; attributesOf?: TargetRef; attributeFilter?: (attributeName: string) => boolean; } export interface DetectChangesOptions { viaChangeDetectorRef?: boolean; } export interface ClickOptions { /** The number of click-events to emit. */ times?: number; /** Whether to call the nativeElement's click method. Defaults to `false`. */ nativeClick?: boolean; /** * The event-argument emitted by the click event. Defaults to `undefined` (none). * * --- * **Please Note:** Only takes effect when `nativeClick` has the value `false`. */ eventArgs?: any; } export interface FindingOptions { times?: number; } export interface LifeCycleHookCalls { ngOnInit?: boolean; ngOnChanges?: boolean | PropertiesOf; ngAfterViewInit?: boolean; ngAfterContentInit?: boolean; ngOnDestroy?: boolean; } export declare function assertEmission(spy: any, opts: EmissionOptions, negate?: boolean): void; export declare function assertCall(spy: any, opts: CallOptions, negate?: boolean): void; export {};