| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- define([
- 'features/dashboard/unsavedChangesSrv',
- 'features/dashboard/dashboardSrv'
- ], function() {
- 'use strict';
- describe("unsavedChangesSrv", function() {
- var _unsavedChangesSrv;
- var _dashboardSrv;
- var _location;
- var _contextSrvStub = {
- isEditor: true
- };
- var _rootScope;
- var tracker;
- beforeEach(module('grafana.services'));
- beforeEach(module(function($provide) {
- $provide.value('contextSrv', _contextSrvStub);
- }));
- beforeEach(inject(function(unsavedChangesSrv, $location, $rootScope, dashboardSrv) {
- _unsavedChangesSrv = unsavedChangesSrv;
- _dashboardSrv = dashboardSrv;
- _location = $location;
- _rootScope = $rootScope;
- }));
- describe('when dashboard is modified and route changes', function() {
- beforeEach(function() {
- var dash = _dashboardSrv.create({});
- var scope = _rootScope.$new();
- scope.appEvent = sinon.spy();
- scope.onAppEvent = sinon.spy();
- tracker = _unsavedChangesSrv.constructor(dash, scope);
- });
- it('No changes should not have changes', function() {
- expect(tracker.hasChanges()).to.be(false);
- });
- });
- });
- });
|