mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-04-19 06:23:12 -04:00
* UploadStatus component * Added UploadStatus to SharedComponents/index.js * Change upload complete icon and color * QualityGradeStatus accessibility labels * Saved Observation Animation for UploadStatus * Changed widths of component * Unit test for UploadStatus * Unit test and snapshot for UploadStatus * Update snapshot tests * Changes requested, accessibility labels for UploadStatus progress, accessibility tests * Update snapshot tests * Testing updated snapshot test * Fix style * And again --------- Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
41 lines
1.5 KiB
JavaScript
41 lines
1.5 KiB
JavaScript
import { render, screen } from "@testing-library/react-native";
|
|
import { UploadStatus } from "components/SharedComponents";
|
|
import React from "react";
|
|
|
|
jest.mock( "react-native-circular-progress-indicator", () => "CircularProgress" );
|
|
|
|
jest.mock( "react-native/Libraries/Animated/NativeAnimatedHelper" );
|
|
describe( "UploadStatus", () => {
|
|
it( "does not show progress bar when progress is less than 5%", async () => {
|
|
render( <UploadStatus progress={0.01} color="#454545" completeColor="#77b300" /> );
|
|
|
|
expect( screen.queryByTestId( "UploadStatus.CircularProgress" ) ).toBeFalsy();
|
|
} );
|
|
|
|
it( "shows progress bar when progress is greater than 5%", async () => {
|
|
render( <UploadStatus progress={0.5} color="#454545" completeColor="#77b300" /> );
|
|
|
|
expect( screen.getByTestId( "UploadStatus.CircularProgress" ) ).toBeTruthy();
|
|
} );
|
|
|
|
it( "displays progress bar when progress is less than 5% correctly", async () => {
|
|
render( <UploadStatus progress={0.01} color="#454545" completeColor="#77b300" /> );
|
|
// Snapshot test
|
|
expect( screen ).toMatchSnapshot();
|
|
} );
|
|
|
|
it( "displays progress bar when progress is greater than 5% correctly", async () => {
|
|
render( <UploadStatus progress={0.5} color="#454545" completeColor="#77b300" /> );
|
|
// Snapshot test
|
|
expect( screen ).toMatchSnapshot();
|
|
} );
|
|
|
|
it( "has no accessibility errors", () => {
|
|
const uploadStatus = (
|
|
<UploadStatus progress={0.5} color="#454545" completeColor="#77b300" />
|
|
);
|
|
|
|
expect( uploadStatus ).toBeAccessible();
|
|
} );
|
|
} );
|