|
|
@@ -345,6 +345,49 @@ describe('templateSrv', function() {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+ describe('fillVariableValuesForUrl skip url sync', function() {
|
|
|
+ beforeEach(function() {
|
|
|
+ initTemplateSrv([
|
|
|
+ {
|
|
|
+ name: 'test',
|
|
|
+ skipUrlSync: true,
|
|
|
+ current: { value: 'value' },
|
|
|
+ getValueForUrl: function() {
|
|
|
+ return this.current.value;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ]);
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should not include template variable value in url', function() {
|
|
|
+ var params = {};
|
|
|
+ _templateSrv.fillVariableValuesForUrl(params);
|
|
|
+ expect(params['var-test']).toBe(undefined);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ describe('fillVariableValuesForUrl with multi value with skip url sync', function() {
|
|
|
+ beforeEach(function() {
|
|
|
+ initTemplateSrv([
|
|
|
+ {
|
|
|
+ type: 'query',
|
|
|
+ name: 'test',
|
|
|
+ skipUrlSync: true,
|
|
|
+ current: { value: ['val1', 'val2'] },
|
|
|
+ getValueForUrl: function() {
|
|
|
+ return this.current.value;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ]);
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should not include template variable value in url', function() {
|
|
|
+ var params = {};
|
|
|
+ _templateSrv.fillVariableValuesForUrl(params);
|
|
|
+ expect(params['var-test']).toBe(undefined);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
describe('fillVariableValuesForUrl with multi value and scopedVars', function() {
|
|
|
beforeEach(function() {
|
|
|
initTemplateSrv([{ type: 'query', name: 'test', current: { value: ['val1', 'val2'] } }]);
|
|
|
@@ -359,6 +402,20 @@ describe('templateSrv', function() {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+ describe('fillVariableValuesForUrl with multi value, scopedVars and skip url sync', function() {
|
|
|
+ beforeEach(function() {
|
|
|
+ initTemplateSrv([{ type: 'query', name: 'test', current: { value: ['val1', 'val2'] } }]);
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should not set scoped value as url params', function() {
|
|
|
+ var params = {};
|
|
|
+ _templateSrv.fillVariableValuesForUrl(params, {
|
|
|
+ test: { name: 'test', value: 'val1', skipUrlSync: true },
|
|
|
+ });
|
|
|
+ expect(params['var-test']).toBe(undefined);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
describe('replaceWithText', function() {
|
|
|
beforeEach(function() {
|
|
|
initTemplateSrv([
|