@s-libs/ng-mat-core
    Preparing search index...

    Class SlDialogHarness

    Harness for interacting with a dialog opened via SlDialogService.open.

    Hierarchy

    • ContentContainerComponentHarness
      • SlDialogHarness
    Index

    Constructors

    • Parameters

      • locatorFactory: LocatorFactory

      Returns SlDialogHarness

    Properties

    locatorFactory: LocatorFactory
    hostSelector: string = 'sl-dialog'

    Methods

    • Gets a LocatorFactory for the document root element. This factory can be used to create locators for elements that a component creates outside of its own root element. (e.g. by appending to document.body).

      Returns LocatorFactory

    • Flushes change detection and async tasks in the Angular zone. In most cases it should not be necessary to call this manually. However, there may be some edge cases where it is needed to fully flush animation events.

      Returns Promise<void>

    • Gets a list of HarnessLoader for each element matching the given selector under the current harness's cotnent that searches for harnesses under that element.

      Parameters

      • selector: string

        The selector for elements in the component's content.

      Returns Promise<HarnessLoader[]>

      A list of HarnessLoader for each element matching the given selector.

    • Gets all matching harnesses for the given query within the current harness's content.

      Type Parameters

      • T extends ComponentHarness

      Parameters

      • query: HarnessQuery<T>

        The harness query to search for.

      Returns Promise<T[]>

      The list of harness matching the given query.

    • Gets a HarnessLoader that searches for harnesses under the first element matching the given selector within the current harness's content.

      Parameters

      • selector: string

        The selector for an element in the component's content.

      Returns Promise<HarnessLoader>

      A HarnessLoader that searches for harnesses under the given selector.

    • Gets the first matching harness for the given query within the current harness's content.

      Type Parameters

      • T extends ComponentHarness

      Parameters

      • query: HarnessQuery<T>

        The harness query to search for.

      Returns Promise<T>

      The first harness matching the given query.

      If no matching harness is found.

    • Gets the first matching harness for the given query within the current harness's content.

      Type Parameters

      • T extends ComponentHarness

      Parameters

      • query: HarnessQuery<T>

        The harness query to search for.

      Returns Promise<null | T>

      The first harness matching the given query, or null if none is found.

    • Gets the root harness loader from which to start searching for content contained by this harness.

      Returns Promise<HarnessLoader>

    • Checks whether there is a matching harnesses for the given query within the current harness's content.

      Type Parameters

      • T extends ComponentHarness

      Parameters

      • query: HarnessQuery<T>

        The harness query to search for.

      Returns Promise<boolean>

      Whetehr there is matching harnesses for the given query.

    • Gets a Promise for the TestElement representing the host element of the component.

      Returns Promise<TestElement>

    • Creates an asynchronous locator function that can be used to find a ComponentHarness instance or element under the host element of this ComponentHarness.

      For example, given the following DOM and assuming DivHarness.hostSelector is 'div'

      <div id="d1"></div><div id="d2"></div>
      

      then we expect:

      await ch.locatorFor(DivHarness, 'div')() // Gets a `DivHarness` instance for #d1
      await ch.locatorFor('div', DivHarness)() // Gets a `TestElement` instance for #d1
      await ch.locatorFor('span')() // Throws because the `Promise` rejects

      Type Parameters

      • T extends (string | HarnessQuery<any>)[]

      Parameters

      • ...queries: T

        A list of queries specifying which harnesses and elements to search for:

        • A string searches for elements matching the CSS selector specified by the string.
        • A ComponentHarness constructor searches for ComponentHarness instances matching the given class.
        • A HarnessPredicate searches for ComponentHarness instances matching the given predicate.

      Returns () => Promise<LocatorFnResult<T>>

      An asynchronous locator function that searches for and returns a Promise for the first element or harness matching the given search criteria. Matches are ordered first by order in the DOM, and second by order in the queries list. If no matches are found, the Promise rejects. The type that the Promise resolves to is a union of all result types for each query.

    • Creates an asynchronous locator function that can be used to find ComponentHarness instances or elements under the host element of this ComponentHarness.

      For example, given the following DOM and assuming DivHarness.hostSelector is 'div' and IdIsD1Harness.hostSelector is '#d1'

      <div id="d1"></div><div id="d2"></div>
      

      then we expect:

      // Gets [DivHarness for #d1, TestElement for #d1, DivHarness for #d2, TestElement for #d2]
      await ch.locatorForAll(DivHarness, 'div')()
      // Gets [TestElement for #d1, TestElement for #d2]
      await ch.locatorForAll('div', '#d1')()
      // Gets [DivHarness for #d1, IdIsD1Harness for #d1, DivHarness for #d2]
      await ch.locatorForAll(DivHarness, IdIsD1Harness)()
      // Gets []
      await ch.locatorForAll('span')()

      Type Parameters

      • T extends (string | HarnessQuery<any>)[]

      Parameters

      • ...queries: T

        A list of queries specifying which harnesses and elements to search for:

        • A string searches for elements matching the CSS selector specified by the string.
        • A ComponentHarness constructor searches for ComponentHarness instances matching the given class.
        • A HarnessPredicate searches for ComponentHarness instances matching the given predicate.

      Returns () => Promise<LocatorFnResult<T>[]>

      An asynchronous locator function that searches for and returns a Promise for all elements and harnesses matching the given search criteria. Matches are ordered first by order in the DOM, and second by order in the queries list. If an element matches more than one ComponentHarness class, the locator gets an instance of each for the same element. If an element matches multiple string selectors, only one TestElement instance is returned for that element. The type that the Promise resolves to is an array where each element is the union of all result types for each query.

    • Creates an asynchronous locator function that can be used to find a ComponentHarness instance or element under the host element of this ComponentHarness.

      For example, given the following DOM and assuming DivHarness.hostSelector is 'div'

      <div id="d1"></div><div id="d2"></div>
      

      then we expect:

      await ch.locatorForOptional(DivHarness, 'div')() // Gets a `DivHarness` instance for #d1
      await ch.locatorForOptional('div', DivHarness)() // Gets a `TestElement` instance for #d1
      await ch.locatorForOptional('span')() // Gets `null`

      Type Parameters

      • T extends (string | HarnessQuery<any>)[]

      Parameters

      • ...queries: T

        A list of queries specifying which harnesses and elements to search for:

        • A string searches for elements matching the CSS selector specified by the string.
        • A ComponentHarness constructor searches for ComponentHarness instances matching the given class.
        • A HarnessPredicate searches for ComponentHarness instances matching the given predicate.

      Returns () => Promise<null | LocatorFnResult<T>>

      An asynchronous locator function that searches for and returns a Promise for the first element or harness matching the given search criteria. Matches are ordered first by order in the DOM, and second by order in the queries list. If no matches are found, the Promise is resolved with null. The type that the Promise resolves to is a union of all result types for each query or null.

    • Waits for all scheduled or running async tasks to complete. This allows harness authors to wait for async tasks outside of the Angular zone.

      Returns Promise<void>