Component test utils

Component test utils

  • Philosophy
  • Doc
  • Blog

›Shallow

Introduction

  • Documentation
  • Getting Started

Shallow

  • shallow/constructor
  • shallow/html
  • shallow/props
  • shallow/setProps
  • shallow/querySelector
  • shallow/querySelectors
  • shallow/exists
  • shallow/dispatchEvent
  • shallow/unmount

Frameworks

  • api-react
  • api-vuejs
  • api-angular
  • api-vanilla

shallow/props

props

Property of shallow object that expose property of the component

Example

React

const cmp = shallow(<Component prop1={42} prop="someData"/>);

cmp.setProps({
  prop1: 34
});

expect(cmp.props).toEqual({
  prop1: 34,
  prop: 'someData'
});
← shallow/htmlshallow/setProps →
  • props
    • Example
Component test utils
Docs
Getting StartedAPI Reference
More
BlogGitHubStar
MIT Copyright © 2020 Florent Berthelot