Skip to content

Commit 4c2ed24

Browse files
authored
feat(search placeholder property) (#46)
* added search box placeholder prop and test * updated docs
1 parent 4209bbe commit 4c2ed24

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

docs/guide/api.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,17 @@ splitBy: {
133133
}
134134
```
135135

136+
### searchBoxPlaceholder
137+
138+
Sets the value for the search input field placeholder attribute.
139+
140+
```js
141+
searchBoxPlaceholder: {
142+
type: String,
143+
default: 'Search...'
144+
}
145+
```
146+
136147
## Slots
137148

138149
### `item`

src/components/GridMultiSelect.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
type="text"
6767
ref="search"
6868
class="gridmultiselect__searchfield gridmultiselect__searchfield--font-small"
69-
placeholder="Search..."
69+
:placeholder="searchBoxPlaceholder"
7070
v-model="searchTerm"
7171
:tabindex="tabIndex"
7272
@focus.prevent="showMenu"
@@ -173,6 +173,10 @@ export default {
173173
},
174174
splitBy: {
175175
type: String
176+
},
177+
searchBoxPlaceholder: {
178+
type: String,
179+
default: "Search..."
176180
}
177181
},
178182
computed: {

tests/Searching.spec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,16 @@ describe('searching', () => {
3636

3737
expect(wrapper.vm.searchTerm).toEqual('1');
3838
expect(wrapper.vm.internalItems).toEqual([{ id: 1, text: 'Item 1' }]);
39+
});
40+
41+
it('should change input placeholder', () => {
42+
const wrapper = wrap({
43+
value: null,
44+
items: [{ id: 1, text: 'Item 1' }, { id: 2, text: 'Item 2' }],
45+
searchBoxPlaceholder: 'Search items...'
46+
}), input = wrapper.find('.gridmultiselect__searchfield');
47+
48+
expect(wrapper.vm.searchBoxPlaceholder).toEqual('Search items...');
49+
expect(input.element.placeholder).toBe('Search items...');
3950
})
4051
})

0 commit comments

Comments
 (0)