1.2.28 • Published 5 years ago

describe-react v1.2.28

Weekly downloads
137
License
-
Repository
github
Last release
5 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

5 years ago

1.2.28

5 years ago

1.2.25

5 years ago

1.2.26

5 years ago

1.2.24

5 years ago

1.2.18

5 years ago

1.2.19

5 years ago

1.2.20

5 years ago

1.2.23

5 years ago

1.2.21

5 years ago

1.2.22

5 years ago

1.2.13

5 years ago

1.2.16

5 years ago

1.2.17

5 years ago

1.2.14

5 years ago

1.2.15

5 years ago

1.2.12

5 years ago

1.2.11

5 years ago

1.2.9

5 years ago

1.2.10

5 years ago

1.2.8

5 years ago

1.2.7

5 years ago

1.2.6

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.12

5 years ago

1.0.9

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago