-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from dnys1/fix/string-interpolation
fix(zap_dev): Wrap interpolated identifiers in braces
- Loading branch information
Showing
3 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<script> | ||
@prop | ||
String? val; | ||
|
||
String interpolated = ''; | ||
|
||
$: interpolated = 'interpolated=$val, wrapped=${val}, isNull=${val == null}'; | ||
</script> | ||
|
||
{interpolated} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
@Tags(['browser']) | ||
import 'dart:html'; | ||
|
||
import 'package:test/test.dart'; | ||
import 'package:zap/zap.dart'; | ||
|
||
import 'interpolation.zap.dart'; | ||
|
||
void main() { | ||
test('string interpolation', () async { | ||
final testbed = Element.div(); | ||
final component = Interpolation(ZapValue('test'))..create(testbed); | ||
|
||
expect(testbed.text, 'interpolated=test, wrapped=test, isNull=false'); | ||
|
||
component.val = 'updated'; | ||
await component.tick; | ||
expect(testbed.text, 'interpolated=updated, wrapped=updated, isNull=false'); | ||
|
||
component.val = null; | ||
await component.tick; | ||
expect(testbed.text, 'interpolated=null, wrapped=null, isNull=true'); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters