OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import 'dart:async'; |
| 6 import 'dart:html'; |
| 7 import 'package:unittest/unittest.dart'; |
| 8 import 'package:unittest/html_config.dart'; |
| 9 import 'package:polymer/polymer.dart'; |
| 10 |
| 11 @CustomTag('x-target') |
| 12 class XTarget extends PolymerElement { |
| 13 final Completer _found = new Completer(); |
| 14 Future get foundSrc => _found.future; |
| 15 |
| 16 // force an mdv binding |
| 17 bind(name, model, path) => |
| 18 TemplateElement.mdvPackage(this).bind(name, model, path); |
| 19 |
| 20 inserted() { |
| 21 testSrcForMustache(); |
| 22 } |
| 23 |
| 24 attributeChanged(name, oldValue) { |
| 25 testSrcForMustache(); |
| 26 if (attributes[name] == '../testSource') { |
| 27 _found.complete(); |
| 28 } |
| 29 } |
| 30 |
| 31 testSrcForMustache() { |
| 32 expect(attributes['src'], isNot(matches(Polymer.bindPattern)), |
| 33 reason: 'attribute does not contain {{...}}'); |
| 34 } |
| 35 } |
| 36 |
| 37 @CustomTag('x-test') |
| 38 class XTest extends PolymerElement { |
| 39 @observable var src = 'testSource'; |
| 40 } |
| 41 |
| 42 main() { |
| 43 useHtmlConfiguration(); |
| 44 |
| 45 test('mustache attributes', () { |
| 46 final xtest = document.query('#test').xtag; |
| 47 final xtarget = xtest.shadowRoot.query('#target').xtag; |
| 48 return xtarget.foundSrc; |
| 49 }); |
| 50 } |
OLD | NEW |