Skip to content

Using platform directives doesn't work with testing dart #6598

Closed

Description

@kasperpeulen

@juliemr
If I use a platform directive like this in Dart:

- angular2:
    platform_directives: package:angular2/common.dart#CORE_DIRECTIVES
    entry_points: web/main.dart

With testing, I get an error:

~/C/n/angular.io-displaying-data (master) $ grind test
grinder running [test]

[test]
  pub run test:test --reporter=expanded --platform=content-shell --pub-serve=3000
writeFrom failed, path = '' (OS Error: Broken pipe, errno = 32)
  00:00 +0: test/e2e_test.dart: Displaying Data Tests should display correct title: Tour of Heroes
  00:00 +0 -1: test/e2e_test.dart: Displaying Data Tests should display correct title: Tour of Heroes
    Template parse errors:
    Property binding ngForOf not used by any directive on an embedded template ("
          <p>Heroes:</p>
          <ul>
            [ERROR ->]<li *ngFor="#hero of heroes">
              {{ hero.name }}
            </li>
    "): AppComponent@4:8
    Property binding ngIf not used by any directive on an embedded template ("
            </li>
          </ul>
          [ERROR ->]<p *ngIf="heroes.length > 3">There are many heroes!</p>
        "): AppComponent@8:6
    package:angular2/src/compiler/template_parser.dart 118:7               TemplateParser.parse
    package:angular2/src/compiler/template_compiler.dart 206:51            TemplateCompiler._compileComponentRuntime.<fn>
    ===== asynchronous gap ===========================
    dart:async                                                             _Future.then
    package:angular2/src/compiler/template_compiler.dart 202:12            TemplateCompiler._compileComponentRuntime
    package:angular2/src/compiler/template_compiler.dart 247:10            TemplateCompiler._compileNestedComponentRuntime
    package:angular2/src/compiler/template_compiler.dart 215:14            TemplateCompiler._compileComponentRuntime.<fn>.<fn>
    dart:core                                                              List.forEach
    package:angular2/src/compiler/template_compiler.dart 214:35            TemplateCompiler._compileComponentRuntime.<fn>
    ===== asynchronous gap ===========================
    dart:async                                                             _Future.then
    package:angular2/src/compiler/template_compiler.dart 202:12            TemplateCompiler._compileComponentRuntime
    package:angular2/src/compiler/template_compiler.dart 130:12            TemplateCompiler.compileHostComponentRuntime
    package:angular2/src/compiler/runtime_compiler.dart 26:10              RuntimeCompiler_.compileInHost
    package:angular2/src/core/linker/dynamic_component_loader.dart 260:27  DynamicComponentLoader_.loadAsRoot
    package:angular2/src/testing/test_component_builder.dart 247:10        TestComponentBuilder.createAsync
    e2e_test.dart 21:32                                                    main.<fn>.<fn>.<async>
    ===== asynchronous gap ===========================
    dart:async                                                             Future.Future.microtask
    e2e_test.dart                                                          main.<fn>.<fn>
    dart:core                                                              Function.apply
    package:angular2/src/facade/lang.dart 232:21                           FunctionWrapper.apply
    package:angular2/src/testing/test_injector.dart 256:28                 FunctionWithParamTokens.execute
    package:angular2/src/testing/test_injector.dart 163:15                 TestInjector.execute
    package:angular2_testing/angular2_testing.dart 83:24                   _runInjectableFunction
    package:angular2_testing/angular2_testing.dart 115:11                  ngTest.<fn>.<async>
    ===== asynchronous gap ===========================
    dart:async                                                             Future.Future.microtask
    package:angular2_testing/angular2_testing.dart                         ngTest.<fn>

  00:00 +0 -1: Some tests failed.

failed with exit code 1

If I include the directives directly:

@Component(
    selector: 'my-app',
    template: '''
      <h1 (click)="null">{{title}}</h1>
      <h2>My favorite hero is: {{myHero.name}}</h2>
      <p>Heroes:</p>
      <ul>
        <li *ngFor="#hero of heroes">
          {{ hero.name }}
        </li>
      </ul>
      <p *ngIf="heroes.length > 3">There are many heroes!</p>
    ''',
    directives: const [CORE_DIRECTIVES])

All my test pass.

Activity

  1. juliemr commented on Mar 11, 2016

    @juliemr
    Contributor

    This should have been fixed by #5975

  2. angular-automatic-lock-bot commented on Sep 8, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  3. locked and limited conversation to collaborators on Sep 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions