assert-equal-jsx
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/assert-equal-jsx package

1.0.3 • Public • Published

assertEqualJSX

Example of output

API

assertEqualJSX(jsx, jsx, [opts]);

Example

assertEqualJSX(
  <MyComponent/>,
  // should equal:
  <div className="my-component">
    <h1>Hello world</h1>
    <p>Look at this amazing component</p>
  </div>
)

opts.sanitize

function sanitizeId(str) {
  return str.replace(/my-component-id-(\d+)/ig, 'my-component-id-0');
}
 
assertEqualJSX(
  <div id="my-component-id-314159265"/>,
  // should equal:
  <div id="my-component-id-0">,
  // with sanitization:
  {
    sanitize: sanitizeId
  }
)

Readme

Keywords

none

Package Sidebar

Install

npm i assert-equal-jsx

Weekly Downloads

21

Version

1.0.3

License

MIT

Last publish

Collaborators

  • thejameskyle