jonahwilliams / angular_test

[IN DEVELOPMENT] Testing infrastructure for AngularDart

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

angular_test

Testing infrastructure and runner for AngularDart.

Usage

angular_test is both a framework for writing tests for AngularDart components and a test runner that delegates to both pub serve and pub run test to run component tests using the AOT-compiler - angular_test does not function in reflective mode.

Example use:

@Tags(const ['aot'])
@TestOn('browser')
import 'dart:html';

import 'package:angular2/angular2.dart';
import 'package:angular_test/angular_test.dart';
import 'package:test/test.dart';

@AngularEntrypoint()
void main() {
  tearDown(() => disposeAnyRunningTest());

  test('should render "Hello World"', () async {
    final testBed = new NgTestBed<HelloWorldComponent>();
    final textFixture = await testBed.create();
    expect(testFixture.text, 'Hello World');
    await textFixture.update(run: (c) => c.name = 'Universe');
    expect(textFixture.text, 'Hello Universe');
  });
}

@Component(selector: 'test', template: 'Hello {{name}}')
class HelloWorldComponent {
  String name = 'World';
}

Running

Use pub run angular_test - it will automatically run pub serve to run code generation (transformers) and pub run test to run browser tests on anything tagged with 'aot'.:

$ pub run angular_test

About

[IN DEVELOPMENT] Testing infrastructure for AngularDart

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Dart 97.7%Language:Shell 2.3%