Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Unified Diff: third_party/pkg/angular/test/filter/order_by_spec.dart

Issue 180843004: Revert revision 33053 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/pkg/angular/test/filter/order_by_spec.dart
===================================================================
--- third_party/pkg/angular/test/filter/order_by_spec.dart (revision 33054)
+++ third_party/pkg/angular/test/filter/order_by_spec.dart (working copy)
@@ -20,15 +20,15 @@
Jeffrey_Archer = {'firstName': 'Jeffrey', 'lastName': 'Archer'},
Isaac___Asimov = new Name(firstName: 'Isaac', lastName: 'Asimov'),
Oscar___Wilde = {'firstName': 'Oscar', 'lastName': 'Wilde'};
- beforeEach(() => inject((Scope scope, Parser parse, FilterMap filters) {
- scope.context['authors'] = [
+ beforeEach(() => inject((Scope scope) {
+ scope['authors'] = [
Emily___Bronte,
Mark____Twain,
Jeffrey_Archer,
Isaac___Asimov,
Oscar___Wilde,
];
- scope.context['items'] = [
+ scope['items'] = [
{'a': 10, 'b': 10},
{'a': 10, 'b': 20},
{'a': 20, 'b': 10},
@@ -36,32 +36,32 @@
];
}));
- it('should pass through null list when input list is null', inject((Scope scope, Parser parse, FilterMap filters) {
+ it('should pass through null list when input list is null', inject((Scope scope) {
var list = null;
- expect(parse('list | orderBy:"foo"').eval(scope.context, filters)).toBe(null);
+ expect(scope.$eval('list | orderBy:"foo"')).toBe(null);
}));
- it('should pass through argument when expression is null', inject((Scope scope, Parser parse, FilterMap filters) {
- var list = scope.context['list'] = [1, 3, 2];
- expect(parse('list | orderBy:thisIsNull').eval(scope.context, filters)).toBe(list);
+ it('should pass through argument when expression is null', inject((Scope scope) {
+ var list = scope['list'] = [1, 3, 2];
+ expect(scope.$eval('list | orderBy:thisIsNull')).toBe(list);
}));
- it('should sort with "empty" expression using default comparator', inject((Scope scope, Parser parse, FilterMap filters) {
- scope.context['list'] = [1, 3, 2];
- expect(parse('list | orderBy:""').eval(scope.context, filters)).toEqual([1, 2, 3]);
- expect(parse('list | orderBy:"+"').eval(scope.context, filters)).toEqual([1, 2, 3]);
- expect(parse('list | orderBy:"-"').eval(scope.context, filters)).toEqual([3, 2, 1]);
+ it('should sort with "empty" expression using default comparator', inject((Scope scope) {
+ scope['list'] = [1, 3, 2];
+ expect(scope.$eval('list | orderBy:""')).toEqual([1, 2, 3]);
+ expect(scope.$eval('list | orderBy:"+"')).toEqual([1, 2, 3]);
+ expect(scope.$eval('list | orderBy:"-"')).toEqual([3, 2, 1]);
}));
- it('should sort by expression', inject((Scope scope, Parser parse, FilterMap filters) {
- expect(parse('authors | orderBy:"firstName"').eval(scope.context, filters)).toEqual([
+ it('should sort by expression', inject((Scope scope) {
+ expect(scope.$eval('authors | orderBy:"firstName"')).toEqual([
Emily___Bronte,
Isaac___Asimov,
Jeffrey_Archer,
Mark____Twain,
Oscar___Wilde,
]);
- expect(parse('authors | orderBy:"lastName"').eval(scope.context, filters)).toEqual([
+ expect(scope.$eval('authors | orderBy:"lastName"')).toEqual([
Jeffrey_Archer,
Isaac___Asimov,
Emily___Bronte,
@@ -69,8 +69,8 @@
Oscar___Wilde,
]);
- scope.context['sortKey'] = 'firstName';
- expect(parse('authors | orderBy:sortKey').eval(scope.context, filters)).toEqual([
+ scope['sortKey'] = 'firstName';
+ expect(scope.$eval('authors | orderBy:sortKey')).toEqual([
Emily___Bronte,
Isaac___Asimov,
Jeffrey_Archer,
@@ -80,8 +80,8 @@
}));
- it('should reverse order when passed the additional descending param', inject((Scope scope, Parser parse, FilterMap filters) {
- expect(parse('authors | orderBy:"lastName":true').eval(scope.context, filters)).toEqual([
+ it('should reverse order when passed the additional descending param', inject((Scope scope) {
+ expect(scope.$eval('authors | orderBy:"lastName":true')).toEqual([
Oscar___Wilde,
Mark____Twain,
Emily___Bronte,
@@ -90,8 +90,8 @@
]);
}));
- it('should reverse order when expression is prefixed with "-"', inject((Scope scope, Parser parse, FilterMap filters) {
- expect(parse('authors | orderBy:"-lastName"').eval(scope.context, filters)).toEqual([
+ it('should reverse order when expression is prefixed with "-"', inject((Scope scope) {
+ expect(scope.$eval('authors | orderBy:"-lastName"')).toEqual([
Oscar___Wilde,
Mark____Twain,
Emily___Bronte,
@@ -101,8 +101,8 @@
}));
it('should NOT reverse order when BOTH expression is prefixed with "-" AND additional parameter also asks reversal',
- inject((Scope scope, Parser parse, FilterMap filters) {
- expect(parse('authors | orderBy:"-lastName":true').eval(scope.context, filters)).toEqual([
+ inject((Scope scope) {
+ expect(scope.$eval('authors | orderBy:"-lastName":true')).toEqual([
Jeffrey_Archer,
Isaac___Asimov,
Emily___Bronte,
@@ -112,22 +112,22 @@
}));
it('should allow a "+" prefix on the expression that should be a nop (ascending order)',
- inject((Scope scope, Parser parse, FilterMap filters) {
- expect(parse('authors | orderBy:"+lastName"').eval(scope.context, filters)).toEqual([
+ inject((Scope scope) {
+ expect(scope.$eval('authors | orderBy:"+lastName"')).toEqual([
Jeffrey_Archer,
Isaac___Asimov,
Emily___Bronte,
Mark____Twain,
Oscar___Wilde,
]);
- expect(parse('authors | orderBy:"+lastName":false').eval(scope.context, filters)).toEqual([
+ expect(scope.$eval('authors | orderBy:"+lastName":false')).toEqual([
Jeffrey_Archer,
Isaac___Asimov,
Emily___Bronte,
Mark____Twain,
Oscar___Wilde,
]);
- expect(parse('authors | orderBy:"+lastName":true').eval(scope.context, filters)).toEqual([
+ expect(scope.$eval('authors | orderBy:"+lastName":true')).toEqual([
Oscar___Wilde,
Mark____Twain,
Emily___Bronte,
@@ -137,26 +137,26 @@
}));
it('should support an array of expressions',
- inject((Scope scope, Parser parse, FilterMap filters) {
- expect(parse('items | orderBy:["-a", "-b"]').eval(scope.context, filters)).toEqual([
+ inject((Scope scope) {
+ expect(scope.$eval('items | orderBy:["-a", "-b"]')).toEqual([
{'a': 20, 'b': 20},
{'a': 20, 'b': 10},
{'a': 10, 'b': 20},
{'a': 10, 'b': 10},
]);
- expect(parse('items | orderBy:["-b", "-a"]').eval(scope.context, filters)).toEqual([
+ expect(scope.$eval('items | orderBy:["-b", "-a"]')).toEqual([
{'a': 20, 'b': 20},
{'a': 10, 'b': 20},
{'a': 20, 'b': 10},
{'a': 10, 'b': 10},
]);
- expect(parse('items | orderBy:["a", "-b"]').eval(scope.context, filters)).toEqual([
+ expect(scope.$eval('items | orderBy:["a", "-b"]')).toEqual([
{'a': 10, 'b': 20},
{'a': 10, 'b': 10},
{'a': 20, 'b': 20},
{'a': 20, 'b': 10},
]);
- expect(parse('items | orderBy:["a", "-b"]:true').eval(scope.context, filters)).toEqual([
+ expect(scope.$eval('items | orderBy:["a", "-b"]:true')).toEqual([
{'a': 20, 'b': 10},
{'a': 20, 'b': 20},
{'a': 10, 'b': 10},
@@ -165,16 +165,16 @@
}));
it('should support function expressions',
- inject((Scope scope, Parser parse, FilterMap filters) {
- scope.context['func'] = (e) => -(e['a'] + e['b']);
- expect(parse('items | orderBy:[func, "a", "-b"]').eval(scope.context, filters)).toEqual([
+ inject((Scope scope) {
+ scope['func'] = (e) => -(e['a'] + e['b']);
+ expect(scope.$eval('items | orderBy:[func, "a", "-b"]')).toEqual([
{'a': 20, 'b': 20},
{'a': 10, 'b': 20},
{'a': 20, 'b': 10},
{'a': 10, 'b': 10},
]);
- scope.context['func'] = (e) => (e is Name) ? e.lastName : e['lastName'];
- expect(parse('authors | orderBy:func').eval(scope.context, filters)).toEqual([
+ scope['func'] = (e) => (e is Name) ? e.lastName : e['lastName'];
+ expect(scope.$eval('authors | orderBy:func')).toEqual([
Jeffrey_Archer,
Isaac___Asimov,
Emily___Bronte,
« no previous file with comments | « third_party/pkg/angular/test/filter/lowercase_spec.dart ('k') | third_party/pkg/angular/test/filter/uppercase_spec.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698