enzymejs/enzyme

Shallow(<SomeComponent />).is(SomeComponent) returns false

Open

#768 建立於 2017年1月12日

在 GitHub 查看
 (14 留言) (0 反應) (0 負責人)JavaScript (19,979 star) (2,016 fork)batch import
API: mountbughelp wanted

描述

Basically, this fails:

it('should be true', () => {
  const SomeComponent = () => (<div></div>);
  expect(shallow(<SomeComponent />).is(SomeComponent)).to.be.true;
});

while this works:

  // require('jsdom')...
  it('should be true', () => {
    const SomeComponent = () => (<div></div>);
    expect(mount(<SomeComponent />).is(SomeComponent)).to.be.true;
  });

Am I wrong to assume the first one should work too?

貢獻者指南