Skip to content

Commit d766c20

Browse files
committed
Add style type switching test
1 parent e1af3bf commit d766c20

File tree

1 file changed

+32
-6
lines changed

1 file changed

+32
-6
lines changed

test/browser/render.js

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,38 @@ describe('render()', () => {
252252
.and.matches(/position\s*:\s*relative\s*/);
253253
});
254254

255+
it('should properly switch from string styles to object styles and back', () => {
256+
let root = render((
257+
<div style="display: inline;">test</div>
258+
), scratch);
259+
260+
expect(root.style.cssText).to.equal('display: inline;');
261+
262+
root = render((
263+
<div style={{ color: 'red' }} />
264+
), scratch, root);
265+
266+
expect(root.style.cssText).to.equal('color: red;');
267+
268+
root = render((
269+
<div style="color: blue" />
270+
), scratch, root);
271+
272+
expect(root.style.cssText).to.equal('color: blue;');
273+
274+
root = render((
275+
<div style={{ color: 'yellow' }} />
276+
), scratch, root);
277+
278+
expect(root.style.cssText).to.equal('color: yellow;');
279+
280+
root = render((
281+
<div style="display: block" />
282+
), scratch, root);
283+
284+
expect(root.style.cssText).to.equal('display: block;');
285+
});
286+
255287
it('should serialize style objects', () => {
256288
let root = render((
257289
<div style={{
@@ -283,12 +315,6 @@ describe('render()', () => {
283315

284316
expect(root.style.cssText).to.equal('color: rgb(0, 255, 255);');
285317

286-
root = render((
287-
<div style="display: inline;">test</div>
288-
), scratch, root);
289-
290-
expect(root.style.cssText).to.equal('display: inline;');
291-
292318
root = render((
293319
<div style={{ backgroundColor: 'rgb(0, 255, 255)' }}>test</div>
294320
), scratch, root);

0 commit comments

Comments
 (0)