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 {
let params = {
scope,
page: '1',
nested: true,
};
params = this.onChangeWithFilter(params);
......@@ -27,6 +28,7 @@ export default {
/* URLS parameters are strings, we need to parse to match types */
let params = {
page: Number(page).toString(),
nested: true,
};
if (this.scope) {
......
---
title: Show nested environments when change tab, page
merge_request: 55167
author:
type: changed
......@@ -97,13 +97,21 @@ describe('Environment', () => {
jest.spyOn(wrapper.vm, 'updateContent').mockImplementation(() => {});
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', () => {
jest.spyOn(wrapper.vm, 'updateContent').mockImplementation(() => {});
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', () => {
......
......@@ -103,13 +103,18 @@ describe('Environments Folder View', () => {
expect(wrapper.vm.updateContent).toHaveBeenCalledWith({
scope: wrapper.vm.scope,
page: '10',
nested: true,
});
});
it('should make an API request when using tabs', () => {
jest.spyOn(wrapper.vm, 'updateContent').mockImplementation(() => {});
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', () => {
it('should set page to 1', () => {
jest.spyOn(wrapper.vm, 'updateContent').mockImplementation(() => {});
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', () => {
expect(wrapper.vm.updateContent).toHaveBeenCalledWith({
scope: wrapper.vm.scope,
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