|
|
@@ -76,8 +76,8 @@ describe('VariableSrv init', function(this: any) {
|
|
|
{
|
|
|
name: 'apps',
|
|
|
type: type,
|
|
|
- current: { text: 'test', value: 'test' },
|
|
|
- options: [{ text: 'test', value: 'test' }],
|
|
|
+ current: { text: 'Test', value: 'test' },
|
|
|
+ options: [{ text: 'Test', value: 'test' }],
|
|
|
},
|
|
|
];
|
|
|
scenario.urlParams['var-apps'] = 'new';
|
|
|
@@ -160,11 +160,11 @@ describe('VariableSrv init', function(this: any) {
|
|
|
name: 'apps',
|
|
|
type: 'query',
|
|
|
multi: true,
|
|
|
- current: { text: 'val1', value: 'val1' },
|
|
|
+ current: { text: 'Val1', value: 'val1' },
|
|
|
options: [
|
|
|
- { text: 'val1', value: 'val1' },
|
|
|
- { text: 'val2', value: 'val2' },
|
|
|
- { text: 'val3', value: 'val3', selected: true },
|
|
|
+ { text: 'Val1', value: 'val1' },
|
|
|
+ { text: 'Val2', value: 'val2' },
|
|
|
+ { text: 'Val3', value: 'val3', selected: true },
|
|
|
],
|
|
|
},
|
|
|
];
|
|
|
@@ -176,7 +176,7 @@ describe('VariableSrv init', function(this: any) {
|
|
|
expect(variable.current.value.length).toBe(2);
|
|
|
expect(variable.current.value[0]).toBe('val2');
|
|
|
expect(variable.current.value[1]).toBe('val1');
|
|
|
- expect(variable.current.text).toBe('val2 + val1');
|
|
|
+ expect(variable.current.text).toBe('Val2 + Val1');
|
|
|
expect(variable.options[0].selected).toBe(true);
|
|
|
expect(variable.options[1].selected).toBe(true);
|
|
|
});
|
|
|
@@ -187,6 +187,30 @@ describe('VariableSrv init', function(this: any) {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+ describeInitScenario(
|
|
|
+ 'when template variable is present in url multiple times and variables have no text',
|
|
|
+ scenario => {
|
|
|
+ scenario.setup(() => {
|
|
|
+ scenario.variables = [
|
|
|
+ {
|
|
|
+ name: 'apps',
|
|
|
+ type: 'query',
|
|
|
+ multi: true,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ scenario.urlParams['var-apps'] = ['val1', 'val2'];
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should display concatenated values in text', () => {
|
|
|
+ const variable = ctx.variableSrv.variables[0];
|
|
|
+ expect(variable.current.value.length).toBe(2);
|
|
|
+ expect(variable.current.value[0]).toBe('val1');
|
|
|
+ expect(variable.current.value[1]).toBe('val2');
|
|
|
+ expect(variable.current.text).toBe('val1 + val2');
|
|
|
+ });
|
|
|
+ }
|
|
|
+ );
|
|
|
+
|
|
|
describeInitScenario('when template variable is present in url multiple times using key/values', scenario => {
|
|
|
scenario.setup(() => {
|
|
|
scenario.variables = [
|