fix(templating): fixed issue with detecting data source variable in other template variable definition, fixes #5165

This commit is contained in:
Torkel Ödegaard 2016-05-25 10:46:35 +02:00
parent 8c2b6b532d
commit 0daadc954c
2 changed files with 5 additions and 1 deletions

View File

@ -103,7 +103,7 @@ function (angular, _) {
}
variableName = regexEscape(variableName);
var findVarRegex = new RegExp('\\$(' + variableName + ')[\\W|$]|\\[\\[(' + variableName + ')\\]\\]', 'g');
var findVarRegex = new RegExp('\\$(' + variableName + ')(?:\\W|$)|\\[\\[(' + variableName + ')\\]\\]', 'g');
var match = findVarRegex.exec(str);
return match !== null;
};

View File

@ -205,6 +205,10 @@ define([
expect(contains).to.be(true);
});
it('should find it its the only thing', function() {
var contains = _templateSrv.containsVariable('$env', 'env');
expect(contains).to.be(true);
});
});
describe('updateTemplateData with simple value', function() {