Skip to content

Commit b0701ac

Browse files
committed
fix(material/testing): Rename MatButtonHarness "type" filter to
"buttonType" to avoid conflict with the reserved TS keyword
1 parent f3b4d99 commit b0701ac

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/material/button/testing/button-harness-filters.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ export interface ButtonHarnessFilters extends BaseHarnessFilters {
3232
disabled?: boolean;
3333

3434
/** Only find instances with the specified type. */
35-
type?: ButtonType;
35+
buttonType?: ButtonType;
3636
}

src/material/button/testing/button-harness.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('MatButtonHarness', () => {
6060
});
6161

6262
it('should load button with type attribute', async () => {
63-
const buttons = await loader.getAllHarnesses(MatButtonHarness.with({type: 'submit'}));
63+
const buttons = await loader.getAllHarnesses(MatButtonHarness.with({buttonType: 'submit'}));
6464
expect(buttons.length).toBe(1);
6565
expect(await buttons[0].getText()).toBe('Submit button');
6666
expect(await buttons[0].getType()).toBe('submit');

src/material/button/testing/button-harness.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ export class MatButtonHarness extends ContentContainerComponentHarness {
5656
.addOption('disabled', options.disabled, async (harness, disabled) => {
5757
return (await harness.isDisabled()) === disabled;
5858
})
59-
.addOption('type', options.type, (harness, type) =>
60-
HarnessPredicate.stringMatches(harness.getType(), type),
59+
.addOption('buttonType', options.buttonType, (harness, buttonType) =>
60+
HarnessPredicate.stringMatches(harness.getType(), buttonType),
6161
);
6262
}
6363

@@ -164,9 +164,9 @@ export class MatButtonHarness extends ContentContainerComponentHarness {
164164
*/
165165
async getType(): Promise<ButtonType | null> {
166166
const host = await this.host();
167-
const type = await host.getAttribute('type');
168-
if (type === 'button' || type === 'submit' || type === 'reset') {
169-
return type;
167+
const buttonType = await host.getAttribute('type');
168+
if (buttonType === 'button' || buttonType === 'submit' || buttonType === 'reset') {
169+
return buttonType;
170170
}
171171
return null;
172172
}

0 commit comments

Comments
 (0)