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

Side by Side Diff: test/src/common/polymer_descriptor_test.dart

Issue 1351693003: Update to use one less proxy per element (Closed) Base URL: git@github.com:dart-lang/polymer-dart.git@behaviors
Patch Set: redo! Created 5 years, 3 months 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 @TestOn('browser') 4 @TestOn('browser')
5 library polymer.test.src.common.polymer_descriptor_test; 5 library polymer.test.src.common.polymer_descriptor_test;
6 6
7 import 'dart:js'; 7 import 'dart:js';
8 import 'package:test/test.dart'; 8 import 'package:test/test.dart';
9 import 'package:polymer/polymer.dart'; 9 import 'package:polymer/polymer.dart';
10 import 'package:polymer/src/common/polymer_descriptor.dart'; 10 import 'package:polymer/src/common/polymer_descriptor.dart';
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 expect(descriptor['attached'] is JsFunction, isTrue); 61 expect(descriptor['attached'] is JsFunction, isTrue);
62 expect(descriptor['detached'] is JsFunction, isTrue); 62 expect(descriptor['detached'] is JsFunction, isTrue);
63 expect(descriptor['handleSomeEvent'] is JsFunction, isTrue); 63 expect(descriptor['handleSomeEvent'] is JsFunction, isTrue);
64 expect(descriptor['myDoubleChanged'] is JsFunction, isTrue); 64 expect(descriptor['myDoubleChanged'] is JsFunction, isTrue);
65 expect(descriptor['myNumsCombined'] is JsFunction, isTrue); 65 expect(descriptor['myNumsCombined'] is JsFunction, isTrue);
66 // From the dart behaviors! 66 // From the dart behaviors!
67 expect(descriptor['behaviorOneExposedMethod'] is JsFunction, isTrue); 67 expect(descriptor['behaviorOneExposedMethod'] is JsFunction, isTrue);
68 expect(descriptor['behaviorTwoExposedMethod'] is JsFunction, isTrue); 68 expect(descriptor['behaviorTwoExposedMethod'] is JsFunction, isTrue);
69 69
70 expect(descriptor['behaviors'], isNotNull); 70 expect(descriptor['behaviors'], isNotNull);
71 expect(descriptor['behaviors'].length, 4); 71 expect(descriptor['behaviors'].length, 5);
72 expect(descriptor['behaviors'][0], context['Foo']['JsBehaviorOne']); 72 expect(descriptor['behaviors'][0], context['Polymer']['Dart']['Behavior']);
73 expect(descriptor['behaviors'][1], behavior.getBehavior(DartBehaviorOne)); 73 expect(descriptor['behaviors'][1], context['Foo']['JsBehaviorOne']);
74 expect(descriptor['behaviors'][2], context['Foo']['JsBehaviorTwo']); 74 expect(descriptor['behaviors'][2], behavior.getBehavior(DartBehaviorOne));
75 expect(descriptor['behaviors'][3], behavior.getBehavior(DartBehaviorTwo)); 75 expect(descriptor['behaviors'][3], context['Foo']['JsBehaviorTwo']);
76 expect(descriptor['behaviors'][1], isNot(descriptor['behaviors'][3])); 76 expect(descriptor['behaviors'][4], behavior.getBehavior(DartBehaviorTwo));
77 expect(descriptor['behaviors'][2], isNot(descriptor['behaviors'][3]));
77 }); 78 });
78 } 79 }
79 80
80 @BehaviorProxy(const ['Foo', 'JsBehaviorOne']) 81 @BehaviorProxy(const ['Foo', 'JsBehaviorOne'])
81 class JsBehaviorOne {} 82 class JsBehaviorOne {}
82 83
83 @BehaviorProxy(const ['Foo', 'JsBehaviorTwo']) 84 @BehaviorProxy(const ['Foo', 'JsBehaviorTwo'])
84 class JsBehaviorTwo {} 85 class JsBehaviorTwo {}
85 86
86 @behavior 87 @behavior
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 expectEqual(actual, expected); 191 expectEqual(actual, expected);
191 } 192 }
192 193
193 void expectEqual(JsObject actual, Map expected) { 194 void expectEqual(JsObject actual, Map expected) {
194 expect(actual, isNotNull); 195 expect(actual, isNotNull);
195 var keys = context['Object'].callMethod('keys', [actual]); 196 var keys = context['Object'].callMethod('keys', [actual]);
196 for (var key in keys) { 197 for (var key in keys) {
197 expect(actual[key], equals(expected[key])); 198 expect(actual[key], equals(expected[key]));
198 } 199 }
199 } 200 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698