mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2025-12-30 17:38:48 -05:00
* Update tooltip trigger logic in AddObsButton for logged in Refines the tooltip display conditions for AddObsButton. Now shows the tooltip for logged-out users after their second observation, and for logged-in users with 50 or fewer observations upon landing on the My Observations screen. Adds comments for future handling of users with more than 50 observations. * Refactor the state justFinishedSignup into the layout store slice * Refactor trigger logic and add conditions for when the tooltip would overlap with pivot cards * Move files * Basic AddObsButton unit test * Add mock for addListener * Basic test for tooltip * Add tests for two conditions that require a card dismissal * Wrap setState in act in helper function
22 lines
653 B
JavaScript
22 lines
653 B
JavaScript
import { render, screen } from "@testing-library/react-native";
|
|
import AddObsModal from "components/AddObsModal/AddObsModal.tsx";
|
|
import i18next from "i18next";
|
|
import React from "react";
|
|
|
|
// Make sure the mock is using a recent-ish version
|
|
jest.mock( "react-native/Libraries/Utilities/Platform", ( ) => ( {
|
|
OS: "ios",
|
|
select: jest.fn( ),
|
|
Version: 11
|
|
} ) );
|
|
|
|
describe( "AddObsModal", ( ) => {
|
|
it( "shows the AI camera button", async ( ) => {
|
|
render( <AddObsModal closeModal={jest.fn( )} /> );
|
|
const aiCameraButton = screen.getByLabelText(
|
|
i18next.t( "AI-Camera" )
|
|
);
|
|
expect( aiCameraButton ).toBeOnTheScreen();
|
|
} );
|
|
} );
|