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

Function expectCheckboxAtPosition

src/material/list/selection-list.spec.ts:926–940  ·  view source on GitHub ↗
(
      listItemElement: HTMLElement,
      position: MatListOptionTogglePosition,
    )

Source from the content-addressed store, hash-verified

924
925 describe('with list item elements', () => {
926 function expectCheckboxAtPosition(
927 listItemElement: HTMLElement,
928 position: MatListOptionTogglePosition,
929 ) {
930 const containerSelector =
931 position === 'before' ? '.mdc-list-item__start' : 'mdc-list-item__end';
932 const checkboxPositionClass =
933 position === 'before'
934 ? 'mdc-list-item--with-leading-checkbox'
935 : 'mdc-list-item--with-trailing-checkbox';
936 expect(listItemElement.querySelector(`${containerSelector} .mdc-checkbox`))
937 .withContext(`Expected checkbox to be aligned ${position}`)
938 .toBeDefined();
939 expect(listItemElement.classList).toContain(checkboxPositionClass);
940 }
941
942 /**
943 * Expects an icon to be shown at the given position. Also

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected