Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Unified Diff: test/data/input/component_field_2way_test.html

Issue 11416259: fix #136, support watch exprs and two way bindings for component fields (Closed) Base URL: https://github.com/dart-lang/dart-web-components.git@master
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/data/expected/data_value_test.html.txt ('k') | test/data/input/component_field_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/data/input/component_field_2way_test.html
diff --git a/test/data/input/data_value_test.html b/test/data/input/component_field_2way_test.html
similarity index 53%
copy from test/data/input/data_value_test.html
copy to test/data/input/component_field_2way_test.html
index 3ff9d0189617dd5410b69f9c7a8395abd35b5937..e02823f258846bb4219d74f9ed3495d4c2032d4e 100644
--- a/test/data/input/data_value_test.html
+++ b/test/data/input/component_field_2way_test.html
@@ -13,33 +13,40 @@
</head>
<body>
<element name="x-greeter" extends="div" constructor="Greeter">
- <template>{{greeting}}, {{name}}!</template>
+ <template></template>
<script type='application/dart'>
- import 'common.dart';
import 'package:web_components/web_components.dart';
class Greeter extends WebComponent {
- String greeting, name;
+ String greeting;
+ changeStuff() {
+ greeting = 'Yo dawg';
+ title = 'I heard you like $title so we put $title in yo $title.';
+ }
}
</script>
</element>
<p>
- This test has two loops, each over two items, for a total of four different
- greeting messages:
+ The message changes from "hello world" to something more interesting.
</p>
- <template iterate="g in greetings">
- <template iterate="n in names">
- <x-greeter data-value="greeting:g, name:n"></x-greeter>
- </template>
- </template>
+ <!-- Note: "title" is a DOM field on all elements.
+ Also this element has no rendering. -->
+ <x-greeter id="greet" bind-title="data[1]" bind-greeting="data[0]">
+ </x-greeter>
+ <p id="actual">{{data[0]}} {{data[1]}}</p>
<script type="application/dart">
import 'dart:html';
import 'package:unittest/unittest.dart';
+ import 'package:web_components/web_components.dart';
- var greetings = ['hello', 'hi'];
- var names = ['world', 'universe'];
+ var data = ['hello', 'world'];
main() {
window.setTimeout(() {
- expect(query('x-greeter').attributes, equals({}));
+ var actual = query('#actual');
+ var greet = query('#greet');
+ expect(actual.innerHTML, 'hello world');
+ greet.xtag.changeStuff();
+ dispatch();
+ expect(actual.innerHTML, contains('Yo dawg I heard'));
window.postMessage('done', '*');
}, 0);
}
« no previous file with comments | « test/data/expected/data_value_test.html.txt ('k') | test/data/input/component_field_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698