Skip to content

Commit

Permalink
Fix unit test & e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
Xon committed Aug 29, 2024
1 parent 5ecc6fd commit 2111d60
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ <h2>Single select input</h2>
<hr />
<h2>Form interaction</h2>
<p>Change the values and press reset to restore to initial state.</p>
<form data-test-hook="reset-form">
<form data-test-hook="reset-form" style="margin-bottom:0">
<div data-test-hook="reset-simple">
<label for="reset-simple">Change me!</label>
<select class="form-control" name="reset-simple" id="reset-simple">
Expand Down
4 changes: 4 additions & 0 deletions test-e2e/merge.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
testDir: 'e2e',
reporter: [['html', { open: 'never' }]],
};
12 changes: 5 additions & 7 deletions test/scripts/choices.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1143,27 +1143,25 @@ describe('choices', () => {
});

describe('clearChoices', () => {
let storeDispatchStub;
let storeResetStub;

beforeEach(() => {
storeDispatchStub = stub();
instance._store.dispatch = storeDispatchStub;
storeResetStub = stub();
instance._store.reset = storeResetStub;

output = instance.clearChoices();
});

afterEach(() => {
instance._store.dispatch.reset();
instance._store.reset.reset();
});

it('returns this', () => {
expect(output).to.deep.equal(instance);
});

it('dispatches clearChoices action', () => {
expect(storeDispatchStub.lastCall.args[0]).to.deep.equal({
type: ActionType.CLEAR_CHOICES,
});
expect(storeResetStub.callCount).to.be.eq(1);
});
});

Expand Down

0 comments on commit 2111d60

Please sign in to comment.