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

Unified Diff: third_party/pkg/angular/test/core/interpolate_spec.dart

Issue 257423008: 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/core/interpolate_spec.dart
diff --git a/third_party/pkg/angular/test/core/interpolate_spec.dart b/third_party/pkg/angular/test/core/interpolate_spec.dart
index 818cde2ab2d182679f943fe147e2275672be0216..348bef28c3fcbf916108c4e08db533e869e1e065 100644
--- a/third_party/pkg/angular/test/core/interpolate_spec.dart
+++ b/third_party/pkg/angular/test/core/interpolate_spec.dart
@@ -7,107 +7,35 @@ class ToStringableObject {
}
main() {
- describe('\$interpolate', () {
+ describe('interpolate', () {
it('should return undefined when there are no bindings and textOnly is set to true',
- inject((Interpolate $interpolate) {
- expect($interpolate('some text', true)).toBe(null);
- }));
-
- it('should suppress falsy objects', inject((Interpolate $interpolate) {
- expect($interpolate('{{undefined}}')([null])).toEqual('');
- expect($interpolate('{{undefined+undefined}}')([null])).toEqual('');
- expect($interpolate('{{null}}')([null])).toEqual('');
- expect($interpolate('{{a.b}}')([null])).toEqual('');
- }));
-
- it('should jsonify objects', inject((Interpolate $interpolate) {
- expect($interpolate('{{ {} }}')([{}])).toEqual('{}');
- expect($interpolate('{{ true }}')([true])).toEqual('true');
- expect($interpolate('{{ false }}')([false])).toEqual('false');
- }));
-
-
- it('should return interpolation function', inject((Interpolate $interpolate, Scope rootScope) {
- rootScope.context['name'] = 'Misko';
- var fn = $interpolate('Hello {{name}}!');
- expect(fn(['Misko'])).toEqual('Hello Misko!');
- }));
-
-
- it('should ignore undefined model', inject((Interpolate $interpolate) {
- expect($interpolate("Hello {{'World' + foo}}")(['World'])).toEqual('Hello World');
- }));
-
-
- it('should use toString to conver objects to string', inject((Interpolate $interpolate, Scope rootScope) {
- expect($interpolate("Hello, {{obj}}!")([new ToStringableObject()])).toEqual('Hello, World!');
- }));
-
-
- describe('parseBindings', () {
- it('should Parse Text With No Bindings', inject((Interpolate $interpolate) {
- var parts = $interpolate("a").seperators;
- expect(parts.length).toEqual(1);
- expect(parts[0]).toEqual("a");
- }));
-
- it('should Parse Empty Text', inject((Interpolate $interpolate) {
- var parts = $interpolate("").seperators;
- expect(parts.length).toEqual(1);
- expect(parts[0]).toEqual("");
- }));
-
- it('should Parse Inner Binding', inject((Interpolate $interpolate) {
- var parts = $interpolate("a{{b}}C").seperators;
- expect(parts.length).toEqual(2);
- expect(parts[0]).toEqual("a");
- expect(parts[1]).toEqual("C");
- }));
-
- it('should Parse Ending Binding', inject((Interpolate $interpolate) {
- var parts = $interpolate("a{{b}}").seperators;
- expect(parts.length).toEqual(2);
- expect(parts[0]).toEqual("a");
- expect(parts[1]).toEqual("");
- }));
-
- it('should Parse Begging Binding', inject((Interpolate $interpolate) {
- var parts = $interpolate("{{b}}c").seperators;
- expect(parts.length).toEqual(2);
- expect(parts[0]).toEqual("");
- expect(parts[1]).toEqual("c");
- }));
-
- it('should Parse Loan Binding', inject((Interpolate $interpolate) {
- var parts = $interpolate("{{b}}").seperators;
- expect(parts.length).toEqual(2);
- expect(parts[0]).toEqual("");
- expect(parts[1]).toEqual("");
- }));
+ (Interpolate interpolate) {
+ expect(interpolate('some text', true)).toBe(null);
+ });
- it('should Parse Two Bindings', inject((Interpolate $interpolate) {
- var parts = $interpolate("{{b}}{{c}}").seperators;
- expect(parts.length).toEqual(3);
- expect(parts[0]).toEqual("");
- expect(parts[1]).toEqual("");
- expect(parts[2]).toEqual("");
- }));
+ it('should return an expression', (Interpolate interpolate) {
+ expect(interpolate('Hello {{name}}!'))
+ .toEqual('"Hello "+(name|stringify)+"!"');
+ expect(interpolate('a{{b}}C'))
+ .toEqual('"a"+(b|stringify)+"C"');
+ expect(interpolate('a{{b}}')).toEqual('"a"+(b|stringify)');
+ expect(interpolate('{{a}}b')).toEqual('(a|stringify)+"b"');
+ expect(interpolate('{{b}}')).toEqual('(b|stringify)');
+ expect(interpolate('{{b}}+{{c}}'))
+ .toEqual('(b|stringify)+"+"+(c|stringify)');
+ expect(interpolate('{{b}}x{{c}}'))
+ .toEqual('(b|stringify)+"x"+(c|stringify)');
+ });
- it('should Parse Two Bindings With Text In Middle', inject((Interpolate $interpolate) {
- var parts = $interpolate("{{b}}x{{c}}").seperators;
- expect(parts.length).toEqual(3);
- expect(parts[0]).toEqual("");
- expect(parts[1]).toEqual("x");
- expect(parts[2]).toEqual("");
- }));
+ it('should Parse Multiline', (Interpolate interpolate) {
+ expect(interpolate("X\nY{{A\n+B}}C\nD"))
+ .toEqual('"X\nY"+(A\n+B|stringify)+"C\nD"');
+ });
- it('should Parse Multiline', inject((Interpolate $interpolate) {
- var parts = $interpolate('"X\nY{{A\n+B}}C\nD"').seperators;
- expect(parts.length).toEqual(2);
- expect(parts[0]).toEqual('"X\nY');
- expect(parts[1]).toEqual('C\nD"');
- }));
+ it('should escape double quotes', (Interpolate interpolate) {
+ expect(interpolate(r'"{{a}}')).toEqual(r'"\""+(a|stringify)');
+ expect(interpolate(r'\"{{a}}')).toEqual(r'"\\\""+(a|stringify)');
});
});
-}
+}

Powered by Google App Engine
This is Rietveld 408576698