| Index: pkg/mdv/test/template_element_test.dart
|
| diff --git a/pkg/mdv/test/template_element_test.dart b/pkg/mdv/test/template_element_test.dart
|
| index 10b39e1618e7f0c5d9fdddae740324384e78b684..d645a425d3659d76723977311ca30ebaf2f70a68 100644
|
| --- a/pkg/mdv/test/template_element_test.dart
|
| +++ b/pkg/mdv/test/template_element_test.dart
|
| @@ -1542,19 +1542,28 @@ templateElementTests() {
|
| });
|
|
|
| test('CreateInstance', () {
|
| - var div = createTestHtml(
|
| - '<template bind="{{a}}">'
|
| - '<template bind="{{b}}">'
|
| - '{{text}}'
|
| - '</template>'
|
| - '</template>');
|
| - var outer = div.nodes.first;
|
| + TemplateElement.syntax['Test'] = new TestBindingSyntax();
|
| + try {
|
| + var div = createTestHtml(
|
| + '<template bind="{{a}}">'
|
| + '<template bind="{{b}}">'
|
| + '{{ foo }}:{{ replaceme }}'
|
| + '</template>'
|
| + '</template>');
|
| + var outer = div.nodes.first;
|
| + var model = toSymbolMap({'b': {'foo': 'bar'}});
|
|
|
| - var instance = outer.createInstance();
|
| - expect(outer.content.nodes.first, instance.nodes.first.ref);
|
| + var host = new DivElement();
|
| + var instance = outer.createInstance(model, 'Test');
|
| + expect(outer.content.nodes.first, instance.nodes.first.ref);
|
| + expect(instance.firstChild.attributes['syntax'], 'Test');
|
|
|
| - var instance2 = outer.createInstance();
|
| - expect(instance2.nodes.first.ref, instance.nodes.first.ref);
|
| + host.append(instance);
|
| + deliverChangeRecords();
|
| + expect(host.firstChild.nextNode.text, 'bar:replaced');
|
| + } finally {
|
| + TemplateElement.syntax.remove('Test');
|
| + }
|
| });
|
|
|
| test('Bootstrap', () {
|
| @@ -1609,6 +1618,13 @@ templateElementTests() {
|
| });
|
| }
|
|
|
| +class TestBindingSyntax extends CustomBindingSyntax {
|
| + getBinding(model, String path, name, node) {
|
| + if (path.trim() == 'replaceme') return new ObservableBox('replaced');
|
| + return null;
|
| + }
|
| +}
|
| +
|
| class UnbindingInNestedBindSyntax extends CustomBindingSyntax {
|
| int expectedAge = 42;
|
| int count = 0;
|
| @@ -1666,4 +1682,3 @@ _deepToSymbol(value) {
|
| }
|
| return value;
|
| }
|
| -
|
|
|