Commit 66d26688 authored by Clement Ho's avatar Clement Ho

Merge branch 'add-infinite-scroll' into 'master'

Fix Displayed Total Items in Environment Dashboard

See merge request gitlab-org/gitlab!20408
parents 87507322 249a4ff6
......@@ -70,6 +70,7 @@ export default {
'searchCount',
'searchQuery',
'messages',
'pageInfo',
]),
isSearchingProjects() {
return this.searchCount > 0;
......@@ -90,6 +91,7 @@ export default {
'fetchSearchResults',
'addProjectsToDashboard',
'fetchProjects',
'fetchNextPage',
'setProjectEndpoints',
'clearSearchResults',
'toggleSelectedProject',
......@@ -135,8 +137,10 @@ export default {
:show-loading-indicator="isSearchingProjects"
:show-minimum-search-query-message="messages.minimumQuery"
:show-search-error-message="messages.searchError"
:total-results="pageInfo.totalResults"
@searched="searched"
@projectClicked="projectClicked"
@bottomReached="fetchNextPage"
/>
</gl-modal>
<div class="page-title-holder flex-fill d-flex align-items-center">
......
---
title: Fix Infinite Scrolling on Environments Dashboard Project Selector
merge_request: 20408
author:
type: fixed
......@@ -29,6 +29,7 @@ describe('dashboard', () => {
removeProject: jest.fn(),
toggleSelectedProject: jest.fn(),
fetchNextPage: jest.fn(),
fetchProjects: jest.fn(),
};
propsData = {
addPath: 'mock-addPath',
......@@ -42,7 +43,6 @@ describe('dashboard', () => {
localVue,
store,
methods: {
fetchProjects: () => {},
...actionSpies,
},
});
......@@ -135,6 +135,16 @@ describe('dashboard', () => {
wrapper.find(ProjectSelector).vm.$emit('projectClicked', { name: 'test', id: 1 });
expect(actionSpies.toggleSelectedProject).toHaveBeenCalledWith({ name: 'test', id: 1 });
});
it('should fetch the next page when bottom is reached', () => {
wrapper.find(ProjectSelector).vm.$emit('bottomReached');
expect(actionSpies.fetchNextPage).toHaveBeenCalled();
});
it('should get the page info from the state', () => {
store.state.pageInfo = { totalResults: 100 };
expect(wrapper.find(ProjectSelector).props('totalResults')).toBe(100);
});
});
});
});
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