Assert Equal Jsx Save

assertEqualJSX

Project README

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
  }
)
Open Source Agenda is not affiliated with "Assert Equal Jsx" Project. README Source: jamiebuilds/assert-equal-jsx
Stars
78
Open Issues
0
Last Commit
7 years ago
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating