Skip to content

Commit

Permalink
make it a form and fix test:
Browse files Browse the repository at this point in the history
  • Loading branch information
Monkeychip committed May 28, 2024
1 parent 48477e5 commit dd63dfd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
13 changes: 3 additions & 10 deletions ui/lib/core/addon/components/filter-input-explicit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
SPDX-License-Identifier: BUSL-1.1
~}}

<div>
<form {{on "submit" @handleSearch}}>
<Hds::SegmentedGroup as |S|>
<S.TextInput
@value={{@query}}
Expand All @@ -14,13 +14,6 @@
{{on "keydown" @handleKeyDown}}
data-test-filter-input-explicit
/>
<S.Button
@color="secondary"
@text="Search"
@icon="search"
type="submit"
{{on "click" @handleSearch}}
data-test-filter-input-explicit-search
/>
<S.Button @color="secondary" @text="Search" @icon="search" type="submit" data-test-filter-input-explicit-search />
</Hds::SegmentedGroup>
</div>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@ import hbs from 'htmlbars-inline-precompile';
import { GENERAL } from 'vault/tests/helpers/general-selectors';
import sinon from 'sinon';

const handler = (e) => {
// required because filter-input-explicit passes handleSearch on form submit
if (e && e.preventDefault) e.preventDefault();
return;
};

module('Integration | Component | filter-input-explicit', function (hooks) {
setupRenderingTest(hooks);

hooks.beforeEach(function () {
this.handleSearch = sinon.spy();
this.handleSearch = sinon.spy(handler);
this.handleInput = sinon.spy();
this.handleKeyDown = sinon.spy();
this.query = '';
Expand Down

0 comments on commit dd63dfd

Please sign in to comment.