Moti Zilberman 1971b7e87d
feat(react-jsx-source): add columnNumber property (#11139)
* feat(react-jsx-source): add column property

This will be useful to tools that consume the injected `__source` prop, allowing precise source locations to be displayed.

* Rename column -> columnNumber, make 1-based
2020-03-16 22:59:22 +01:00

21 lines
423 B
JavaScript

const actual = transform(
'<Foo bar="baz" />',
Object.assign({}, opts, { filename: '/fake/path/mock.js' })
).code;
const expected = multiline([
'var _jsxFileName = "/fake/path/mock.js";',
'React.createElement(Foo, {',
' bar: "baz",',
' __source: {',
' fileName: _jsxFileName,',
' lineNumber: 1,',
' columnNumber: 1',
' },',
' __self: this',
'});',
]);
expect(actual).toBe(expected);