From 884f760ee4fb009deebee444f53823dfd243bace Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Mon, 2 May 2022 17:37:52 +0200 Subject: [PATCH] docs(material/button): fix button harness example test (#24736) We were declaring the harness being used as a variable unecessarily. These changes align the example closer with the other harness examples. Fixes #24732. (cherry picked from commit 2c64ae3e94fe9196e5e2aa1f27d1c9ba159e54fc) --- .../button/button-harness/button-harness-example.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components-examples/material/button/button-harness/button-harness-example.spec.ts b/src/components-examples/material/button/button-harness/button-harness-example.spec.ts index 8ad4300ea4b2..6384afff3811 100644 --- a/src/components-examples/material/button/button-harness/button-harness-example.spec.ts +++ b/src/components-examples/material/button/button-harness/button-harness-example.spec.ts @@ -8,7 +8,6 @@ import {ButtonHarnessExample} from './button-harness-example'; describe('ButtonHarnessExample', () => { let fixture: ComponentFixture; let loader: HarnessLoader; - let buttonHarness = MatButtonHarness; beforeEach(async () => { await TestBed.configureTestingModule({ @@ -26,13 +25,14 @@ describe('ButtonHarnessExample', () => { }); it('should load button with exact text', async () => { - const buttons = await loader.getAllHarnesses(buttonHarness.with({text: 'Basic button'})); + const buttons = await loader.getAllHarnesses(MatButtonHarness.with({text: 'Basic button'})); expect(buttons.length).toBe(1); expect(await buttons[0].getText()).toBe('Basic button'); }); it('should click a button', async () => { - const button = await loader.getHarness(buttonHarness.with({text: 'Basic button'})); + const button = await loader.getHarness(MatButtonHarness.with({text: 'Basic button'})); + expect(fixture.componentInstance.clicked).toBe(false); await button.click(); expect(fixture.componentInstance.clicked).toBe(true); });