Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

fix(templates): replace the default interpolation symbol with the use…

…r configured one

Closes #309
  • Loading branch information...
Matt Lewis
Matt Lewis committed Mar 31, 2016
1 parent 7bf98bd commit 73a052e8eb9bbad5ac9c3aedcb6b45d2fa309cc9
Showing with 28 additions and 3 deletions.
  1. +5 −2 src/entry.js
  2. +1 −1 src/templates/calendarMonthCell.html
  3. +22 −0 test/unit/config.spec.js
@@ -35,11 +35,14 @@ module.exports = angular
}
});
})
.run(function($templateCache) {
.run(function($templateCache, $interpolate) {

angular.forEach(templates, function(template) {
if (!$templateCache.get(template.cacheTemplateName)) {
$templateCache.put(template.cacheTemplateName, template.template);
var templateContents = template.template
.replace('{{', $interpolate.startSymbol())
.replace('}}', $interpolate.endSymbol());
$templateCache.put(template.cacheTemplateName, templateContents);
}
});

@@ -32,7 +32,7 @@
<ng-include src="vm.calendarConfig.templates.calendarMonthCellEvents"></ng-include>

<div id="cal-week-box" ng-if="$first && rowHovered">
{{ vm.calendarConfig.i18nStrings.weekNumber.replace('{week}', day.date.clone().add(1, 'day').isoWeek()) }}
<span ng-bind="vm.calendarConfig.i18nStrings.weekNumber.replace('{week}', day.date.clone().add(1, 'day').isoWeek())"></span>
</div>

</div>
@@ -0,0 +1,22 @@
'use strict';

var angular = require('angular');

describe('calendar config', function() {

beforeEach(angular.mock.module('mwl.calendar', function($interpolateProvider) {
$interpolateProvider.startSymbol('[[');
$interpolateProvider.endSymbol(']]');
}));

var $templateCache;

beforeEach(inject(function(_$templateCache_) {
$templateCache = _$templateCache_;
}));

it('should replace the interpolation symbol with the user configured one in templates', function() {
expect($templateCache.get('mwl/calendarMonthCell.html').indexOf('class="cal-month-day [[ day.cssClass ]]"') > -1).to.be.true;
});

});

0 comments on commit 73a052e

Please sign in to comment.
You can’t perform that action at this time.