Commit ca15f1c8 authored by Zack Cuddy's avatar Zack Cuddy

Geo Node Form - Use @input event

This removes support of the
watcher in favor of just
hooking into the @input
event.
parent f2202de3
...@@ -18,11 +18,6 @@ export default { ...@@ -18,11 +18,6 @@ export default {
required: true, required: true,
}, },
}, },
data() {
return {
namespaceSearch: '',
};
},
computed: { computed: {
...mapState(['synchronizationNamespaces']), ...mapState(['synchronizationNamespaces']),
dropdownTitle() { dropdownTitle() {
...@@ -35,11 +30,6 @@ export default { ...@@ -35,11 +30,6 @@ export default {
return this.synchronizationNamespaces.length === 0; return this.synchronizationNamespaces.length === 0;
}, },
}, },
watch: {
namespaceSearch() {
this.fetchSyncNamespaces(this.namespaceSearch);
},
},
methods: { methods: {
...mapActions(['fetchSyncNamespaces']), ...mapActions(['fetchSyncNamespaces']),
toggleNamespace(namespace) { toggleNamespace(namespace) {
...@@ -58,8 +48,8 @@ export default { ...@@ -58,8 +48,8 @@ export default {
</script> </script>
<template> <template>
<gl-deprecated-dropdown :text="dropdownTitle" @show="fetchSyncNamespaces(namespaceSearch)"> <gl-deprecated-dropdown :text="dropdownTitle" @show="fetchSyncNamespaces('')">
<gl-search-box-by-type v-model="namespaceSearch" class="m-2" :debounce="500" /> <gl-search-box-by-type class="m-2" :debounce="500" @input="fetchSyncNamespaces" />
<li v-for="namespace in synchronizationNamespaces" :key="namespace.id"> <li v-for="namespace in synchronizationNamespaces" :key="namespace.id">
<gl-deprecated-button class="d-flex align-items-center" @click="toggleNamespace(namespace)"> <gl-deprecated-button class="d-flex align-items-center" @click="toggleNamespace(namespace)">
<gl-icon :class="[{ invisible: !isSelected(namespace) }]" name="mobile-issue-close" /> <gl-icon :class="[{ invisible: !isSelected(namespace) }]" name="mobile-issue-close" />
......
...@@ -64,6 +64,18 @@ describe('GeoNodeFormNamespaces', () => { ...@@ -64,6 +64,18 @@ describe('GeoNodeFormNamespaces', () => {
it('has debounce prop', () => { it('has debounce prop', () => {
expect(findGlDropdownSearch().attributes('debounce')).toBe('500'); expect(findGlDropdownSearch().attributes('debounce')).toBe('500');
}); });
describe('onSearch', () => {
const namespaceSearch = 'test search';
beforeEach(() => {
findGlDropdownSearch().vm.$emit('input', namespaceSearch);
});
it('calls fetchSyncNamespaces when input event is fired from GlSearchBoxByType', () => {
expect(actionSpies.fetchSyncNamespaces).toHaveBeenCalledWith(namespaceSearch);
});
});
}); });
describe('findDropdownItems', () => { describe('findDropdownItems', () => {
...@@ -85,21 +97,6 @@ describe('GeoNodeFormNamespaces', () => { ...@@ -85,21 +97,6 @@ describe('GeoNodeFormNamespaces', () => {
}); });
}); });
describe('watchers', () => {
describe('namespaceSearch', () => {
const namespaceSearch = 'test search';
beforeEach(() => {
createComponent();
findGlDropdownSearch().vm.$emit('input', namespaceSearch);
});
it('calls fetchSyncNamespaces when input event is fired from GlSearchBoxByType', () => {
expect(actionSpies.fetchSyncNamespaces).toHaveBeenCalledWith(namespaceSearch);
});
});
});
describe('methods', () => { describe('methods', () => {
describe('toggleNamespace', () => { describe('toggleNamespace', () => {
beforeEach(() => { beforeEach(() => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment