diff --git a/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorHeader-itest.js b/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorHeader-itest.js index 17d10850fd2b..7b95ae6b0370 100644 --- a/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorHeader-itest.js +++ b/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorHeader-itest.js @@ -12,6 +12,7 @@ import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; import LogBoxInspectorHeader from '../LogBoxInspectorHeader'; import * as Fantom from '@react-native/fantom'; +import nullthrows from 'nullthrows'; import * as React from 'react'; describe('LogBoxInspectorHeader', () => { @@ -49,18 +50,29 @@ describe('LogBoxInspectorHeader', () => { it('should render two buttons for three or more total', () => { const root = Fantom.createRoot(); + const onSelectIndex = jest.fn(); Fantom.runTask(() => { root.render( {}} + onSelectIndex={onSelectIndex} selectedIndex={0} - total={1} + total={3} level="warn" />, ); }); expect(root.getRenderedOutput().toJSX()).toMatchSnapshot(); + + Fantom.dispatchNativeEvent( + nullthrows(root.document.getElementById('logbox_header_button_prev')), + 'click', + ); + Fantom.dispatchNativeEvent( + nullthrows(root.document.getElementById('logbox_header_button_next')), + 'click', + ); + expect(onSelectIndex.mock.calls).toEqual([[2], [1]]); }); it('should render syntax error header', () => { diff --git a/packages/react-native/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspector-itest.js.snap b/packages/react-native/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspector-itest.js.snap index f1fe5f55a826..a59895fb00fe 100644 --- a/packages/react-native/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspector-itest.js.snap +++ b/packages/react-native/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspector-itest.js.snap @@ -8,67 +8,69 @@ exports[`LogBoxInspector should render fatal with selectedIndex 2 1`] = ` > - - - - - Log 3 of 3 - - - + + + + > + Log 3 of 3 + + + + - - Dismiss - + + Dismiss + + - - Minimize - + + Minimize + + - - Copy - + + Copy + + @@ -197,67 +214,69 @@ exports[`LogBoxInspector should render warning with selectedIndex 0 1`] = ` > - - - - - Log 1 of 3 - - - + + + + > + Log 1 of 3 + + + + - - Dismiss - + + Dismiss + + - - Minimize - + + Minimize + + - - Copy - + + Copy + + diff --git a/packages/react-native/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspectorFooter-itest.js.snap b/packages/react-native/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspectorFooter-itest.js.snap index e9dfe66c817d..3d47dcfdde25 100644 --- a/packages/react-native/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspectorFooter-itest.js.snap +++ b/packages/react-native/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspectorFooter-itest.js.snap @@ -32,58 +32,73 @@ exports[`LogBoxInspectorFooter should render two buttons for error 1`] = ` flexDirection="row" > - - Dismiss - + + Dismiss + + - - Minimize - + + Minimize + + - - Copy - + + Copy + + `; @@ -94,58 +109,73 @@ exports[`LogBoxInspectorFooter should render two buttons for fatal 1`] = ` flexDirection="row" > - - Dismiss - + + Dismiss + + - - Minimize - + + Minimize + + - - Copy - + + Copy + + `; @@ -156,58 +186,73 @@ exports[`LogBoxInspectorFooter should render two buttons for warning 1`] = ` flexDirection="row" > - - Dismiss - + + Dismiss + + - - Minimize - + + Minimize + + - - Copy - + + Copy + + `; diff --git a/packages/react-native/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspectorHeader-itest.js.snap b/packages/react-native/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspectorHeader-itest.js.snap index b6136c251f63..2f617c689a0d 100644 --- a/packages/react-native/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspectorHeader-itest.js.snap +++ b/packages/react-native/Libraries/LogBox/UI/__tests__/__snapshots__/LogBoxInspectorHeader-itest.js.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`LogBoxInspectorHeader should render both buttons for two total 1`] = ` - - + - + `; exports[`LogBoxInspectorHeader should render no buttons for one total 1`] = ` - - + - + `; exports[`LogBoxInspectorHeader should render syntax error header 1`] = ` - - + Failed to compile - + `; exports[`LogBoxInspectorHeader should render two buttons for three or more total 1`] = ` - - + + > + + - Log 1 of 1 + Log 1 of 3 - + > + + + `;