Skip to content

Commit

Permalink
Change ReactMultiChild test to check for innerHTML descriptor.
Browse files Browse the repository at this point in the history
Not all testing environments will support setting the `innerHTML` descriptor. For example, PhantomJS initializes the `innerHTML` property as not configurable.
  • Loading branch information
yungsters committed Jul 28, 2013
1 parent c347b72 commit 4cb49f5
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/core/__tests__/ReactMultiChild-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,19 @@ describe('ReactMultiChild', function() {
var React;
var setInnerHTML;

// Only run this test suite if `Element.prototype.innerHTML` can be spied on.
var innerHTMLDescriptor = Object.getOwnPropertyDescriptor(
Element.prototype,
'innerHTML'
);
if (!innerHTMLDescriptor) {
return;
}

beforeEach(function() {
require('mock-modules').dumpCache();
React = require('React');

var innerHTMLDescriptor = Object.getOwnPropertyDescriptor(
Element.prototype,
'innerHTML'
);
Object.defineProperty(Element.prototype, 'innerHTML', {
set: setInnerHTML = jasmine.createSpy().andCallFake(
innerHTMLDescriptor.set
Expand Down

0 comments on commit 4cb49f5

Please sign in to comment.