API reference for Angular Material icon-testing

import {MatIconTestingModule} from '@angular/material/icon/testing';

A null icon registry that must be imported to allow disabling of custom icons.

Methods
addSvgIcon
Returns
this

addSvgIconInNamespace
Returns
this

addSvgIconLiteral
Returns
this

addSvgIconLiteralInNamespace
Returns
this

addSvgIconResolver
Returns
this

addSvgIconSet
Returns
this

addSvgIconSetInNamespace
Returns
this

addSvgIconSetLiteral
Returns
this

addSvgIconSetLiteralInNamespace
Returns
this

classNameForFontAlias
Parameters

alias

string

Returns
string

getDefaultFontSetClass
getNamedSvgIcon
Returns
Observable<SVGElement>

getSvgIconFromUrl
Returns
Observable<SVGElement>

registerFontClassAlias
Returns
this

setDefaultFontSetClass
Returns
this

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

Properties
Name Description

static hostSelector: '.mat-icon'

The selector for the host element of a MatIcon instance.

Methods
async
getName

Gets the name of the icon.

Returns
Promise<string | null>

async
getNamespace

Gets the namespace of the icon.

Returns
Promise<string | null>

async
getType

Gets the type of the icon.

Returns
Promise<IconType>

async
host

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

Returns
Promise<TestElement>

async
isInline

Gets whether the icon is inline.

Returns
Promise<boolean>

static
with

Gets a HarnessPredicate that can be used to search for a MatIconHarness that meets certain criteria.

Parameters

options

IconHarnessFilters = {}

Options for filtering which icon instances are considered a match.

Returns
HarnessPredicate<MatIconHarness>

a HarnessPredicate configured with the given options.

A set of criteria that can be used to filter a list of MatIconHarness instances.

Properties
Name Description

name: string | RegExp

Filters based on the name of the icon.

namespace: string | null | RegExp

Filters based on the namespace of the icon.

type: IconType

Filters based on the typef of the icon.