Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

test: Add more test #958

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions test/core_dom/compiler_spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,11 @@ void main() {
toBe(PublishModuleAttrDirective._injector.get(PublishModuleDirectiveSuperType));
});

it('should expose PublishModuleDirectiveSuperType as PublishModuleDirectiveSuperType', () {
_.compile(r'<div publish-types probe="publishModuleProbe"></div>');
expect(_.rootScope.context['publishModuleProbe'].injector.get(PublishModuleDirectiveSuperType) is PublishModuleAttrDirective).toBeTruthy();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 lines ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

});

it('should allow repeaters over controllers', async((Logger logger) {
_.compile(r'<log ng-repeat="i in [1, 2]"></log>');
_.rootScope.apply();
Expand Down
7 changes: 7 additions & 0 deletions test/directive/ng_form_spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ void main() {
expect(form).toBeValid();
});

it('should expose NgForm as NgControl', (Scope scope, TestBed _) {
_.compile('<form name="myForm" probe="formProbe"><input type="text" /></form>');
scope.apply();

expect(scope.context['formProbe'].injector.get(NgControl) is NgForm).toBeTruthy();
});

it('should add and remove the correct flags when set to valid and to invalid',
(Scope scope, TestBed _) {

Expand Down
6 changes: 6 additions & 0 deletions test/routing/ng_bind_route_spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ main() {
.toEqual('all');
}));

it('should expose NgBindRoute as RouteProvider', async(() {
Element root = _.compile(
'<div ng-bind-route="library"><div probe="routeProbe"></div></div>');
expect(_.rootScope.context['routeProbe'].injector.get(RouteProvider) is NgBindRoute).toBeTruthy();
}));

});
}

Expand Down
13 changes: 11 additions & 2 deletions test/routing/ng_view_spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ main() {
router = _router;

templates.put('foo.html', new HttpResponse(200,
'<h1>Foo</h1>'));
'<h1 probe="p">Foo</h1>'));
templates.put('bar.html', new HttpResponse(200,
'<h1>Bar</h1>'));
'<h1 probe="p">Bar</h1>'));
});


Expand All @@ -47,6 +47,15 @@ main() {
expect(root.text).toEqual('Foo');
}));

it('should expose NgView as RouteProvider', async(() {
_.compile('<ng-view probe="m"></ng-view>');
router.route('/foo');
microLeap();
_.rootScope.apply();

expect(_.rootScope.context['p'].injector.get(RouteProvider) is NgView).toBeTruthy();
}));


it('should switch template when route is already active', async(() {
// Force the routing system to initialize.
Expand Down