Fixed init-test.

Mostly renames, new init semantic and I forgot to call
updateTemplateParams in addTemplateParameter
This commit is contained in:
Harald Kraemer
2014-05-20 09:43:57 +02:00
parent d04f2d5e2b
commit 51b70a7884
2 changed files with 6 additions and 4 deletions
+4 -2
View File
@@ -17,7 +17,7 @@ define([
var result = {
_updateTemplateData : function( initial ) {
this._templateData = {};
var _templateData = {};
_.each(this.templateParameters, function( templateParameter ) {
if (initial) {
var urlValue = $routeParams[ templateParameter.name ];
@@ -29,8 +29,9 @@ define([
return;
}
this._templateData[ templateParameter.name ] = templateParameter.current.value;
_templateData[ templateParameter.name ] = templateParameter.current.value;
});
this._templateData = _templateData;
},
templateOptionSelected : function(option) {
@@ -40,6 +41,7 @@ define([
addTemplateParameter : function( templateParameter ) {
this.templateParameters.push( templateParameter );
this._updateTemplateData();
},
applyTemplateToTarget : function(target) {
+2 -2
View File
@@ -21,12 +21,12 @@ define([
describe('init', function() {
beforeEach(function() {
_filterSrv.add({ name: 'test', current: { value: 'oogle' } });
_filterSrv.init();
_filterSrv.addTemplateParameter({ name: 'test', current: { value: 'oogle' } });
});
it('should initialize template data', function() {
var target = _filterSrv.applyFilterToTarget('this.[[test]].filters');
var target = _filterSrv.applyTemplateToTarget('this.[[test]].filters');
expect(target).to.be('this.oogle.filters');
});
});