mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
7ad862eaba
Summary: This diff adds the ability to press the file name of a code frame to open the file in your editor. Note: I re-worked the frame location to extract the frame row and column at parse time so that we don't need to do any clowny regexes down stream. Changelog: [Internal] Reviewed By: cpojer Differential Revision: D18358283 fbshipit-source-id: 705e07d229c66ecfd225a8fb65ef2f78b5034c9c
45 lines
1.1 KiB
JavaScript
45 lines
1.1 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 LogBoxInspectorCodeFrame = require('../LogBoxInspectorCodeFrame').default;
|
|
const render = require('../../../../jest/renderer');
|
|
|
|
describe('LogBoxInspectorCodeFrame', () => {
|
|
it('should render null for no code frame', () => {
|
|
const output = render.shallowRender(
|
|
<LogBoxInspectorCodeFrame codeFrame={null} />,
|
|
);
|
|
|
|
expect(output).toMatchSnapshot();
|
|
});
|
|
|
|
it('should render a code frame', () => {
|
|
const output = render.shallowRender(
|
|
<LogBoxInspectorCodeFrame
|
|
codeFrame={{
|
|
fileName: '/path/to/RKJSModules/Apps/CrashReact/CrashReactApp.js',
|
|
location: {row: 199, column: 0},
|
|
content: ` 197 | });
|
|
198 |
|
|
> 199 | export default CrashReactApp;
|
|
| ^
|
|
200 |`,
|
|
}}
|
|
/>,
|
|
);
|
|
|
|
expect(output).toMatchSnapshot();
|
|
});
|
|
});
|