Skip to content

Commit

Permalink
Makes regex more robust in html() based on review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Nate Piche committed Dec 24, 2015
1 parent a934af9 commit 814c89c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/ReactWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,7 @@ export default class ReactWrapper {
* @returns {String}
*/
html() {
<<<<<<< HEAD
return this.single(n => findDOMNode(n).outerHTML.replace(/\sdata-reactid+="[^"]+"/g, ''));
=======
return this.single(n => findDOMNode(n).outerHTML.replace(/\sdata-reactid[^>]+/g, ''));
>>>>>>> Add method, tests, and docs for html method in ReactWrapper
}

/**
Expand Down
15 changes: 15 additions & 0 deletions src/__tests__/ReactWrapper-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,21 @@ describeWithDOM('mount', () => {
`<div class="in-foo"></div>`
);
});
<<<<<<< HEAD
=======

it('should remove all data-react attributes from anywhere in the HTML', () => {
const wrapper = mount(
<div data-react-props="begone" data-react-class="begone" className="test">
<span>Hello World!</span>
</div>
);
expect(wrapper.html()).to.equal(
`<div class="test"><span>Hello World!</span></div>`
);
});

>>>>>>> Makes regex more robust in html() based on review feedback
});

});

0 comments on commit 814c89c

Please sign in to comment.