Files
iNaturalistReactNative/tests/unit/components/SharedComponents/Buttons/INatIconButton.test.js
Ken-ichi 5747d4d1d9 Several minor UI fixes (#572)
* use `shrink` tailwind class instead of hard-coded max widths to control
  overflow in a few situations
* fixed some spacing issues with the Toolbar during upload
* center text in buttons by default
* export KebabMenu from SharedComponents (how was it working without this?)
* added some extra colors for debugging purposes
2023-04-17 15:50:39 -07:00

43 lines
989 B
JavaScript

import { render, screen } from "@testing-library/react-native";
import { INatIconButton } from "components/SharedComponents";
import React from "react";
describe( "INatIconButton", () => {
it( "renders correctly", () => {
render(
<INatIconButton
icon="camera"
onPress={( ) => {
// all is well
}}
/>
);
// Snapshot test
expect( screen ).toMatchSnapshot();
} );
it( "throws an error when it receives an inaccessibly small width", ( ) => {
expect( ( ) => render(
<INatIconButton
icon="camera"
width={10}
onPress={( ) => {
// all is well
}}
/>
) ).toThrow( /width/i );
} );
it( "throws an error when it receives an inaccessibly small height", ( ) => {
expect( ( ) => render(
<INatIconButton
icon="camera"
height={10}
onPress={( ) => {
// all is well
}}
/>
) ).toThrow( /height/i );
} );
} );