Files
Ryan Stelly b78be9243d lint rule & autofix for "trailing comma" (#3299)
* (lint) MOB-1063 enforce trailing commas

* autofix trailing commas

* manually fix newly introduced maxlen violations

* add trailing comma convention to i18n build
2025-12-22 20:17:13 -06:00

59 lines
1.8 KiB
JavaScript

import { render, screen } from "@testing-library/react-native";
import { Button } from "components/SharedComponents";
import React from "react";
// Mock Appearance.getColorScheme()
jest.mock( "react-native/Libraries/Utilities/Appearance", () => {
const actualAppearance = jest.requireActual( "react-native/Libraries/Utilities/Appearance" );
return {
...actualAppearance,
getColorScheme: jest.fn( () => "dark" ),
};
} );
// Mock nativewind useColorScheme()
jest.mock( "nativewind", () => {
const actualNativewind = jest.requireActual( "nativewind" );
return {
...actualNativewind,
useColorScheme: jest.fn( () => ( { colorScheme: "dark" } ) ),
};
} );
describe.each( [["primary"], ["warning"], ["focus"], ["neutral"]] )(
"Button %s in dark mode",
level => {
it( "should render correctly", () => {
render( <Button level={level} text={`${level.toUpperCase()} BUTTON`} /> );
// Snapshot test
expect( screen ).toMatchSnapshot();
} );
it( "has no accessibility errors", () => {
// const button = <Button level={level} text={`${level.toUpperCase()} BUTTON`} />;
// Disabled during the update to RN 0.78
// expect( button ).toBeAccessible();
} );
describe( "when disabled", () => {
it( "should render correctly", () => {
render( <Button level={level} text={`${level.toUpperCase()} DISABLED`} disabled /> );
// Snapshot test
expect( screen ).toMatchSnapshot();
} );
it( "has no accessibility errors", () => {
// const button = (
// <Button level={level} text={`${level.toUpperCase()} DISABLED`} disabled />
// );
// Disabled during the update to RN 0.78
// expect( button ).toBeAccessible();
} );
} );
},
);