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

Unified Diff: test/analyzer_test.dart

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 | « lib/web_components.dart ('k') | test/data/expected/component_field_2way_test.html.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/analyzer_test.dart
diff --git a/test/analyzer_test.dart b/test/analyzer_test.dart
index 92d80fc8a2ae77fcc5133bbd408881e0879c4b03..364e42ac44bf85c19cc0493e473db95541c638b8 100644
--- a/test/analyzer_test.dart
+++ b/test/analyzer_test.dart
@@ -463,13 +463,53 @@ main() {
expect(info.loopItems, equals('bar'));
});
- test('data-value', () {
+ test('data-value - deprecated', () {
+ messages.clear();
var elem = parseSubtree('<li is="x-todo-row" data-value="todo:x"></li>');
var info = analyzeElement(elem);
- elem = elem.query('li');
expect(info.attributes, isEmpty);
expect(info.events, isEmpty);
expect(info.values, equals({'todo': 'x'}));
+ expect(messages.length, 2);
+ expect(messages[0].message, contains('x-todo-row not found'));
+ expect(messages[0].span, equals(elem.sourceSpan));
+ expect(messages[1].message, contains('data-value is deprecated'));
+ expect(messages[1].span, equals(elem.sourceSpan));
+ });
+
+ test('component properties 1-way binding', () {
+ var files = parseFiles({
+ 'index.html': '<head><link rel="components" href="foo.html">'
+ '<body><element name="x-bar" extends="x-foo" '
+ 'constructor="Bar"></element>'
+ '<x-bar quux="{{123}}">',
+ 'foo.html': '<body><element name="x-foo" constructor="Foo">'
+ });
+
+ var fileInfo = analyzeFiles(files);
+ var bar = fileInfo['index.html'].query('x-bar');
+ expect(bar.hasDataBinding, true);
+ expect(bar.attributes.keys, ['quux']);
+ expect(bar.attributes['quux'].customTwoWayBinding, false);
+ expect(bar.attributes['quux'].boundValue, '123');
+ });
+
+ test('component properties 2-way binding', () {
+ var files = parseFiles({
+ 'index.html': '<head><link rel="components" href="foo.html">'
+ '<body><element name="x-bar" extends="x-foo" '
+ 'constructor="Bar"></element>'
+ '<x-bar bind-quux="assignable">',
+ 'foo.html': '<body><element name="x-foo" constructor="Foo">'
+ });
+
+ var fileInfo = analyzeFiles(files)['index.html'];
+ var bar = fileInfo.query('x-bar');
+ expect(bar.component, same(fileInfo.declaredComponents[0]));
+ expect(bar.hasDataBinding, true);
+ expect(bar.attributes.keys, ['quux']);
+ expect(bar.attributes['quux'].customTwoWayBinding, true);
+ expect(bar.attributes['quux'].boundValue, 'assignable');
});
group('analyzeDefinitions', () {
« no previous file with comments | « lib/web_components.dart ('k') | test/data/expected/component_field_2way_test.html.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698