All Projects β†’ yahoo β†’ jsx-test

yahoo / jsx-test

Licence: other
An easy way to test your React Components (`.jsx` files).

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to jsx-test

best-of-react
πŸ† A ranked list of awesome React open-source libraries and tools. Updated weekly.
Stars: ✭ 364 (+1248.15%)
Mutual labels:  react-components
react-jwt-auth
React JWT Authentication & Authorization example - React.js Login and Registration example
Stars: ✭ 307 (+1037.04%)
Mutual labels:  react-components
git-issue-react-electronjs
βš™οΈ. βš›οΈ. A desktop application created with Electronjs and Reactjs to be cross-platform to manage and track GitHub issues.
Stars: ✭ 21 (-22.22%)
Mutual labels:  react-components
resource-center
New version of the resource center built with ReactJS
Stars: ✭ 89 (+229.63%)
Mutual labels:  react-components
react-semantic-render
Semantic helper components for rendering content with React.
Stars: ✭ 13 (-51.85%)
Mutual labels:  react-components
react-lds
⚑ React components for the Salesforce Lightning Design System
Stars: ✭ 28 (+3.7%)
Mutual labels:  react-components
cnode-react
a web app for cnode.org with react + react-router + react-redux
Stars: ✭ 23 (-14.81%)
Mutual labels:  react-components
react-simple-image
responsive img tag with cleaner srcset/sizes interface.
Stars: ✭ 29 (+7.41%)
Mutual labels:  react-components
deer-ui
Deer UI δΈ€δΈͺε―ζ’ζ‹”οΌŒθ½»ι‡ηΊ§ηš„ React η»„δ»ΆεΊ“
Stars: ✭ 46 (+70.37%)
Mutual labels:  react-components
orfium-ictinus
This repo will include the building blocks to create the Orfium Parthenons to come ...
Stars: ✭ 20 (-25.93%)
Mutual labels:  react-components
react-sanctum
Easily hook up your React app to Laravel Sanctum and Laravel Fortify
Stars: ✭ 100 (+270.37%)
Mutual labels:  react-components
rebass
βš›οΈ React primitive UI components built with styled-system.
Stars: ✭ 7,844 (+28951.85%)
Mutual labels:  react-components
OpenTrivia
Multiplayer quiz game demo using React and Opentdb API
Stars: ✭ 47 (+74.07%)
Mutual labels:  react-components
Registration-and-Login-using-MERN-stack
Simple Registration and Login component with MERN stack
Stars: ✭ 210 (+677.78%)
Mutual labels:  react-components
hx
A simple, easy to use library for React development in ClojureScript.
Stars: ✭ 244 (+803.7%)
Mutual labels:  react-components
bezier-react
React components library that implements Bezier Design System.
Stars: ✭ 85 (+214.81%)
Mutual labels:  react-components
ancestor
πŸ’€ UI primitives for ReScript and React
Stars: ✭ 144 (+433.33%)
Mutual labels:  react-components
Nectus
A boilerplate Flask API for a Fullstack Project with some additional packages and configuration prebuilt. βš™
Stars: ✭ 32 (+18.52%)
Mutual labels:  react-components
tiny-ui
βš›οΈ A friendly UI component set for React.js
Stars: ✭ 202 (+648.15%)
Mutual labels:  react-components
mint-ui
Design System | React UI components for web
Stars: ✭ 17 (-37.04%)
Mutual labels:  react-components

jsx-test

npm version Build Status Dependency Status devDependency Status

jsx-test is a tool that makes it easy to test '.jsx' files and includes some helpers for testing react components.

The main features of jsx-test are:

  • Includes some helpers to simplify the test of React Components.
  • Assertion methods to check the component renders the correct html based on the given props.
  • Does NOT automock your dependencies.
  • Is much simpler and faster than Jest.
  • Works with mocha, jasmine or any other test framework.

Note: If you would like to require jsx files directly please follow these instructions

Install

npm install --save-dev jsx-test

Usage

simulateEvent

simulateEvent(ReactComponent element, String event, Object? eventData)
simulateEvent(DOMElement element, String event, Object? eventData)

Simulates an event on an element.

renderComponent

ReactElement renderComponent(ReactComponent comp, Object? props, any? children)

Renders a component w/ its props and children.

unmountComponent

Boolean unmountComponent(ReactComponent comp)

Unmount a component.

elementQuerySelector

DOMElement elementQuerySelector(ReactComponent comp, String selector)

Gets 1st child of comp using selector selector

elementQuerySelectorAll

DOMElement[] elementQuerySelectorAll(ReactComponent comp, String selector)

Gets children of comp using selector selector

stubComponent

ReactComponent stubComponent(ReactElement tag, any? children, boolean? showDataProps)
ReactComponent stubComponent(String tag, any? children, boolean? showDataProps)

Creates a stub component with tag and its children. If showDataProps is true, all props will be set in the rendered DOMElement in the form of data-<propKey> = <propValue>.

withContext

ReactComponent withContext(ReactComponent Component, Object context)

Wraps component in a context creating component.

assertRender

assertRender(ReactComponent Component, Object props, String expectedHTML)

Assert component render matches the expectedHTML. The expectedHTML regex conversion can be seen here.

assertNotRender

assertNotRender(ReactComponent Component, Object props, String unexpectedHTML)

The reverse of assertRender.

Example

Check our examples and tests.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].