Ninja Power Manifesto

    chai-jsx

    1.0.1 • Public • Published

    chai-jsx

    JSX React Element assertions for chai. Thin wrapper around react-element-to-jsx-string.

    NPM version Build Status

    Compare different React elements:

    expect(<Component />).jsx.to.equal(<Component />);
    expect(<Component />).jsx.to.not.equal(<Component prop={value} />);
    expect(<Component />).jsx.to.not.equal(<OtherComponent />);
    expect(<Component />).jsx.to.not.equal(<div />);
    expect(<Component><div /></Component>).jsx.to.equal(<Component><div /></Component>);
    expect(<Component><div /></Component>).jsx.to.not.equal(<Component><span /></Component>);

    Installation

    This is a addon plugin for the Chai Assertion Library. Install via npm.

    npm install chai-jsx
    

    Plugin

    Use this plugin as you would all other Chai plugins.

    var chai = require('chai')
      , chaiJsx = require('chai-jsx');
     
    chai.use(chaiJsx);

    Install

    npm i chai-jsx

    DownloadsWeekly Downloads

    186

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • ckknight