Skip to content

Commit

Permalink
fix(multiple): update API to match previous accesible members
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewseguin committed Aug 14, 2023
1 parent 968d89b commit d06aec6
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/material/checkbox/testing/checkbox-harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {coerceBooleanProperty} from '@angular/cdk/coercion';
export class MatCheckboxHarness extends ComponentHarness {
static hostSelector = '.mat-mdc-checkbox';

private _input = this.locatorFor('input');
_input = this.locatorFor('input');
private _label = this.locatorFor('label');
private _inputContainer = this.locatorFor('.mdc-checkbox');

Expand Down
2 changes: 1 addition & 1 deletion src/material/dialog/testing/dialog-opener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {Subscription} from 'rxjs';
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
})
export class MatTestDialogOpener<T, R> implements OnDestroy {
export class MatTestDialogOpener<T = unknown, R = unknown> implements OnDestroy {
/** Component that should be opened with the MatDialog `open` method. */
protected static component: ComponentType<unknown> | undefined;

Expand Down
4 changes: 2 additions & 2 deletions src/material/paginator/testing/paginator-harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ export class MatPaginatorHarness extends ComponentHarness {
private _previousButton = this.locatorFor('.mat-mdc-paginator-navigation-previous');
private _firstPageButton = this.locatorForOptional('.mat-mdc-paginator-navigation-first');
private _lastPageButton = this.locatorForOptional('.mat-mdc-paginator-navigation-last');
private _select = this.locatorForOptional(
_select = this.locatorForOptional(
MatSelectHarness.with({
ancestor: '.mat-mdc-paginator-page-size',
}),
);
private _pageSizeFallback = this.locatorFor('.mat-mdc-paginator-page-size-value');
private _rangeLabel = this.locatorFor('.mat-mdc-paginator-range-label');
_rangeLabel = this.locatorFor('.mat-mdc-paginator-range-label');

/**
* Gets a `HarnessPredicate` that can be used to search for a paginator with specific attributes.
Expand Down
2 changes: 1 addition & 1 deletion src/material/select/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ export class MatSelect
];

/** Scrolls a particular option into the view. */
private _scrollOptionIntoView(index: number): void {
_scrollOptionIntoView(index: number): void {
const option = this.options.toArray()[index];

if (option) {
Expand Down
8 changes: 4 additions & 4 deletions src/material/slide-toggle/slide-toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,15 @@ export class MatSlideToggle
protected _focusMonitor: FocusMonitor,
protected _changeDetectorRef: ChangeDetectorRef,
@Attribute('tabindex') tabIndex: string,
@Inject(MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS) private _defaults: MatSlideToggleDefaultOptions,
@Inject(MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS) public defaults: MatSlideToggleDefaultOptions,
@Optional() @Inject(ANIMATION_MODULE_TYPE) animationMode?: string,
) {
super(elementRef);
this.tabIndex = parseInt(tabIndex) || 0;
this.color = this.defaultColor = _defaults.color || 'accent';
this.color = this.defaultColor = defaults.color || 'accent';
this._noopAnimations = animationMode === 'NoopAnimations';
this.id = this._uniqueId = `mat-mdc-slide-toggle-${++nextUniqueId}`;
this._hideIcon = _defaults.hideIcon ?? false;
this._hideIcon = defaults.hideIcon ?? false;
this._labelId = this._uniqueId + '-label';
}

Expand Down Expand Up @@ -285,7 +285,7 @@ export class MatSlideToggle
_handleClick() {
this.toggleChange.emit();

if (!this._defaults.disableToggleValue) {
if (!this.defaults.disableToggleValue) {
this.checked = !this.checked;
this._onChange(this.checked);
this.change.emit(new MatSlideToggleChange(this, this.checked));
Expand Down
2 changes: 1 addition & 1 deletion src/material/slide-toggle/testing/slide-toggle-harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {SlideToggleHarnessFilters} from './slide-toggle-harness-filters';
/** Harness for interacting with a mat-slide-toggle in tests. */
export class MatSlideToggleHarness extends ComponentHarness {
private _label = this.locatorFor('label');
private _nativeElement = this.locatorFor('button');
_nativeElement = this.locatorFor('button');
static hostSelector = '.mat-mdc-slide-toggle';

/**
Expand Down
4 changes: 2 additions & 2 deletions src/material/table/testing/table-harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export interface MatTableHarnessColumnsText {
export class MatTableHarness extends ContentContainerComponentHarness<string> {
/** The selector for the host element of a `MatTableHarness` instance. */
static hostSelector = '.mat-mdc-table';
private _headerRowHarness = MatHeaderRowHarness;
private _rowHarness = MatRowHarness;
_headerRowHarness = MatHeaderRowHarness;
_rowHarness = MatRowHarness;
private _footerRowHarness = MatFooterRowHarness;

/**
Expand Down
4 changes: 4 additions & 0 deletions tools/public_api_guard/material/checkbox-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
```ts

import { AsyncFactoryFn } from '@angular/cdk/testing';
import { BaseHarnessFilters } from '@angular/cdk/testing';
import { ComponentHarness } from '@angular/cdk/testing';
import { ComponentHarnessConstructor } from '@angular/cdk/testing';
import { HarnessPredicate } from '@angular/cdk/testing';
import { TestElement } from '@angular/cdk/testing';

// @public
export interface CheckboxHarnessFilters extends BaseHarnessFilters {
Expand All @@ -29,6 +31,8 @@ export class MatCheckboxHarness extends ComponentHarness {
getValue(): Promise<string | null>;
// (undocumented)
static hostSelector: string;
// (undocumented)
_input: AsyncFactoryFn<TestElement>;
isChecked(): Promise<boolean>;
isDisabled(): Promise<boolean>;
isFocused(): Promise<boolean>;
Expand Down
2 changes: 1 addition & 1 deletion tools/public_api_guard/material/dialog-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const enum MatDialogSection {
}

// @public
export class MatTestDialogOpener<T, R> implements OnDestroy {
export class MatTestDialogOpener<T = unknown, R = unknown> implements OnDestroy {
constructor(dialog: MatDialog);
closedResult: R | undefined;
protected static component: ComponentType<unknown> | undefined;
Expand Down
7 changes: 7 additions & 0 deletions tools/public_api_guard/material/paginator-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
```ts

import { AsyncFactoryFn } from '@angular/cdk/testing';
import { BaseHarnessFilters } from '@angular/cdk/testing';
import { ComponentHarness } from '@angular/cdk/testing';
import { ComponentHarnessConstructor } from '@angular/cdk/testing';
import { HarnessPredicate } from '@angular/cdk/testing';
import { MatSelectHarness } from '@angular/material/select/testing';
import { TestElement } from '@angular/cdk/testing';

// @public
export class MatPaginatorHarness extends ComponentHarness {
Expand All @@ -21,6 +24,10 @@ export class MatPaginatorHarness extends ComponentHarness {
isNextPageDisabled(): Promise<boolean>;
// (undocumented)
isPreviousPageDisabled(): Promise<boolean>;
// (undocumented)
_rangeLabel: AsyncFactoryFn<TestElement>;
// (undocumented)
_select: AsyncFactoryFn<MatSelectHarness | null>;
setPageSize(size: number): Promise<void>;
static with<T extends MatPaginatorHarness>(this: ComponentHarnessConstructor<T>, options?: PaginatorHarnessFilters): HarnessPredicate<T>;
}
Expand Down
1 change: 1 addition & 0 deletions tools/public_api_guard/material/select.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ export class MatSelect extends _MatSelectMixinBase implements AfterContentInit,
registerOnTouched(fn: () => {}): void;
get required(): boolean;
set required(value: BooleanInput);
_scrollOptionIntoView(index: number): void;
_scrollStrategy: ScrollStrategy;
get selected(): MatOption | MatOption[];
readonly selectionChange: EventEmitter<MatSelectChange>;
Expand Down
4 changes: 4 additions & 0 deletions tools/public_api_guard/material/slide-toggle-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
```ts

import { AsyncFactoryFn } from '@angular/cdk/testing';
import { BaseHarnessFilters } from '@angular/cdk/testing';
import { ComponentHarness } from '@angular/cdk/testing';
import { ComponentHarnessConstructor } from '@angular/cdk/testing';
import { HarnessPredicate } from '@angular/cdk/testing';
import { TestElement } from '@angular/cdk/testing';

// @public
export class MatSlideToggleHarness extends ComponentHarness {
Expand All @@ -25,6 +27,8 @@ export class MatSlideToggleHarness extends ComponentHarness {
isFocused(): Promise<boolean>;
isRequired(): Promise<boolean>;
isValid(): Promise<boolean>;
// (undocumented)
_nativeElement: AsyncFactoryFn<TestElement>;
toggle(): Promise<void>;
uncheck(): Promise<void>;
static with<T extends MatSlideToggleHarness>(this: ComponentHarnessConstructor<T>, options?: SlideToggleHarnessFilters): HarnessPredicate<T>;
Expand Down
4 changes: 3 additions & 1 deletion tools/public_api_guard/material/slide-toggle.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const MAT_SLIDE_TOGGLE_VALUE_ACCESSOR: {

// @public (undocumented)
export class MatSlideToggle extends _MatSlideToggleMixinBase implements OnDestroy, AfterContentInit, ControlValueAccessor, CanDisable, CanColor, HasTabIndex, CanDisableRipple {
constructor(elementRef: ElementRef, _focusMonitor: FocusMonitor, _changeDetectorRef: ChangeDetectorRef, tabIndex: string, _defaults: MatSlideToggleDefaultOptions, animationMode?: string);
constructor(elementRef: ElementRef, _focusMonitor: FocusMonitor, _changeDetectorRef: ChangeDetectorRef, tabIndex: string, defaults: MatSlideToggleDefaultOptions, animationMode?: string);
ariaDescribedby: string;
ariaLabel: string | null;
ariaLabelledby: string | null;
Expand All @@ -52,6 +52,8 @@ export class MatSlideToggle extends _MatSlideToggleMixinBase implements OnDestro
protected _changeDetectorRef: ChangeDetectorRef;
get checked(): boolean;
set checked(value: BooleanInput);
// (undocumented)
defaults: MatSlideToggleDefaultOptions;
protected _emitChangeEvent(): void;
focus(): void;
_focused: boolean;
Expand Down
4 changes: 4 additions & 0 deletions tools/public_api_guard/material/table-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ export class MatTableHarness extends ContentContainerComponentHarness<string> {
getFooterRows(filter?: RowHarnessFilters): Promise<MatFooterRowHarness[]>;
getHeaderRows(filter?: RowHarnessFilters): Promise<MatHeaderRowHarness[]>;
getRows(filter?: RowHarnessFilters): Promise<MatRowHarness[]>;
// (undocumented)
_headerRowHarness: typeof MatHeaderRowHarness;
static hostSelector: string;
// (undocumented)
_rowHarness: typeof MatRowHarness;
static with<T extends MatTableHarness>(this: ComponentHarnessConstructor<T>, options?: TableHarnessFilters): HarnessPredicate<T>;
}

Expand Down

0 comments on commit d06aec6

Please sign in to comment.