From ad8cb821850b6e871d8108428fce77337f597c66 Mon Sep 17 00:00:00 2001 From: Arthur Ming Date: Wed, 18 May 2022 22:18:28 +0800 Subject: [PATCH] test(material/button): use withContext to expact fail output --- src/material/button/button.spec.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/material/button/button.spec.ts b/src/material/button/button.spec.ts index 2113afdb7af1..a37fb989980f 100644 --- a/src/material/button/button.spec.ts +++ b/src/material/button/button.spec.ts @@ -310,22 +310,22 @@ describe('MatButton', () => { }); it('should disable the ripple when the button is disabled', () => { - expect(buttonRippleInstance.disabled).toBeFalsy( - 'Expected an enabled button[mat-button] to have an enabled ripple', - ); - expect(anchorRippleInstance.disabled).toBeFalsy( - 'Expected an enabled a[mat-button] to have an enabled ripple', - ); + expect(buttonRippleInstance.disabled) + .withContext('Expected an enabled button[mat-button] to have an enabled ripple') + .toBeFalsy(); + expect(anchorRippleInstance.disabled) + .withContext('Expected an enabled a[mat-button] to have an enabled ripple') + .toBeFalsy(); testComponent.isDisabled = true; fixture.detectChanges(); - expect(buttonRippleInstance.disabled).toBeTruthy( - 'Expected a disabled button[mat-button] not to have an enabled ripple', - ); - expect(anchorRippleInstance.disabled).toBeTruthy( - 'Expected a disabled a[mat-button] not to have an enabled ripple', - ); + expect(buttonRippleInstance.disabled) + .withContext('Expected a disabled button[mat-button] not to have an enabled ripple') + .toBeTruthy(); + expect(anchorRippleInstance.disabled) + .withContext('Expected a disabled a[mat-button] not to have an enabled ripple') + .toBeTruthy(); }); });