Skip to content

.should.have.html(...) broken in 1.0.0-beta.1Β #222

@johnomalley

Description

@johnomalley

I upgraded from beta.0 to beta.1 and a test case broke. This snippet demonstrates the bug:

import React from 'react'
import chai from 'chai'
import chaiAsPromised from 'chai-as-promised'
import sinonChai from 'sinon-chai'
import sinon from 'sinon'
import chaiEnzyme from 'chai-enzyme'
import Enzyme, { shallow } from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'

global.should = chai.should()
global.expect = chai.expect
chai.use(chaiAsPromised)
chai.use(sinonChai)
chai.use(chaiEnzyme())

global.sinon = sinon
Enzyme.configure({adapter: new Adapter()})

describe.only('Example', () => {
  it('does not compare with html', () => {
    const wrapper = shallow(
      <div>
        <div className='example'/>
      </div>
    )

    wrapper.find('.example').should.have.html('<div class="example"/>')
  })
})

output:

 0 passing (523ms)
  1 failing

  1) Example
       does not compare with html:

      AssertionError: expected the node in <div /> to be '<div class="example"/>', but it was '<div className="example" />'      
     
     HTML:
     
     <div className="example" />
      + expected - actual

      -<div className="example" />
      +<div class="example"/>

relevant dependencies:

{
  "devDependencies": {
    "chai": "~4.1.2",
    "chai-as-promised": "~7.1.1",
    "chai-enzyme": "~1.0.0-beta.1",
    "enzyme": "~3.3.0",
    "enzyme-adapter-react-16": "~1.1.1",
    "mocha": "~5.2.0",
    "react": "~16.4.1",
    "react-dom": "~16.4.1",
    "react-router-dom": "~4.3.1",
    "react-test-renderer": "~16.4.1",
    "sinon": "~6.1.3",
    "sinon-chai": "~3.2.0"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions