API reference for Angular Material sort-testing

import {MatSortHarness} from '@angular/material/sort/testing';

Harness for interacting with a standard mat-sort in tests.

Methods
async
getActiveHeader

Gets the selected header in the mat-sort.

Returns
Promise<MatSortHeaderHarness | null>

async
getSortHeaders

Gets all of the sort headers in the mat-sort.

Parameters

filter

SortHeaderHarnessFilters = {}

Returns
Promise<MatSortHeaderHarness[]>

async
host

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

Returns
Promise<TestElement>

Harness for interacting with a standard Angular Material sort header in tests.

Methods
async
click

Clicks the header to change its sorting direction. Only works if the header is enabled.

Returns
Promise<void>

Promise that resolves when the action completes.

async
getAriaLabel

Gets the aria-label of the sort header.

Returns
Promise<string | null>

async
getLabel

Gets the label of the sort header.

Returns
Promise<string>

async
getSortDirection

Gets the sorting direction of the header.

Returns
Promise<SortDirection>

async
host

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

Returns
Promise<TestElement>

async
isActive

Gets whether the sort header is currently being sorted by.

Returns
Promise<boolean>

async
isDisabled

Whether the sort header is disabled.

Returns
Promise<boolean>

Properties
Name Description

label: string | RegExp

sortDirection: SortDirection