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

Commit

Permalink
refactor(specs): main() does not return a value (void)
Browse files Browse the repository at this point in the history
closes #627
  • Loading branch information
vicb authored and mhevery committed Feb 26, 2014
1 parent b77534e commit 107e80d
Show file tree
Hide file tree
Showing 34 changed files with 6,100 additions and 6,047 deletions.
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

0 comments on commit 107e80d

Please sign in to comment.