Skip to content

Commit

Permalink
docs(material/button): fix button harness example test (#24736)
Browse files Browse the repository at this point in the history
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 2c64ae3)
  • Loading branch information
crisbeto authored and andrewseguin committed May 2, 2022
1 parent 090404a commit 884f760
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {ButtonHarnessExample} from './button-harness-example';
describe('ButtonHarnessExample', () => {
let fixture: ComponentFixture<ButtonHarnessExample>;
let loader: HarnessLoader;
let buttonHarness = MatButtonHarness;

beforeEach(async () => {
await TestBed.configureTestingModule({
Expand All @@ -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);
});
Expand Down

0 comments on commit 884f760

Please sign in to comment.