Commit 51b70a78 by Harald Kraemer

Fixed init-test.

Mostly renames, new init semantic and I forgot to call
updateTemplateParams in addTemplateParameter
parent d04f2d5e
......@@ -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) {
......
......@@ -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');
});
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment