Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add refresh button to rollup page #132

Merged
merged 1 commit into from
Nov 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions public/pages/Rollups/containers/Rollups/Rollups.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,14 @@ describe("<Rollups /> spec", () => {
expect(coreServicesMock.notifications.toasts.addSuccess).toHaveBeenCalledTimes(1);
expect(coreServicesMock.notifications.toasts.addSuccess).toHaveBeenCalledWith(`${testRollup._id} is disabled`);
});

it("calls getRollups when clicking refresh button", async () => {
browserServicesMock.rollupService.getRollups = jest.fn();

const { getByTestId } = renderRollupsWithRouter();

userEvent.click(getByTestId("refreshButton"));

expect(browserServicesMock.rollupService.getRollups).toHaveBeenCalledTimes(1);
});
});
5 changes: 5 additions & 0 deletions public/pages/Rollups/containers/Rollups/Rollups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,11 @@ export default class Rollups extends Component<RollupsProps, RollupsState> {
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiFlexGroup alignItems="center" gutterSize="s">
<EuiFlexItem grow={false}>
<EuiButton iconType="refresh" onClick={this.getRollups} data-test-subj="refreshButton">
Refresh
</EuiButton>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButton disabled={!selectedItems.length} onClick={this.onDisable} data-test-subj="disableButton">
Disable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,26 @@ exports[`<Rollups /> spec renders the component 1`] = `
<div
class="euiFlexGroup euiFlexGroup--gutterSmall euiFlexGroup--alignItemsCenter euiFlexGroup--directionRow euiFlexGroup--responsive"
>
<div
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButton euiButton--primary"
data-test-subj="refreshButton"
type="button"
>
<span
class="euiButtonContent euiButton__content"
>
EuiIconMock
<span
class="euiButton__text"
>
Refresh
</span>
</span>
</button>
</div>
<div
class="euiFlexItem euiFlexItem--flexGrowZero"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,14 @@ describe("<Transforms /> spec", () => {
expect(coreServicesMock.notifications.toasts.addSuccess).toHaveBeenCalledTimes(1);
expect(coreServicesMock.notifications.toasts.addSuccess).toHaveBeenCalledWith(`\"${testTransform2._id}\" is disabled`);
});

it("calls getTransforms when clicking refresh button", async () => {
browserServicesMock.transformService.getTransforms = jest.fn();

const { getByTestId } = renderTransformsWithRouter();

userEvent.click(getByTestId("refreshButton"));

expect(browserServicesMock.transformService.getTransforms).toHaveBeenCalledTimes(1);
});
});