MCPcopy Create free account
hub / github.com/angular/components / expectIconAt

Function expectIconAt

src/material/list/selection-list.spec.ts:946–961  ·  view source on GitHub ↗

* Expects an icon to be shown at the given position. Also * ensures no avatar is shown at the specified position.

(item: HTMLElement, position: 'before' | 'after')

Source from the content-addressed store, hash-verified

944 * ensures no avatar is shown at the specified position.
945 */
946 function expectIconAt(item: HTMLElement, position: 'before' | 'after') {
947 const icon = item.querySelector('.mat-mdc-list-item-icon')!;
948
949 expect(item.classList).not.toContain('mdc-list-item--with-leading-avatar');
950 expect(item.classList).not.toContain('mat-mdc-list-option-with-trailing-avatar');
951
952 if (position === 'before') {
953 expect(icon.classList).toContain('mdc-list-item__start');
954 expect(item.classList).toContain('mdc-list-item--with-leading-icon');
955 expect(item.classList).not.toContain('mdc-list-item--with-trailing-icon');
956 } else {
957 expect(icon.classList).toContain('mdc-list-item__end');
958 expect(item.classList).toContain('mdc-list-item--with-trailing-icon');
959 expect(item.classList).not.toContain('mdc-list-item--with-leading-icon');
960 }
961 }
962
963 /**
964 * Expects an avatar to be shown at the given position. Also

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected