{"action":"closed","issue":{"url":"https://api.github.com/repos/airbnb/enzyme/issues/1397","repository_url":"https://api.github.com/repos/airbnb/enzyme","labels_url":"https://api.github.com/repos/airbnb/enzyme/issues/1397/labels{/name}","comments_url":"https://api.github.com/repos/airbnb/enzyme/issues/1397/comments","events_url":"https://api.github.com/repos/airbnb/enzyme/issues/1397/events","html_url":"https://github.com/airbnb/enzyme/issues/1397","id":277521049,"node_id":"MDU6SXNzdWUyNzc1MjEwNDk=","number":1397,"title":"Enzyme 3.2.0 not properly detecting length returned by cheerio.","user":{"login":"mrbinky3000","id":161068,"node_id":"MDQ6VXNlcjE2MTA2OA==","avatar_url":"https://avatars1.githubusercontent.com/u/161068?v=4","gravatar_id":"","url":"https://api.github.com/users/mrbinky3000","html_url":"https://github.com/mrbinky3000","followers_url":"https://api.github.com/users/mrbinky3000/followers","following_url":"https://api.github.com/users/mrbinky3000/following{/other_user}","gists_url":"https://api.github.com/users/mrbinky3000/gists{/gist_id}","starred_url":"https://api.github.com/users/mrbinky3000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrbinky3000/subscriptions","organizations_url":"https://api.github.com/users/mrbinky3000/orgs","repos_url":"https://api.github.com/users/mrbinky3000/repos","events_url":"https://api.github.com/users/mrbinky3000/events{/privacy}","received_events_url":"https://api.github.com/users/mrbinky3000/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-11-28T20:07:12Z","updated_at":"2018-07-07T16:51:03Z","closed_at":"2018-07-07T16:51:03Z","author_association":"NONE","body":"Using enzyme@3.2.0 and enzyme-react-adapter@1.1.0 and given a very simple React component named Blurb with a render() method of...\r\n\r\n```\r\n  render() {\r\n    const Tag = 'div';\r\n\r\n    return (\r\n        <Tag\r\n          className={this.props.classes}\r\n          dangerouslySetInnerHTML={{ __html: this.props.html }}\r\n          ref={(el) => { this.el = el; }}\r\n        />\r\n    );\r\n```\r\n\r\nthe following test fails...\r\n\r\n```\r\n    it('should render a <div> with <span>Hello World!</span> as html', () => {\r\n      const string = '<span>Hello World!</span>';\r\n      const wrapper = render(\r\n        <Blurb html={string} />\r\n      );\r\n     \r\n      // these assertions fail\r\n      expect(wrapper.find('div').length).toBe(1);\r\n      expect(wrapper.find('span').length).toBe(1); \r\n      expect(wrapper.find('span').text()).toBe('Hello World!');\r\n    });\r\n```\r\n\r\nThe first assertion, `wrapper.find('div')` has a length of zero.  However, adding\r\n`console.log(wrapper.find('div'))` above `// these assertions fail` shows that the div tag does exist.  Here is the output from that debug statement.  \r\n\r\n```javascript\r\ninitialize {\r\n  options: {\r\n    withDomLvl1: true,\r\n    normalizeWhitespace: false,\r\n    xml: false,\r\n    decodeEntities: true\r\n  },\r\n  _root: initialize {\r\n    '0' : {\r\n      type: 'tag',\r\n      name: 'div',\r\n      namespace: 'http://www.w3.org/1999/xhtml',\r\n      attribs: [Object],\r\n      'x-attribsNamespace': [Object],\r\n      'x-attribsPrefix': [Object],\r\n      children: [Object],\r\n      parent: null,\r\n      prev: null,\r\n      next: null,\r\n      root: [Object]\r\n    },\r\n    options: {\r\n      withDomLvl1: true,\r\n      normalizeWhitespace: false,\r\n      xml: false,\r\n      decodeEntities: true\r\n    },\r\n    length: 1,\r\n    _root: [Circular]\r\n  },\r\n  length: 0,\r\n  prevObject: initialize {\r\n    '0' : {\r\n      type: 'tag',\r\n      name: 'div',\r\n      namespace: 'http://www.w3.org/1999/xhtml',\r\n      attribs: [Object],\r\n      'x-attribsNamespace': [Object],\r\n      'x-attribsPrefix': [Object],\r\n      children: [Object],\r\n      parent: null,\r\n      prev: null,\r\n      next: null,\r\n      root: [Object]\r\n    },\r\n    options: {\r\n      withDomLvl1: true,\r\n      normalizeWhitespace: false,\r\n      xml: false,\r\n      decodeEntities: true\r\n    },\r\n    length: 1,\r\n    _root: [Circular]\r\n  }\r\n}\r\n```\r\n\r\nIt seems that, perhaps, Cheerio has updated the shape of the object returned by the cheerio find() method and Enzyme is perhaps looking in the wrong place to retrieve the `length: 1` shown in the debug output."}}
{"actor":{"display_login":"ljharb"}}