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

Add setSubnet action

parent a3286fb8
......@@ -71,7 +71,7 @@ export default {
this.fetchRegions();
},
methods: {
...mapActions(['setRegion', 'setVpc']),
...mapActions(['setRegion', 'setVpc', 'setSubnet']),
...mapActions({
fetchRegions: 'regions/fetchItems',
fetchVpcs: 'vpcs/fetchItems',
......@@ -148,7 +148,7 @@ export default {
:empty-text="s__('ClusterIntegration|No subnet found')"
:has-errors="loadingSubnetsError"
: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>
</div>
......
......@@ -27,6 +27,7 @@ describe('EksClusterConfigurationForm', () => {
actions = {
setRegion: jest.fn(),
setVpc: jest.fn(),
setSubnet: jest.fn(),
};
regionsActions = {
fetchItems: jest.fn(),
......@@ -193,4 +194,16 @@ describe('EksClusterConfigurationForm', () => {
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