Class ZCircusByAbstract

Represents a by query language to query the driver by selectors.

Constructors

Methods

Constructors

Methods

  • Finds all components that match a given selector.

    Type Parameters

    Parameters

    • driver: IZCircusDriver

      The driver to search.

    • CircusComponentModel: ZCircusComponentConstructor<T>

      The model to construct.

    • selector: string = CircusComponentModel.Selector

      The optional selector to query. If this is falsy, the the component model internal selector is used.

    Returns Promise<T[]>

  • Queries the driver by a specific css selector and returns the first item found.

    Type Parameters

    Parameters

    • driver: IZCircusDriver

      The root driver to query.

    • CircusComponentModel: ZCircusComponentConstructor<T>

      The model type to construct using the child driver.

    • selector: string

      The css target selector that describes the root of the CircusComponentModel

    Returns Promise<T>

    A new instance of CircusComponentModel. If no target is found, then this method rejects with an Error.

  • Returns the first discovered component model that matches the inner Selector.

    Type Parameters

    Parameters

    • driver: IZCircusDriver

      The driver to query.

    • CircusComponentModel: ZCircusComponentConstructor<T>

      The component model to construct.

    • Optionalname: string

      The optional name. If this is falsy, then the basic selector is used, otherwise the first component that matches the selector that also has a "name" or "data-name" attribute with the matching value.

    Returns Promise<T>

    A new instance of CircusComponentModel. If no target is found, then this method rejects with an Error.

  • Same as first, but returns null if no such component exists.

    Type Parameters

    Parameters

    Returns Promise<null | T>

    The first component that matches or null if no such component exists.