New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

chai-react

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chai-react

React assertions for the Chai assertion library

  • 4.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Build Status

chai-react

chai-react is an extension to the chai assertion library that provides a set of React-specific assertions.

rquery

Although chai-react is still a great tool for making assertions on components themselves, it started getting a little bloated by trying to solve two problems at once: React tree traversal and tree assertions.

A new library called rquery makes a better attempt at focusing on React tree traversal, and leaving assertions to chai-react. It provides an interface similar to jQuery for traversing rendered React trees. Use rquery to traverse your component's tree, and then chai-react to make assertions on that traversal.

Example:

var $component = $R(component);
expect($component.find('MyComponent')[0]).to.have.prop('something');
expect($component.find('div')[0]).to.have.prop('id', 'abc');

// simulate events
expect($component.find('.save-notice')).to.have.length(0);
$component.find('button.save').click();
expect($component.find('.save-notice')).to.have.length(1);

Contributing

To run the test suite, run npm install (requires Node.js to be installed on your system), and open test/index.html in your web browser.

License

Copyright (c) 2014 Andrew Hanna

MIT License (see the LICENSE file)

Credits

Thanks to John Firebaugh for providing chai-jquery, which served as a foundation for this plugin.

Keywords

FAQs

Package last updated on 28 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc