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

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

Issue 256553002: Revert "Update all Angular libs (run update_all.sh)." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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/limit_to_spec.dart
diff --git a/third_party/pkg/angular/test/filter/limit_to_spec.dart b/third_party/pkg/angular/test/filter/limit_to_spec.dart
new file mode 100644
index 0000000000000000000000000000000000000000..4652e6a0bd9291e341e2638f6b38ab23b172e028
--- /dev/null
+++ b/third_party/pkg/angular/test/filter/limit_to_spec.dart
@@ -0,0 +1,55 @@
+library limit_to_spec;
+
+import '../_specs.dart';
+
+main() {
+ describe('orderBy filter', () {
+ beforeEach(() => inject((Scope scope, Parser parse, FilterMap filters) {
+ scope.context['list'] = 'abcdefgh'.split('');
+ scope.context['string'] = 'tuvwxyz';
+ }));
+
+ it('should return the first X items when X is positive', inject((Scope scope, Parser parse, FilterMap filters) {
+ scope.context['limit'] = 3;
+ expect(parse('list | limitTo: 3').eval(scope.context, filters)).toEqual(['a', 'b', 'c']);
+ expect(parse('list | limitTo: limit').eval(scope.context, filters)).toEqual(['a', 'b', 'c']);
+ expect(parse('string | limitTo: 3').eval(scope.context, filters)).toEqual('tuv');
+ expect(parse('string | limitTo: limit').eval(scope.context, filters)).toEqual('tuv');
+ }));
+
+ it('should return the last X items when X is negative', inject((Scope scope, Parser parse, FilterMap filters) {
+ scope.context['limit'] = 3;
+ expect(parse('list | limitTo: -3').eval(scope.context, filters)).toEqual(['f', 'g', 'h']);
+ expect(parse('list | limitTo: -limit').eval(scope.context, filters)).toEqual(['f', 'g', 'h']);
+ expect(parse('string | limitTo: -3').eval(scope.context, filters)).toEqual('xyz');
+ expect(parse('string | limitTo: -limit').eval(scope.context, filters)).toEqual('xyz');
+ }));
+
+ it('should return an null when limiting null list',
+ inject((Scope scope, Parser parse, FilterMap filters) {
+ expect(parse('null | limitTo: 1').eval(scope.context, filters)).toEqual(null);
+ expect(parse('thisIsNull | limitTo: 1').eval(scope.context, filters)).toEqual(null);
+ }));
+
+ it('should return an empty array when X cannot be parsed',
+ inject((Scope scope, Parser parse, FilterMap filters) {
+ expect(parse('list | limitTo: bogus').eval(scope.context, filters)).toEqual([]);
+ expect(parse('string | limitTo: null').eval(scope.context, filters)).toEqual([]);
+ expect(parse('string | limitTo: thisIsNull').eval(scope.context, filters)).toEqual([]);
+ }));
+
+ it('should return a copy of input array if X is exceeds array length',
+ inject((Scope scope, Parser parse, FilterMap filters) {
+ expect(parse('list | limitTo: 20').eval(scope.context, filters)).toEqual(scope.context['list']);
+ expect(parse('list | limitTo: -20').eval(scope.context, filters)).toEqual(scope.context['list']);
+ expect(parse('list | limitTo: 20').eval(scope.context, filters)).not.toBe(scope.context['list']);
+ }));
+
+ it('should return the entire string if X exceeds input length',
+ inject((Scope scope, Parser parse, FilterMap filters) {
+ expect(parse('string | limitTo: 20').eval(scope.context, filters)).toEqual(scope.context['string']);
+ expect(parse('string | limitTo: -20').eval(scope.context, filters)).toEqual(scope.context['string']);
+ }));
+
+ });
+}
« no previous file with comments | « third_party/pkg/angular/test/filter/json_spec.dart ('k') | third_party/pkg/angular/test/filter/lowercase_spec.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698