Commit fd90ea14 authored by Minh Nguyen's avatar Minh Nguyen Committed by Phil Hughes

Show nested environments when change tab, page

parent 5ba19ff5
...@@ -16,6 +16,7 @@ export default { ...@@ -16,6 +16,7 @@ export default {
let params = { let params = {
scope, scope,
page: '1', page: '1',
nested: true,
}; };
params = this.onChangeWithFilter(params); params = this.onChangeWithFilter(params);
...@@ -27,6 +28,7 @@ export default { ...@@ -27,6 +28,7 @@ export default {
/* URLS parameters are strings, we need to parse to match types */ /* URLS parameters are strings, we need to parse to match types */
let params = { let params = {
page: Number(page).toString(), page: Number(page).toString(),
nested: true,
}; };
if (this.scope) { if (this.scope) {
......
---
title: Show nested environments when change tab, page
merge_request: 55167
author:
type: changed
...@@ -97,13 +97,21 @@ describe('Environment', () => { ...@@ -97,13 +97,21 @@ describe('Environment', () => {
jest.spyOn(wrapper.vm, 'updateContent').mockImplementation(() => {}); jest.spyOn(wrapper.vm, 'updateContent').mockImplementation(() => {});
wrapper.find('.gl-pagination li:nth-child(3) .page-link').trigger('click'); wrapper.find('.gl-pagination li:nth-child(3) .page-link').trigger('click');
expect(wrapper.vm.updateContent).toHaveBeenCalledWith({ scope: 'available', page: '2' }); expect(wrapper.vm.updateContent).toHaveBeenCalledWith({
scope: 'available',
page: '2',
nested: true,
});
}); });
it('should make an API request when using tabs', () => { it('should make an API request when using tabs', () => {
jest.spyOn(wrapper.vm, 'updateContent').mockImplementation(() => {}); jest.spyOn(wrapper.vm, 'updateContent').mockImplementation(() => {});
findEnvironmentsTabStopped().trigger('click'); findEnvironmentsTabStopped().trigger('click');
expect(wrapper.vm.updateContent).toHaveBeenCalledWith({ scope: 'stopped', page: '1' }); expect(wrapper.vm.updateContent).toHaveBeenCalledWith({
scope: 'stopped',
page: '1',
nested: true,
});
}); });
it('should not make the same API request when clicking on the current scope tab', () => { it('should not make the same API request when clicking on the current scope tab', () => {
......
...@@ -103,13 +103,18 @@ describe('Environments Folder View', () => { ...@@ -103,13 +103,18 @@ describe('Environments Folder View', () => {
expect(wrapper.vm.updateContent).toHaveBeenCalledWith({ expect(wrapper.vm.updateContent).toHaveBeenCalledWith({
scope: wrapper.vm.scope, scope: wrapper.vm.scope,
page: '10', page: '10',
nested: true,
}); });
}); });
it('should make an API request when using tabs', () => { it('should make an API request when using tabs', () => {
jest.spyOn(wrapper.vm, 'updateContent').mockImplementation(() => {}); jest.spyOn(wrapper.vm, 'updateContent').mockImplementation(() => {});
findEnvironmentsTabStopped().trigger('click'); findEnvironmentsTabStopped().trigger('click');
expect(wrapper.vm.updateContent).toHaveBeenCalledWith({ scope: 'stopped', page: '1' }); expect(wrapper.vm.updateContent).toHaveBeenCalledWith({
scope: 'stopped',
page: '1',
nested: true,
});
}); });
}); });
}); });
...@@ -161,7 +166,11 @@ describe('Environments Folder View', () => { ...@@ -161,7 +166,11 @@ describe('Environments Folder View', () => {
it('should set page to 1', () => { it('should set page to 1', () => {
jest.spyOn(wrapper.vm, 'updateContent').mockImplementation(() => {}); jest.spyOn(wrapper.vm, 'updateContent').mockImplementation(() => {});
wrapper.vm.onChangeTab('stopped'); wrapper.vm.onChangeTab('stopped');
expect(wrapper.vm.updateContent).toHaveBeenCalledWith({ scope: 'stopped', page: '1' }); expect(wrapper.vm.updateContent).toHaveBeenCalledWith({
scope: 'stopped',
page: '1',
nested: true,
});
}); });
}); });
...@@ -172,6 +181,7 @@ describe('Environments Folder View', () => { ...@@ -172,6 +181,7 @@ describe('Environments Folder View', () => {
expect(wrapper.vm.updateContent).toHaveBeenCalledWith({ expect(wrapper.vm.updateContent).toHaveBeenCalledWith({
scope: wrapper.vm.scope, scope: wrapper.vm.scope,
page: '4', page: '4',
nested: true,
}); });
}); });
}); });
......
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