| Index: third_party/pkg/angular/test/core_dom/block_spec.dart
|
| ===================================================================
|
| --- third_party/pkg/angular/test/core_dom/block_spec.dart (revision 33054)
|
| +++ third_party/pkg/angular/test/core_dom/block_spec.dart (working copy)
|
| @@ -2,12 +2,6 @@
|
|
|
| import '../_specs.dart';
|
|
|
| -class Log {
|
| - List<String> log = <String>[];
|
| -
|
| - add(String msg) => log.add(msg);
|
| -}
|
| -
|
| @NgDirective(children: NgAnnotation.TRANSCLUDE_CHILDREN, selector: 'foo')
|
| class LoggerBlockDirective {
|
| LoggerBlockDirective(BlockHole hole, BlockFactory blockFactory,
|
| @@ -22,43 +16,24 @@
|
| }
|
| }
|
|
|
| -@NgDirective(selector: 'dir-a')
|
| -class ADirective {
|
| - ADirective(Log log) {
|
| - log.add('ADirective');
|
| +class ReplaceBlockDirective {
|
| + ReplaceBlockDirective(BlockHole hole, BoundBlockFactory boundBlockFactory, Node node, Scope scope) {
|
| + var block = boundBlockFactory(scope);
|
| + block.insertAfter(hole);
|
| + node.remove();
|
| }
|
| }
|
|
|
| -@NgDirective(selector: 'dir-b')
|
| -class BDirective {
|
| - BDirective(Log log) {
|
| - log.add('BDirective');
|
| +class ShadowBlockDirective {
|
| + ShadowBlockDirective(BlockHole hole, BoundBlockFactory boundBlockFactory, Element element, Scope scope) {
|
| + var block = boundBlockFactory(scope);
|
| + var shadowRoot = element.createShadowRoot();
|
| + for (var i = 0, ii = block.elements.length; i < ii; i++) {
|
| + shadowRoot.append(block.elements[i]);
|
| + }
|
| }
|
| }
|
|
|
| -@NgFilter(name:'filterA')
|
| -class AFilter {
|
| - Log log;
|
| -
|
| - AFilter(this.log) {
|
| - log.add('AFilter');
|
| - }
|
| -
|
| - call(value) => value;
|
| -}
|
| -
|
| -@NgFilter(name:'filterB')
|
| -class BFilter {
|
| - Log log;
|
| -
|
| - BFilter(this.log) {
|
| - log.add('BFilter');
|
| - }
|
| -
|
| - call(value) => value;
|
| -}
|
| -
|
| -
|
| main() {
|
| describe('Block', () {
|
| var anchor;
|
| @@ -226,44 +201,6 @@
|
| });
|
| });
|
|
|
| - describe('deferred', () {
|
| -
|
| - it('should load directives/filters from the child injector', () {
|
| - Module rootModule = new Module()
|
| - ..type(Probe)
|
| - ..type(Log)
|
| - ..type(AFilter)
|
| - ..type(ADirective);
|
| -
|
| - Injector rootInjector =
|
| - new DynamicInjector(modules: [new AngularModule(), rootModule]);
|
| - Log log = rootInjector.get(Log);
|
| - Scope rootScope = rootInjector.get(Scope);
|
| -
|
| - Compiler compiler = rootInjector.get(Compiler);
|
| - DirectiveMap directives = rootInjector.get(DirectiveMap);
|
| - compiler(es('<dir-a>{{\'a\' | filterA}}</dir-a><dir-b></dir-b>'), directives)(rootInjector);
|
| - rootScope.apply();
|
| -
|
| - expect(log.log, equals(['ADirective', 'AFilter']));
|
| -
|
| -
|
| - Module childModule = new Module()
|
| - ..type(BFilter)
|
| - ..type(BDirective);
|
| -
|
| - var childInjector = forceNewDirectivesAndFilters(rootInjector, [childModule]);
|
| -
|
| - DirectiveMap newDirectives = childInjector.get(DirectiveMap);
|
| - compiler(es('<dir-a probe="dirA"></dir-a>{{\'a\' | filterA}}'
|
| - '<dir-b probe="dirB"></dir-b>{{\'b\' | filterB}}'), newDirectives)(childInjector);
|
| - rootScope.apply();
|
| -
|
| - expect(log.log, equals(['ADirective', 'AFilter', 'ADirective', 'BDirective', 'BFilter']));
|
| - });
|
| -
|
| - });
|
| -
|
| //TODO: tests for attach/detach
|
| //TODO: animation/transitions
|
| //TODO: tests for re-usability of blocks
|
|
|