Merge branch '28248-use-page' into 'master'

Use `page` query parameter instead of `p` to keep consistency with all URLs

Closes #28248

See merge request !9268
This commit is contained in:
Robert Speicher 2017-02-17 00:35:32 +00:00
commit 797fcd6b2c
2 changed files with 23 additions and 3 deletions

View file

@ -29,7 +29,7 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s
},
props: ['scope', 'store', 'svgs'],
created() {
const pagenum = gl.utils.getParameterByName('p');
const pagenum = gl.utils.getParameterByName('page');
const scope = gl.utils.getParameterByName('scope');
if (pagenum) this.pagenum = pagenum;
if (scope) this.apiScope = scope;
@ -44,7 +44,6 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s
},
methods: {
/**
* Changes the URL according to the pagination component.
*
@ -57,7 +56,7 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s
*/
change(pagenum, apiScope) {
if (!apiScope) apiScope = 'all';
gl.utils.visitUrl(`?scope=${apiScope}&p=${pagenum}`);
gl.utils.visitUrl(`?scope=${apiScope}&page=${pagenum}`);
},
},
template: `

View file

@ -285,6 +285,27 @@ describe 'Pipelines', :feature, :js do
end
end
end
context 'with pagination' do
before do
allow(Ci::Pipeline).to receive(:default_per_page).and_return(1)
create(:ci_empty_pipeline, project: project)
end
it 'should render pagination' do
visit namespace_project_pipelines_path(project.namespace, project)
wait_for_vue_resource
expect(page).to have_selector('.gl-pagination')
end
it 'should render second page of pipelines' do
visit namespace_project_pipelines_path(project.namespace, project, page: '2')
wait_for_vue_resource
expect(page).to have_selector('.gl-pagination .page', count: 2)
end
end
end
describe 'POST /:project/pipelines' do