diff --git a/modules/angular2/src/change_detection/proto_change_detector.js b/modules/angular2/src/change_detection/proto_change_detector.js index cfccdfd884..9a2ce224a7 100644 --- a/modules/angular2/src/change_detection/proto_change_detector.js +++ b/modules/angular2/src/change_detection/proto_change_detector.js @@ -360,7 +360,7 @@ function _operationToFunction(operation:string):Function { } function s(v) { - return isPresent(v) ? '' + v : ''; + return isPresent(v) ? `${v}` : ''; } function _interpolationFn(strings:List) { diff --git a/modules/angular2/src/core/compiler/view.js b/modules/angular2/src/core/compiler/view.js index 494cdf8239..317bb4df92 100644 --- a/modules/angular2/src/core/compiler/view.js +++ b/modules/angular2/src/core/compiler/view.js @@ -411,7 +411,8 @@ export class ProtoView { // view might get dehydrated, in between the event queuing up and // firing. if (view.hydrated()) { - MapWrapper.set(locals, '\$event', event); + // HACK + MapWrapper.set(locals, `$event`, event); var context = new ContextWithVariableBindings(view.context, locals); expr.eval(context); } diff --git a/modules/angular2/src/facade/collection.dart b/modules/angular2/src/facade/collection.dart index 338b1ab0ba..3a4234f956 100644 --- a/modules/angular2/src/facade/collection.dart +++ b/modules/angular2/src/facade/collection.dart @@ -71,7 +71,7 @@ class StringMapWrapper { } class ListWrapper { - static List clone(List l) => new List.from(l); + static List clone(Iterable l) => new List.from(l); static List create() => new List(); static List createFixedSize(int size) => new List(size); static get(List m, int k) => m[k]; @@ -137,6 +137,9 @@ class ListWrapper { } return true; } + static List slice(List l, int from, int to) { + return l.sublist(from, to); + } } bool isListLikeIterable(obj) => obj is Iterable; diff --git a/modules/angular2/src/facade/collection.es6 b/modules/angular2/src/facade/collection.es6 index 6b673a9e3f..58fb3b1457 100644 --- a/modules/angular2/src/facade/collection.es6 +++ b/modules/angular2/src/facade/collection.es6 @@ -176,6 +176,9 @@ export class ListWrapper { } return true; } + static slice(l:List, from:int, to:int):List { + return l.slice(from, to); + } } export function isListLikeIterable(obj):boolean { diff --git a/modules/angular2/src/facade/math.dart b/modules/angular2/src/facade/math.dart index f4b952821f..c251c9f8c5 100644 --- a/modules/angular2/src/facade/math.dart +++ b/modules/angular2/src/facade/math.dart @@ -6,4 +6,8 @@ class Math { static num pow(num x, num exponent) { return math.pow(x, exponent); } + + static num min(num a, num b) => math.min(a, b); + + static num floor(num a) => a.floor(); } diff --git a/modules/benchmarks/e2e_test/naive_infinite_scroll_perf.es6 b/modules/benchmarks/e2e_test/naive_infinite_scroll_perf.es6 new file mode 100644 index 0000000000..072d0ef2f9 --- /dev/null +++ b/modules/benchmarks/e2e_test/naive_infinite_scroll_perf.es6 @@ -0,0 +1,37 @@ +var perfUtil = require('../../angular2/e2e_test/perf_util'); + +describe('ng2 naive infinite scroll benchmark', function () { + + var URL = 'benchmarks/src/naive_infinite_scroll/index.html'; + + afterEach(perfUtil.verifyNoBrowserErrors); + + [1, 2, 4].forEach(function(appSize) { + it('should run scroll benchmark and collect stats for appSize = ' + + appSize, function() { + perfUtil.runBenchmark({ + url: URL, + id: 'ng2.naive_infinite_scroll', + work: function() { + browser.executeScript( + 'document.querySelector("scroll-app /deep/ #reset-btn").click()'); + browser.executeScript( + 'document.querySelector("scroll-app /deep/ #run-btn").click()'); + browser.wait(() => { + return $('#done').getText().then( + function() { return true; }, + function() { return false; }); + }, 10000); + }, + params: [{ + name: 'appSize', value: appSize + }, { + name: 'iterationCount', value: 20, scale: 'linear' + }, { + name: 'scrollIncrement', value: 40 + }] + }); + }); + }); + +}); diff --git a/modules/benchmarks/e2e_test/naive_infinite_scroll_spec.es6 b/modules/benchmarks/e2e_test/naive_infinite_scroll_spec.es6 new file mode 100644 index 0000000000..b27826f4d8 --- /dev/null +++ b/modules/benchmarks/e2e_test/naive_infinite_scroll_spec.es6 @@ -0,0 +1,22 @@ +var testUtil = require('../../angular2/e2e_test/test_util'); + +describe('ng2 naive infinite scroll benchmark', function () { + + var URL = 'benchmarks/src/naive_infinite_scroll/index.html'; + + afterEach(testUtil.verifyNoBrowserErrors); + + it('should not throw errors', function() { + browser.get(URL); + browser.executeScript( + 'document.querySelector("scroll-app /deep/ #reset-btn").click()'); + browser.executeScript( + 'document.querySelector("scroll-app /deep/ #run-btn").click()'); + browser.wait(() => { + return $('#done').getText().then( + function() { return true; }, + function() { return false; }); + }, 10000); + }); + +}); diff --git a/modules/benchmarks/src/index.html b/modules/benchmarks/src/index.html index 9af6c61036..2317eab34e 100644 --- a/modules/benchmarks/src/index.html +++ b/modules/benchmarks/src/index.html @@ -20,6 +20,9 @@