row-ctrl-specs.js 961 B

12345678910111213141516171819202122232425262728293031323334
  1. define([
  2. './helpers',
  3. 'app/features/dashboard/rowCtrl'
  4. ], function(helpers) {
  5. 'use strict';
  6. describe('RowCtrl', function() {
  7. var ctx = new helpers.ControllerTestContext();
  8. beforeEach(module('grafana.controllers'));
  9. beforeEach(ctx.providePhase());
  10. beforeEach(ctx.createControllerPhase('RowCtrl'));
  11. describe('delete_row', function () {
  12. describe('when row is empty (has no panels)', function () {
  13. beforeEach(function () {
  14. ctx.scope.dashboard.rows = [{id: 1, panels: []}];
  15. ctx.scope.row = ctx.scope.dashboard.rows[0];
  16. ctx.scope.appEvent = sinon.spy();
  17. ctx.scope.deleteRow();
  18. });
  19. it('should NOT ask for confirmation', function () {
  20. expect(ctx.scope.appEvent.called).to.be(false);
  21. });
  22. it('should delete row', function () {
  23. expect(ctx.scope.dashboard.rows).to.not.contain(ctx.scope.row);
  24. });
  25. });
  26. });
  27. });
  28. });