diff --git a/src/core/__tests__/ReactTextComponent-test.js b/src/core/__tests__/ReactTextComponent-test.js index cbea2d4072..60a8cfc028 100644 --- a/src/core/__tests__/ReactTextComponent-test.js +++ b/src/core/__tests__/ReactTextComponent-test.js @@ -18,12 +18,28 @@ describe('ReactTextComponent', function() { React = require('React'); }); - it('should escape the rootID', function(){ + it('should escape the rootID', function() { var ThisThingShouldBeEscaped = '">>> LULZ <<<"'; var ThisThingWasBeEscaped = '">>> LULZ <<<"'; var thing =
LULZ
; var html = React.renderToString(thing); expect(html).not.toContain(ThisThingShouldBeEscaped); expect(html).toContain(ThisThingWasBeEscaped); - }) + }); + + it('updates a mounted text component in place', function() { + var el = document.createElement('div'); + var inst = React.render(
{'foo'}{'bar'}
, el); + + var foo = inst.getDOMNode().children[0]; + var bar = inst.getDOMNode().children[1]; + expect(foo.tagName).toBe('SPAN'); + expect(bar.tagName).toBe('SPAN'); + + var inst = React.render(
{'baz'}{'qux'}
, el); + // After the update, the spans should have stayed in place (as opposed to + // getting unmounted and remounted) + expect(inst.getDOMNode().children[0]).toBe(foo); + expect(inst.getDOMNode().children[1]).toBe(bar); + }); });