|
|
@@ -177,4 +177,61 @@ define([
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
+
|
|
|
+ dynamicDashScenario('given dashboard with row repeat and panel repeat', function(ctx) {
|
|
|
+ ctx.setup(function(dash) {
|
|
|
+ dash.rows.push({
|
|
|
+ repeat: 'servers',
|
|
|
+ panels: [{id: 2, repeat: 'metric'}]
|
|
|
+ });
|
|
|
+ dash.templating.list.push({
|
|
|
+ name: 'servers',
|
|
|
+ current: { text: 'se1, se2', value: ['se1', 'se2'] },
|
|
|
+ options: [
|
|
|
+ {text: 'se1', value: 'se1', selected: true},
|
|
|
+ {text: 'se2', value: 'se2', selected: true},
|
|
|
+ ]
|
|
|
+ });
|
|
|
+ dash.templating.list.push({
|
|
|
+ name: 'metric',
|
|
|
+ current: { text: 'm1, m2', value: ['m1', 'm2'] },
|
|
|
+ options: [
|
|
|
+ {text: 'm1', value: 'm1', selected: true},
|
|
|
+ {text: 'm2', value: 'm2', selected: true},
|
|
|
+ ]
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should repeat row one time', function() {
|
|
|
+ expect(ctx.rows.length).to.be(2);
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should repeat panel on both rows', function() {
|
|
|
+ expect(ctx.rows[0].panels.length).to.be(2);
|
|
|
+ expect(ctx.rows[1].panels.length).to.be(2);
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should keep panel ids on first row', function() {
|
|
|
+ expect(ctx.rows[0].panels[0].id).to.be(2);
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should mark second row as repeated', function() {
|
|
|
+ expect(ctx.rows[0].repeat).to.be('servers');
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should clear repeat field on repeated row', function() {
|
|
|
+ expect(ctx.rows[1].repeat).to.be(null);
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should generate a repeartRowId based on repeat row index', function() {
|
|
|
+ expect(ctx.rows[1].repeatRowId).to.be(1);
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should set scopedVars on row panels', function() {
|
|
|
+ expect(ctx.rows[0].panels[0].scopedVars.servers.value).to.be('se1');
|
|
|
+ expect(ctx.rows[1].panels[0].scopedVars.servers.value).to.be('se2');
|
|
|
+ });
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
});
|