Skip to content

Commit 8dd1f2b

Browse files
committed
Fix attributes interpolation
1 parent a96398a commit 8dd1f2b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/lib/react/ReactMacro.hx

+1-1
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ class ReactMacro
524524
{
525525
case 'key': key = expr;
526526
case 'ref' if (n.name.value != 'react.Fragment'): ref = expr;
527-
default: add(name, value);
527+
default: add(name, expr);
528528
}
529529
}
530530
}

test/src/ReactMacroTest.hx

+4-2
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,15 @@ class ReactMacroTest
116116
// TODO: further check; should fail at compile time atm
117117
}
118118

119-
@Test
119+
@Test
120120
public function interpolate_attributes()
121121
{
122122
var answer = "42";
123123
var e = jsx('<input name="question" value="the answer is $42" />');
124124
Assert.areEqual(e.props.value, 'the answer is $42');
125-
// TODO: further check; should fail at compile time atm
125+
126+
var e = jsx('<input name="question" value="the answer is ${answer}" />');
127+
Assert.areEqual(e.props.value, 'the answer is 42');
126128
}
127129

128130
@Test

0 commit comments

Comments
 (0)