feat(templating): lots of progress on template variable context specific formats, #2918, all elasticsearch / lucene use cases seem to work now

This commit is contained in:
Torkel Ödegaard
2016-03-01 08:43:54 +01:00
parent cb8b038795
commit f3ad71d751
7 changed files with 75 additions and 35 deletions

View File

@@ -3,7 +3,7 @@
"bitwise":false,
"curly": true,
"eqnull": true,
"globalstrict": true,
"strict": true,
"devel": true,
"eqeqeq": true,
"forin": false,
@@ -11,7 +11,7 @@
"supernew": true,
"expr": true,
"indent": 2,
"latedef": true,
"latedef": false,
"newcap": true,
"noarg": true,
"noempty": true,

View File

@@ -45,7 +45,7 @@ define([
});
});
describe.only('replace can pass multi / all format', function() {
describe('replace can pass multi / all format', function() {
beforeEach(function() {
_templateSrv.init([{name: 'test', current: {value: ['value1', 'value2'] }}]);
});
@@ -59,6 +59,19 @@ define([
var target = _templateSrv.replace('this=$test', {}, 'pipe');
expect(target).to.be('this=value1|value2');
});
it('should replace $test with piped value', function() {
var target = _templateSrv.replace('this=$test', {}, 'pipe');
expect(target).to.be('this=value1|value2');
});
});
describe.only('lucene format', function() {
it('should properly escape $test with lucene escape sequences', function() {
_templateSrv.init([{name: 'test', current: {value: 'value/4' }}]);
var target = _templateSrv.replace('this:$test', {}, 'lucene');
expect(target).to.be("this:value\\\/4");
});
});
describe('render variable to string values', function() {