this.renderBulkButton()
)}
{!usingPermalink && (
- <PageActions
- loading={this.state.loading}
- onReload={this.handleReload}
- paging={paging}
- selectedIndex={selectedIndex}
- />
+ <PageActions paging={paging} selectedIndex={selectedIndex} />
)}
</div>
</div>
*/
import * as React from 'react';
import PageCounter from '../../../components/common/PageCounter';
-import ReloadButton from '../../../components/controls/ReloadButton';
-import DeferredSpinner from '../../../components/ui/DeferredSpinner';
import PageShortcutsTooltip from '../../../components/ui/PageShortcutsTooltip';
import { translate } from '../../../helpers/l10n';
import { Paging } from '../../../types/types';
export interface PageActionsProps {
- loading: boolean;
- onReload: () => void;
paging?: Paging;
selectedIndex?: number;
}
upAndDownLabel={translate('coding_rules.to_select_rules')}
/>
- <DeferredSpinner loading={props.loading}>
- <ReloadButton onClick={props.onReload} />
- </DeferredSpinner>
-
{props.paging && (
<PageCounter
className="spacer-left"
it('should render correctly', () => {
expect(shallowRender()).toMatchSnapshot('default');
- expect(shallowRender({ loading: true })).toMatchSnapshot('loading');
expect(shallowRender({ paging: { total: 100 } as Paging })).toMatchSnapshot('with paging');
});
function shallowRender(props: Partial<PageActionsProps> = {}) {
- return shallow<PageActionsProps>(<PageActions loading={false} onReload={jest.fn()} {...props} />);
+ return shallow<PageActionsProps>(<PageActions {...props} />);
}
total={0}
/>
<PageActions
- loading={false}
- onReload={[Function]}
paging={
Object {
"pageIndex": 0,
className="display-flex-space-between"
>
<div />
- <PageActions
- loading={true}
- onReload={[Function]}
- />
+ <PageActions />
</div>
</div>
</div>
leftAndRightLabel="issues.to_navigate"
upAndDownLabel="coding_rules.to_select_rules"
/>
- <DeferredSpinner
- loading={false}
- >
- <ReloadButton
- onClick={[MockFunction]}
- />
- </DeferredSpinner>
-</div>
-`;
-
-exports[`should render correctly: loading 1`] = `
-<div
- className="display-flex-center"
->
- <PageShortcutsTooltip
- className="big-spacer-right"
- leftAndRightLabel="issues.to_navigate"
- upAndDownLabel="coding_rules.to_select_rules"
- />
- <DeferredSpinner
- loading={true}
- >
- <ReloadButton
- onClick={[MockFunction]}
- />
- </DeferredSpinner>
</div>
`;
leftAndRightLabel="issues.to_navigate"
upAndDownLabel="coding_rules.to_select_rules"
/>
- <DeferredSpinner
- loading={false}
- >
- <ReloadButton
- onClick={[MockFunction]}
- />
- </DeferredSpinner>
<PageCounter
className="spacer-left"
label="coding_rules._rules"