Commit 6cb9af8c authored by Enrique Alcantara's avatar Enrique Alcantara

Add setSubnet action

parent a3286fb8
...@@ -71,7 +71,7 @@ export default { ...@@ -71,7 +71,7 @@ export default {
this.fetchRegions(); this.fetchRegions();
}, },
methods: { methods: {
...mapActions(['setRegion', 'setVpc']), ...mapActions(['setRegion', 'setVpc', 'setSubnet']),
...mapActions({ ...mapActions({
fetchRegions: 'regions/fetchItems', fetchRegions: 'regions/fetchItems',
fetchVpcs: 'vpcs/fetchItems', fetchVpcs: 'vpcs/fetchItems',
...@@ -148,7 +148,7 @@ export default { ...@@ -148,7 +148,7 @@ export default {
:empty-text="s__('ClusterIntegration|No subnet found')" :empty-text="s__('ClusterIntegration|No subnet found')"
:has-errors="loadingSubnetsError" :has-errors="loadingSubnetsError"
:error-message="s__('ClusterIntegration|Could not load subnets for the selected VPC')" :error-message="s__('ClusterIntegration|Could not load subnets for the selected VPC')"
@input="setVpcAndFetchSubnets($event)" @input="setSubnet({ subnet: $event })"
/> />
<p class="form-text text-muted" v-html="subnetDropdownHelpText"></p> <p class="form-text text-muted" v-html="subnetDropdownHelpText"></p>
</div> </div>
......
...@@ -27,6 +27,7 @@ describe('EksClusterConfigurationForm', () => { ...@@ -27,6 +27,7 @@ describe('EksClusterConfigurationForm', () => {
actions = { actions = {
setRegion: jest.fn(), setRegion: jest.fn(),
setVpc: jest.fn(), setVpc: jest.fn(),
setSubnet: jest.fn(),
}; };
regionsActions = { regionsActions = {
fetchItems: jest.fn(), fetchItems: jest.fn(),
...@@ -193,4 +194,16 @@ describe('EksClusterConfigurationForm', () => { ...@@ -193,4 +194,16 @@ describe('EksClusterConfigurationForm', () => {
expect(subnetsActions.fetchItems).toHaveBeenCalledWith(expect.anything(), { vpc }, undefined); expect(subnetsActions.fetchItems).toHaveBeenCalledWith(expect.anything(), { vpc }, undefined);
}); });
}); });
describe('when a subnet is selected', () => {
const subnet = { name: 'subnet-1' };
beforeEach(() => {
findSubnetDropdown().vm.$emit('input', subnet);
});
it('dispatches setSubnet action', () => {
expect(actions.setSubnet).toHaveBeenCalledWith(expect.anything(), { subnet }, undefined);
});
});
}); });
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