How to test style for a React component attribute with Enzyme

前端 未结 10 1009
刺人心
刺人心 2020-12-09 07:21

I am trying to test a style attribute for a React component. What is the best way to get style params in the test?

At this moment, my best option is to test if the H

10条回答
  •  难免孤独
    2020-12-09 08:10

    I don't know if Enzyme has changed with recent versions but I needed parentheses after props in order to get the top answer to work.

    containerStyle = container.get(0).props().style;

提交回复
热议问题