UNPKG

@eclipse-scout/core

Version:
77 lines 3.24 kB
/// <reference types="jquery" /> import { AbstractConstructor, BaseDoEntity, Constructor, DoEntity, HybridActionEvent, Page, Session, Widget } from '../index'; import 'jasmine-ajax'; /** * Utility functions for jasmine tests. */ export declare const JasmineScoutUtil: { /** * @returns the loaded JSON data structure */ loadJsonResource(jsonResourceUrl: string, options?: { useCache?: boolean; }): JQuery.Promise<any>; loadJsonResourceAndMockRestCall(resourceUrlToMock: string, jsonResourceUrl: string, options?: { useCache?: boolean; restriction?: any; method?: string; }): void; mockRestLookupCall(resourceUrlToMock: string, lookupRows: any[], parentRestriction?: any): void; mockRestCall(resourceUrlToMock: string, responseData: any, options?: { restriction?: any; method?: string; /** * Used to serialize the responseData. Default is {@link JSON.stringify}. */ stringify?: (any) => string; }): void; mockDataObjectRestCall(resourceUrlToMock: string, responseData: BaseDoEntity | void, options?: { restriction?: any; method?: string; /** * Used to serialize the responseData. Default is {@link dataObjects.stringify}. */ stringify?: (any) => string; }): void; /** * If an ajax call is not mocked, this fallback will be triggered to show information about which url is not mocked. */ captureNotMockedCalls(): void; /** * Calls the given mock as soon as a hybrid action with the given actionType is called. * The mock is called asynchronously using setTimeout to let the runtime code add any required event listeners first. * * The mock may return an object with [id, widget] if the action is supposed to create widgets. * The format of the id depends on the method used to add widgets: * - `AbstractHybridAction.addWidget(IWidget)` (e.g. `AbstractFormHybridAction`): `${widgetId}` * - `AbstractHybridAction.addWidgets(Map<String, IWidget>)`: `${actionId}${widgetId}` */ mockHybridAction<TData extends DoEntity>(session: Session, actionType: string, mock: (event: HybridActionEvent<TData>) => Record<string, Widget>): void; /** * Asserts that every page has an uuid and a specific {@link PageParamDo}, if required. */ assertPageCompleteness(options?: PageCompletenessOptions): void; }; export type PageCompletenessOptions = { /** * Specifies whether the pages need an uuid. Default is true. */ assertUuid?: boolean; /** * Specifies whether the pages need a pageParam. Default is true. */ assertPageParam?: boolean; /** * Contains the pages that do not require an uuid. */ pagesNotRequiringUuid?: (Constructor<Page> | AbstractConstructor<Page>)[]; /** * Contains the pages that do not require a pageParam, e.g. because the page does not have any parameters. */ pagesNotRequiringPageParam?: (Constructor<Page> | AbstractConstructor<Page>)[]; /** * If specified, only the pages in this namespace are considered. */ namespace?: string; }; //# sourceMappingURL=JasmineScoutUtil.d.ts.map