fix(templating): Another atempt at fixing #2534 (Init multi value template var used in repeat panel from url), fixes #2564

Conflicts:
	CHANGELOG.md
This commit is contained in:
Torkel Ödegaard
2015-08-21 10:40:14 +02:00
parent c9b2cec5ff
commit ea187961da
3 changed files with 36 additions and 7 deletions

View File

@@ -59,16 +59,16 @@ define([
beforeEach(function() {
var dashboard = { templating: { list: [variable] } };
var urlParams = {};
urlParams["var-apps"] = ["val1", "val2"];
urlParams["var-apps"] = ["val2", "val1"];
ctx.$location.search = sinon.stub().returns(urlParams);
ctx.service.init(dashboard);
});
it('should update current value', function() {
expect(variable.current.value.length).to.be(2);
expect(variable.current.value[0]).to.be("val1");
expect(variable.current.value[1]).to.be("val2");
expect(variable.current.text).to.be("val1 + val2");
expect(variable.current.value[0]).to.be("val2");
expect(variable.current.value[1]).to.be("val1");
expect(variable.current.text).to.be("val2 + val1");
expect(variable.options[0].selected).to.be(true);
expect(variable.options[1].selected).to.be(true);
});