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

refactor: main() does not return a value (void) #627

Closed
wants to merge 1 commit into from
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
34 changes: 18 additions & 16 deletions perf/dom/compile_perf.dart
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import '_perf.dart';

main() => describe('compiler', () {
describe('block instantiation', () {
it('time ', inject((TestBed tb) {
tb.compile(UL_REPEATER);
var items = [];
for(var i = 0; i < 100; i++) {
items.add({"text":'text_$i', "done": i & 1 == 1});
}
var empty = [];
tb.rootScope.context['classFor'] = (item) => 'ng-${item["done"]}';
void main() {
describe('compiler', () {
describe('block instantiation', () {
it('time ', inject((TestBed tb) {
tb.compile(UL_REPEATER);
var items = [];
for(var i = 0; i < 100; i++) {
items.add({"text":'text_$i', "done": i & 1 == 1});
}
var empty = [];
tb.rootScope.context['classFor'] = (item) => 'ng-${item["done"]}';

time('create 100 blocks',
() => tb.rootScope.apply(() => tb.rootScope.context['items'] = items),
cleanUp: () => tb.rootScope.apply(() => tb.rootScope.context['items'] = empty),
verify: () => expect(tb.rootElement.querySelectorAll('li').length).toEqual(100));
}));
time('create 100 blocks',
() => tb.rootScope.apply(() => tb.rootScope.context['items'] = items),
cleanUp: () => tb.rootScope.apply(() => tb.rootScope.context['items'] = empty),
verify: () => expect(tb.rootElement.querySelectorAll('li').length).toEqual(100));
}));
});
});
});
}

var UL_REPEATER =
"""
Expand Down
44 changes: 23 additions & 21 deletions test/bootstrap_spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,30 @@ library bootstrap_spec;

import '_specs.dart';

main() => describe('bootstrap', () {
BodyElement body = window.document.querySelector('body');
void main() {
describe('bootstrap', () {
BodyElement body = window.document.querySelector('body');

it('should default to whole page', () {
body.innerHtml = '<div>{{"works"}}</div>';
ngBootstrap();
expect(body.innerHtml).toEqual('<div>works</div>');
});
it('should default to whole page', () {
body.innerHtml = '<div>{{"works"}}</div>';
ngBootstrap();
expect(body.innerHtml).toEqual('<div>works</div>');
});

it('should compile starting at ng-app node', () {
body.setInnerHtml(
'<div>{{ignor me}}<div ng-app ng-bind="\'works\'"></div></div>',
treeSanitizer: new NullTreeSanitizer());
ngBootstrap();
expect(body.text).toEqual('{{ignor me}}works');
});
it('should compile starting at ng-app node', () {
body.setInnerHtml(
'<div>{{ignor me}}<div ng-app ng-bind="\'works\'"></div></div>',
treeSanitizer: new NullTreeSanitizer());
ngBootstrap();
expect(body.text).toEqual('{{ignor me}}works');
});

it('should compile starting at ng-app node', () {
body.setInnerHtml(
'<div>{{ignor me}}<div ng-bind="\'works\'"></div></div>',
treeSanitizer: new NullTreeSanitizer());
ngBootstrap(element:body.querySelector('div[ng-bind]'));
expect(body.text).toEqual('{{ignor me}}works');
it('should compile starting at ng-app node', () {
body.setInnerHtml(
'<div>{{ignor me}}<div ng-bind="\'works\'"></div></div>',
treeSanitizer: new NullTreeSanitizer());
ngBootstrap(element:body.querySelector('div[ng-bind]'));
expect(body.text).toEqual('{{ignor me}}works');
});
});
});
}
Loading