mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
8cfa379503
Summary: This diff updates the header pagination logic so that it circles around to the beginning/end when reaching either end of the log list in the LogBox inspector. It also changes the header message for a single log from "Logs" to "Log 1 of 1" Changelog: [Internal] Reviewed By: cpojer Differential Revision: D18091621 fbshipit-source-id: 4d7e5e2cb0eb1a1ed09ca8ad318e6715d674648f
58 lines
1.3 KiB
JavaScript
58 lines
1.3 KiB
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
* @emails oncall+react_native
|
|
* @flow
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
const React = require('react');
|
|
const LogBoxInspectorHeader = require('../LogBoxInspectorHeader').default;
|
|
const render = require('../../../../jest/renderer');
|
|
|
|
describe('LogBoxInspectorHeader', () => {
|
|
it('should render no buttons for one total', () => {
|
|
const output = render.shallowRender(
|
|
<LogBoxInspectorHeader
|
|
onSelectIndex={() => {}}
|
|
selectedIndex={0}
|
|
total={1}
|
|
level="warn"
|
|
/>,
|
|
);
|
|
|
|
expect(output).toMatchSnapshot();
|
|
});
|
|
|
|
it('should render both buttons for two total', () => {
|
|
const output = render.shallowRender(
|
|
<LogBoxInspectorHeader
|
|
onSelectIndex={() => {}}
|
|
selectedIndex={1}
|
|
total={2}
|
|
level="warn"
|
|
/>,
|
|
);
|
|
|
|
expect(output).toMatchSnapshot();
|
|
});
|
|
|
|
it('should render two buttons for three or more total', () => {
|
|
const output = render.shallowRender(
|
|
<LogBoxInspectorHeader
|
|
onSelectIndex={() => {}}
|
|
selectedIndex={0}
|
|
total={1}
|
|
level="warn"
|
|
/>,
|
|
);
|
|
|
|
expect(output).toMatchSnapshot();
|
|
});
|
|
});
|