Skip to content

Commit 814c89c

Browse files
author
Nate Piche
committed
Makes regex more robust in html() based on review feedback
1 parent a934af9 commit 814c89c

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/ReactWrapper.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,7 @@ export default class ReactWrapper {
293293
* @returns {String}
294294
*/
295295
html() {
296-
<<<<<<< HEAD
297296
return this.single(n => findDOMNode(n).outerHTML.replace(/\sdata-reactid+="[^"]+"/g, ''));
298-
=======
299-
return this.single(n => findDOMNode(n).outerHTML.replace(/\sdata-reactid[^>]+/g, ''));
300-
>>>>>>> Add method, tests, and docs for html method in ReactWrapper
301297
}
302298

303299
/**

src/__tests__/ReactWrapper-spec.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,6 +1213,21 @@ describeWithDOM('mount', () => {
12131213
`<div class="in-foo"></div>`
12141214
);
12151215
});
1216+
<<<<<<< HEAD
1217+
=======
1218+
1219+
it('should remove all data-react attributes from anywhere in the HTML', () => {
1220+
const wrapper = mount(
1221+
<div data-react-props="begone" data-react-class="begone" className="test">
1222+
<span>Hello World!</span>
1223+
</div>
1224+
);
1225+
expect(wrapper.html()).to.equal(
1226+
`<div class="test"><span>Hello World!</span></div>`
1227+
);
1228+
});
1229+
1230+
>>>>>>> Makes regex more robust in html() based on review feedback
12161231
});
12171232

12181233
});

0 commit comments

Comments
 (0)