2014-08-11 08:59:03 -05:00
|
|
|
define([
|
2015-09-15 06:23:36 -05:00
|
|
|
'./helpers',
|
|
|
|
'app/features/dashboard/rowCtrl'
|
2014-08-11 08:59:03 -05:00
|
|
|
], function(helpers) {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
describe('RowCtrl', function() {
|
|
|
|
var ctx = new helpers.ControllerTestContext();
|
|
|
|
|
|
|
|
beforeEach(module('grafana.controllers'));
|
|
|
|
beforeEach(ctx.providePhase());
|
|
|
|
beforeEach(ctx.createControllerPhase('RowCtrl'));
|
|
|
|
|
2015-09-03 02:55:50 -05:00
|
|
|
describe('delete_row', function () {
|
|
|
|
describe('when row is empty (has no panels)', function () {
|
|
|
|
beforeEach(function () {
|
|
|
|
ctx.scope.dashboard.rows = [{id: 1, panels: []}];
|
|
|
|
ctx.scope.row = ctx.scope.dashboard.rows[0];
|
|
|
|
ctx.scope.appEvent = sinon.spy();
|
2014-08-11 08:59:03 -05:00
|
|
|
|
2015-12-15 07:03:15 -06:00
|
|
|
ctx.scope.deleteRow();
|
2015-09-03 02:55:50 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should NOT ask for confirmation', function () {
|
|
|
|
expect(ctx.scope.appEvent.called).to.be(false);
|
|
|
|
});
|
2014-08-11 08:59:03 -05:00
|
|
|
|
2015-09-03 02:55:50 -05:00
|
|
|
it('should delete row', function () {
|
|
|
|
expect(ctx.scope.dashboard.rows).to.not.contain(ctx.scope.row);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|