Fixed init-test.
Mostly renames, new init semantic and I forgot to call updateTemplateParams in addTemplateParameter
This commit is contained in:
@@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user