import * as React from 'react';
import { getProfileProjects } from '../../../api/quality-profiles';
import Link from '../../../components/common/Link';
-import { Button } from '../../../components/controls/buttons';
import ListFooter from '../../../components/controls/ListFooter';
import Tooltip from '../../../components/controls/Tooltip';
+import { Button } from '../../../components/controls/buttons';
import QualifierIcon from '../../../components/icons/QualifierIcon';
import { translate } from '../../../helpers/l10n';
import { getProjectUrl } from '../../../helpers/urls';
}
this.setState({ loading: true });
- const data = { key: this.props.profile.key, page: this.state.page };
+ const data = { key: this.props.profile.key, p: 1 };
getProfileProjects(data).then(({ paging, results }) => {
if (this.mounted) {
this.setState({
projects: results,
total: paging.total,
loading: false,
+ page: 1,
});
}
}, this.stopLoading);
loadMore = () => {
this.setState({ loadingMore: true });
- const data = { key: this.props.profile.key, page: this.state.page + 1 };
+ const data = { key: this.props.profile.key, p: this.state.page + 1 };
getProfileProjects(data).then(({ paging, results }) => {
if (this.mounted) {
this.setState((state) => ({
projects: [...state.projects, ...results],
total: paging.total,
loadingMore: false,
+ page: state.page + 1,
}));
}
}, this.stopLoading);
*/
import { shallow } from 'enzyme';
import * as React from 'react';
+import { getProfileProjects } from '../../../../api/quality-profiles';
import { mockQualityProfile } from '../../../../helpers/testMocks';
import { waitAndUpdate } from '../../../../helpers/testUtils';
import ChangeProjectsForm from '../ChangeProjectsForm';
});
wrapper.setState({ projects: [] });
expect(wrapper).toMatchSnapshot('no active rules, no associated projects');
+ wrapper.instance().loadMore();
+ expect(getProfileProjects).toHaveBeenLastCalledWith({ p: 2, key: 'key' });
});
it('should open and close the form', async () => {