Skip to content

Commit 88ae2ba

Browse files
authored
Merge pull request #13 from oslabs-beta/loader-styles-test
Added new test, fixed failing test, updated error loader styles
2 parents 902600e + e87efcd commit 88ae2ba

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

src/app/__tests__/ActionContainer.test.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { render, screen, fireEvent } from '@testing-library/react';
55
import '@testing-library/jest-dom/extend-expect';
66
import ActionContainer from '../containers/ActionContainer';
77
import { useStoreContext } from '../store';
8+
import TravelContainer from '../containers/TravelContainer';
89

910
const state = {
1011
tabs: {
@@ -148,3 +149,17 @@ describe('unit testing for ActionContainer', () => {
148149
await expect(dispatch).toHaveBeenCalledTimes(1);
149150
});
150151
});
152+
153+
describe('integration testing for ActionContainer', () => {
154+
beforeEach(() => {
155+
mockeduseStoreContext.mockClear();
156+
dispatch.mockClear();
157+
render(<ActionContainer actionView={true} />);
158+
render(<TravelContainer snapshotsLength={0} />);
159+
});
160+
161+
test('Slider resets on clear button', () => {
162+
fireEvent.click(screen.getAllByRole('button')[0]);
163+
expect(screen.getByRole('slider')).toHaveStyle('left: 0');
164+
});
165+
});

src/app/__tests__/Loader.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Loader from '../components/Loader';
66
describe('unit testing for Loader.tsx', () => {
77
test('renders a loading icon', () => {
88
const { container } = render(<Loader loading={true} result={false} />);
9-
expect(container.firstChild).toHaveClass('css-xp4o0b');
9+
expect(container.firstChild).toHaveClass('css-1tm071a');
1010
});
1111

1212
test('renders a fail icon', () => {

src/app/components/Loader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const handleResult = (result: boolean): JSX.Element =>
1717
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
1818
const Loader = ({ loading, result }): JSX.Element =>
1919
loading ? (
20-
<ClipLoader color='#123abc' size={30} loading={loading} style={{ display: "inline", margin: "0 auto" }}/>
20+
<ClipLoader color='#123abc' size={30} loading={loading} />
2121
) : (
2222
handleResult(result)
2323
);

src/app/styles/layout/_errorContainer.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
justify-content: center;
4141
align-items: center;
4242
}
43+
.loaderChecks span {
44+
margin: 0 auto;
45+
display: inline;
46+
}
4347
h2 {
4448
padding-left: 2%;
4549
padding-right: 2%;

0 commit comments

Comments
 (0)