@samitouri / QOS-React-2 / commits / 4cb49f5561

Change `ReactMultiChild` test to check for `innerHTML` descriptor.

Not all testing environments will support setting the `innerHTML` descriptor. For example, PhantomJS initializes the `innerHTML` property as not configurable.

yungsters committed Jul 28, 2013 at 00:59 UTC 4cb49f55619a9ad590d86620ffc37aad27087577
1 file changed +9 -4
src/core/__tests__/ReactMultiChild-test.js
+9 -4
@@ -21,14 +21,19 @@ describe('ReactMultiChild', function() {
21 var React;
22 var setInnerHTML;
23
24 + // Only run this test suite if `Element.prototype.innerHTML` can be spied on.
25 + var innerHTMLDescriptor = Object.getOwnPropertyDescriptor(
26 + Element.prototype,
27 + 'innerHTML'
28 + );
29 + if (!innerHTMLDescriptor) {
30 + return;
31 + }
32 +
33 beforeEach(function() {
34 require('mock-modules').dumpCache();
35 React = require('React');
36
28 - var innerHTMLDescriptor = Object.getOwnPropertyDescriptor(
29 - Element.prototype,
30 - 'innerHTML'
31 - );
37 Object.defineProperty(Element.prototype, 'innerHTML', {
38 set: setInnerHTML = jasmine.createSpy().andCallFake(
39 innerHTMLDescriptor.set