Skip to content

Commit

Permalink
Switch style test to pass in jsdom
Browse files Browse the repository at this point in the history
This should be testing approximately the same thing and passes in Jest.

Test Plan: Cherry-pick Jest config from facebook#1528 and verify that running `jest`.
  • Loading branch information
sophiebits committed May 19, 2014
1 parent ab58ece commit 4e5ed83
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/browser/ui/__tests__/ReactDOMComponent-test.js
Expand Up @@ -70,7 +70,7 @@ describe('ReactDOMComponent', function() {
});

it("should update styles when mutating style object", function() {
var styles = { display: 'none', fontFamily: 'Arial', opacity: 0 };
var styles = { display: 'none', fontFamily: 'Arial', lineHeight: 1.2 };
var stub = ReactTestUtils.renderIntoDocument(<div style={styles} />);

var stubStyle = stub.getDOMNode().style;
Expand All @@ -82,21 +82,21 @@ describe('ReactDOMComponent', function() {
stub.receiveComponent({props: { style: styles }}, transaction);
expect(stubStyle.display).toEqual('block');
expect(stubStyle.fontFamily).toEqual('Arial');
expect(stubStyle.opacity).toEqual('0');
expect(stubStyle.lineHeight).toEqual('1.2');

styles.fontFamily = 'Helvetica';

stub.receiveComponent({props: { style: styles }}, transaction);
expect(stubStyle.display).toEqual('block');
expect(stubStyle.fontFamily).toEqual('Helvetica');
expect(stubStyle.opacity).toEqual('0');
expect(stubStyle.lineHeight).toEqual('1.2');

styles.opacity = 0.5;
styles.lineHeight = 0.5;

stub.receiveComponent({props: { style: styles }}, transaction);
expect(stubStyle.display).toEqual('block');
expect(stubStyle.fontFamily).toEqual('Helvetica');
expect(stubStyle.opacity).toEqual('0.5');
expect(stubStyle.lineHeight).toEqual('0.5');
});

it("should update styles if initially null", function() {
Expand Down

0 comments on commit 4e5ed83

Please sign in to comment.