1.2.28 • Published 4 years ago

describe-react v1.2.28

Weekly downloads
137
License
-
Repository
github
Last release
4 years ago

describe-react

Write your react tests in JSX

// list.test.js

import React from 'react'
import run, { Describe, Expect, Render, Trigger } from 'describe-react'

// A component with hooks to test
function Counter() {
  const [counter, setCounter] = React.useState(0)
  function increment() {
    setCounter(counter + 1)
  }
  return (
    <button onClick={ increment }>
      { counter }
    </button>
  )
}

run(() => (
  <Describe label="Counter">
    <Render>
      <Counter />
    </Render>
    
    <Expect element="button">
      <To have text="0" />
    </Expect>

    <Trigger event="click" to element="button" />

    <Expect element="button">
      <To have text="1" />
    </Expect>
  </Describe>
))
jest list.test
PASS  list.test.js
Quick usage
  Expect element="button"
    ✓ to have text "0"
  Trigger
    ✓ event="click" to element="button"
  Expect element="button"
    ✓ to have text "1"

View documentation

1.2.27

4 years ago

1.2.28

4 years ago

1.2.25

4 years ago

1.2.26

4 years ago

1.2.24

4 years ago

1.2.18

4 years ago

1.2.19

4 years ago

1.2.20

4 years ago

1.2.23

4 years ago

1.2.21

4 years ago

1.2.22

4 years ago

1.2.13

4 years ago

1.2.16

4 years ago

1.2.17

4 years ago

1.2.14

4 years ago

1.2.15

4 years ago

1.2.12

4 years ago

1.2.11

4 years ago

1.2.9

4 years ago

1.2.10

4 years ago

1.2.8

4 years ago

1.2.7

4 years ago

1.2.6

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.12

4 years ago

1.0.9

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago