Permalink
Browse files

fix($interpolate): $interpolateProvider.endSymbol() returns startSymbol

I also added missing tests.
  • Loading branch information...
1 parent 15d283b commit 20348717640c0ef405c9fdcc8fec5b566efc48b3 @IgorMinar IgorMinar committed Aug 11, 2012
Showing with 43 additions and 13 deletions.
  1. +1 −1 src/ng/interpolate.js
  2. +42 −12 test/ng/interpolateSpec.js
@@ -45,7 +45,7 @@ function $InterpolateProvider() {
endSymbol = value;
return this;
} else {
- return startSymbol;
+ return endSymbol;
}
};
@@ -31,18 +31,6 @@ describe('$interpolate', function() {
expect($interpolate('Hello {{name}}!')($rootScope)).toEqual('Hello Misko!');
}));
- describe('provider', function() {
- beforeEach(module(function($interpolateProvider) {
- $interpolateProvider.startSymbol('--');
- $interpolateProvider.endSymbol('--');
- }));
-
- it('should not get confused with same markers', inject(function($interpolate) {
- expect($interpolate('---').parts).toEqual(['---']);
- expect($interpolate('----')()).toEqual('');
- expect($interpolate('--1--')()).toEqual('1');
- }));
- });
describe('parseBindings', function() {
it('should Parse Text With No Bindings', inject(function($interpolate) {
@@ -110,4 +98,46 @@ describe('$interpolate', function() {
expect(parts[2]).toEqual('C\nD"');
}));
});
+
+
+ describe('startSymbol', function() {
+
+ beforeEach(module(function($interpolateProvider) {
+ expect($interpolateProvider.startSymbol()).toBe('{{');
+ $interpolateProvider.startSymbol('((');
+ }));
+
+
+ it('should expose the startSymbol in config phase', module(function($interpolateProvider) {
+ expect($interpolateProvider.startSymbol()).toBe('((');
+ }));
+
+
+ it('should not get confused by matching start and end symbols', function() {
+ module(function($interpolateProvider) {
+ $interpolateProvider.startSymbol('--');
+ $interpolateProvider.endSymbol('--');
+ });
+
+ inject(function($interpolate) {
+ expect($interpolate('---').parts).toEqual(['---']);
+ expect($interpolate('----')()).toEqual('');
+ expect($interpolate('--1--')()).toEqual('1');
+ });
+ });
+ });
+
+
+ describe('endSymbol', function() {
+
+ beforeEach(module(function($interpolateProvider) {
+ expect($interpolateProvider.endSymbol()).toBe('}}');
+ $interpolateProvider.endSymbol('))');
+ }));
+
+
+ it('should expose the endSymbol in config phase', module(function($interpolateProvider) {
+ expect($interpolateProvider.endSymbol()).toBe('))');
+ }));
+ });
});

0 comments on commit 2034871

Please sign in to comment.