OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 | 4 |
5 library binding_syntax_test; | 5 library binding_syntax_test; |
6 | 6 |
7 import 'dart:async'; | |
8 import 'dart:collection'; | 7 import 'dart:collection'; |
9 import 'dart:html'; | 8 import 'dart:html'; |
10 import 'package:mdv/mdv.dart' as mdv; | 9 import 'package:mdv/mdv.dart' as mdv; |
11 import 'package:observe/observe.dart'; | 10 import 'package:observe/observe.dart'; |
12 import 'package:unittest/html_config.dart'; | 11 import 'package:unittest/html_config.dart'; |
13 import 'package:unittest/unittest.dart'; | 12 import 'package:unittest/unittest.dart'; |
14 import 'mdv_test_utils.dart'; | 13 import 'mdv_test_utils.dart'; |
15 | 14 |
16 // Note: this file ported from | 15 // Note: this file ported from |
17 // https://github.com/toolkitchen/mdv/blob/master/tests/syntax.js | 16 // https://github.com/toolkitchen/mdv/blob/master/tests/syntax.js |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 class TimesTwoSyntax extends BindingDelegate { | 193 class TimesTwoSyntax extends BindingDelegate { |
195 getBinding(model, path, name, node) { | 194 getBinding(model, path, name, node) { |
196 path = path.trim(); | 195 path = path.trim(); |
197 if (!path.startsWith('2x:')) return null; | 196 if (!path.startsWith('2x:')) return null; |
198 | 197 |
199 path = path.substring(3); | 198 path = path.substring(3); |
200 return new CompoundBinding((values) => values['value'] * 2) | 199 return new CompoundBinding((values) => values['value'] * 2) |
201 ..bind('value', model, path); | 200 ..bind('value', model, path); |
202 } | 201 } |
203 } | 202 } |
OLD | NEW |