aurelia-testing

  • Version 1.1.0
  • Published
  • 229 kB
  • 5 dependencies
  • MIT license

Install

npm i aurelia-testing
yarn add aurelia-testing
pnpm add aurelia-testing

Overview

A collection of helpers for testing Aurelia apps and components.

Index

Functions

function configure

configure: (config: FrameworkConfiguration) => void;

    function waitFor

    waitFor: <T>(
    getter: () => T,
    options?: { present?: boolean; interval?: number; timeout?: number }
    ) => Promise<T>;
    • Generic function to wait for something to happen. Uses polling

      Parameter getter

      : a getter function that returns anything else than null or an empty array or an empty jQuery object when the condition is met

      Parameter options

      : lookup options, defaults to {present: true, interval: 50, timeout: 5000}

    function waitForDocumentElement

    waitForDocumentElement: (
    selector: string,
    options?: { present?: boolean; interval?: number; timeout?: number }
    ) => Promise<Element>;

      function waitForDocumentElements

      waitForDocumentElements: (
      selector: string,
      options?: { present?: boolean; interval?: number; timeout?: number }
      ) => Promise<NodeListOf<Element>>;

        Classes

        class CompileSpy

        class CompileSpy {}
        • Attribute to be placed on any element to have it emit the View Compiler's TargetInstruction into the debug console, giving you insight into all the parsed bindings, behaviors and event handers for the targeted element.

        constructor

        constructor(element: Element, instruction: TargetInstruction);
        • Creates and instanse of CompileSpy.

          Parameter element

          target element on where attribute is placed on.

          Parameter instruction

          instructions for how the target element should be enhanced.

        class ComponentTester

        class ComponentTester<T = any> {}

          property attached

          attached: () => Promise<void>;

            property bind

            bind: (bindingContext: {}) => Promise<void>;

              property detached

              detached: () => Promise<void>;

                property element

                element: Element;

                  property unbind

                  unbind: () => Promise<void>;

                    property viewModel

                    viewModel: {};

                      method bootstrap

                      bootstrap: (configure: (aurelia: Aurelia) => FrameworkConfiguration) => void;

                        method boundTo

                        boundTo: (bindingContext: {}) => this;

                          method configure

                          configure: (aurelia: Aurelia) => FrameworkConfiguration;

                            method create

                            create: (
                            bootstrap: (configure: (aurelia: Aurelia) => Promise<void>) => Promise<void>
                            ) => Promise<void>;

                              method dispose

                              dispose: () => Element;

                                method inView

                                inView: (html: string) => this;

                                  method manuallyHandleLifecycle

                                  manuallyHandleLifecycle: () => this;

                                    method waitForElement

                                    waitForElement: (
                                    selector: string,
                                    options?: { present?: boolean; interval?: number; timeout?: number }
                                    ) => Promise<Element>;

                                      method waitForElements

                                      waitForElements: (
                                      selector: string,
                                      options?: { present?: boolean; interval?: number; timeout?: number }
                                      ) => Promise<NodeListOf<Element>>;

                                        method withResources

                                        withResources: (resources: string | string[]) => this;

                                          class StageComponent

                                          class StageComponent {}

                                            method withResources

                                            static withResources: <T = any>(
                                            resources?: string | string[]
                                            ) => ComponentTester<T>;

                                              class ViewSpy

                                              class ViewSpy {}
                                              • Attribute to be placed on any HTML element in a view to emit the View instance to the debug console, giving you insight into the live View instance, including all child views, live bindings, behaviors and more.

                                              constructor

                                              constructor();
                                              • Creates a new instance of ViewSpy.

                                              property $resource

                                              static $resource: IStaticResourceConfig;

                                                method attached

                                                attached: () => void;
                                                • Invoked when the target element is attached to the DOM.

                                                method bind

                                                bind: (bindingContext: {}) => void;
                                                • Invoked when the target view is bound.

                                                  Parameter bindingContext

                                                  The target view's binding context.

                                                method created

                                                created: (view: any) => void;
                                                • Invoked when the target view is created.

                                                  Parameter view

                                                  The target view.

                                                method detached

                                                detached: () => void;
                                                • Invoked when the target element is detached from the DOM.

                                                method unbind

                                                unbind: () => void;
                                                • Invoked when the target element is unbound.

                                                Package Files (1)

                                                Dependencies (5)

                                                Dev Dependencies (31)

                                                Peer Dependencies (0)

                                                No peer dependencies.

                                                Badge

                                                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/aurelia-testing.

                                                • Markdown
                                                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/aurelia-testing)
                                                • HTML
                                                  <a href="https://www.jsdocs.io/package/aurelia-testing"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>