Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
johnomalley opened this issue Jul 11, 2018 · 0 comments
Open

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

johnomalley opened this issue Jul 11, 2018 · 0 comments

Comments

@johnomalley
Copy link

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"
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant