Skip to content

Commit 1670ef7

Browse files
author
Robert Mosolgo
committed
Merge pull request #186 from hartator/master
Add test for destructuring assignments
2 parents 6f54184 + 64c50f8 commit 1670ef7

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

test/dummy/app/assets/javascripts/harmony_example.js.jsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,14 @@ var HarmonyComponent = React.createClass({
1010
},
1111
render: function(){
1212
var greeting = HarmonyComponent.generateGreeting();
13+
var { active, ...other } = { active: true, x: 1, y:2 }
1314
return (
14-
<h1 {...this.props}>{greeting}</h1>
15+
<div>
16+
<h1 {...this.props}>{greeting}</h1>
17+
<div active={active}>
18+
<span {...other} />
19+
</div>
20+
</div>
1521
)
1622
},
17-
});
23+
});

test/jsxtransform_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class JSXTransformTest < ActionDispatch::IntegrationTest
6060
assert_match(/generateGreeting:\s*function\(\)/, @response.body, "object literal methods")
6161
assert_match(/React.__spread/, @response.body, "spreading props")
6262
assert_match(/Your greeting is: '" \+ insertedGreeting \+ "'/, @response.body, "string interpolation")
63+
assert_match(/active=\$__0\.active/, @response.body, "destructuring assignment")
6364
end
6465

6566
test 'accepts strip_types: true option' do

0 commit comments

Comments
 (0)