From 0683742e83ce18f81d4c636f21836516227778e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 16 Jan 2017 22:27:35 +0100 Subject: [PATCH] tech(library upgrade): fixed unit test broken by angularjs upgrade, #7274 --- .../templating/specs/variable_srv_init_specs.ts | 3 +++ .../datasource/graphite/specs/query_ctrl_specs.ts | 3 +++ .../datasource/influxdb/specs/query_ctrl_specs.ts | 3 +++ .../datasource/opentsdb/specs/query-ctrl-specs.ts | 4 ++++ .../app/plugins/panel/graph/specs/graph_ctrl_specs.ts | 3 +++ .../panel/singlestat/specs/singlestat-specs.ts | 3 +++ public/test/specs/helpers.js | 1 + public/test/specs/shareModalCtrl-specs.js | 11 +++++++---- 8 files changed, 27 insertions(+), 4 deletions(-) diff --git a/public/app/features/templating/specs/variable_srv_init_specs.ts b/public/app/features/templating/specs/variable_srv_init_specs.ts index 533c70dfc25..5176c24dec5 100644 --- a/public/app/features/templating/specs/variable_srv_init_specs.ts +++ b/public/app/features/templating/specs/variable_srv_init_specs.ts @@ -12,6 +12,9 @@ describe('VariableSrv init', function() { beforeEach(angularMocks.module('grafana.core')); beforeEach(angularMocks.module('grafana.controllers')); beforeEach(angularMocks.module('grafana.services')); + beforeEach(angularMocks.module(function($compileProvider) { + $compileProvider.preAssignBindingsEnabled(true); + })); beforeEach(ctx.providePhase(['datasourceSrv', 'timeSrv', 'templateSrv', '$location'])); beforeEach(angularMocks.inject(($rootScope, $q, $location, $injector) => { diff --git a/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts b/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts index 663400a7dd5..95691ae0b7b 100644 --- a/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts +++ b/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts @@ -13,6 +13,9 @@ describe('GraphiteQueryCtrl', function() { beforeEach(angularMocks.module('grafana.core')); beforeEach(angularMocks.module('grafana.controllers')); beforeEach(angularMocks.module('grafana.services')); + beforeEach(angularMocks.module(function($compileProvider) { + $compileProvider.preAssignBindingsEnabled(true); + })); beforeEach(ctx.providePhase()); beforeEach(angularMocks.inject(($rootScope, $controller, $q) => { diff --git a/public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts b/public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts index 427869c1d10..44b593edc0e 100644 --- a/public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts +++ b/public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts @@ -10,6 +10,9 @@ describe('InfluxDBQueryCtrl', function() { beforeEach(angularMocks.module('grafana.core')); beforeEach(angularMocks.module('grafana.controllers')); beforeEach(angularMocks.module('grafana.services')); + beforeEach(angularMocks.module(function($compileProvider) { + $compileProvider.preAssignBindingsEnabled(true); + })); beforeEach(ctx.providePhase()); beforeEach(angularMocks.inject(($rootScope, $controller, $q) => { diff --git a/public/app/plugins/datasource/opentsdb/specs/query-ctrl-specs.ts b/public/app/plugins/datasource/opentsdb/specs/query-ctrl-specs.ts index 5924fac7a38..644af1e7bf7 100644 --- a/public/app/plugins/datasource/opentsdb/specs/query-ctrl-specs.ts +++ b/public/app/plugins/datasource/opentsdb/specs/query-ctrl-specs.ts @@ -7,6 +7,10 @@ describe('OpenTsQueryCtrl', function() { beforeEach(angularMocks.module('grafana.core')); beforeEach(angularMocks.module('grafana.services')); + beforeEach(angularMocks.module(function($compileProvider) { + $compileProvider.preAssignBindingsEnabled(true); + })); + beforeEach(ctx.providePhase(['backendSrv','templateSrv'])); beforeEach(ctx.providePhase()); diff --git a/public/app/plugins/panel/graph/specs/graph_ctrl_specs.ts b/public/app/plugins/panel/graph/specs/graph_ctrl_specs.ts index cac69807eab..d06c66e253a 100644 --- a/public/app/plugins/panel/graph/specs/graph_ctrl_specs.ts +++ b/public/app/plugins/panel/graph/specs/graph_ctrl_specs.ts @@ -12,6 +12,9 @@ describe('GraphCtrl', function() { beforeEach(angularMocks.module('grafana.services')); beforeEach(angularMocks.module('grafana.controllers')); + beforeEach(angularMocks.module(function($compileProvider) { + $compileProvider.preAssignBindingsEnabled(true); + })); beforeEach(ctx.providePhase()); beforeEach(ctx.createPanelController(GraphCtrl)); diff --git a/public/app/plugins/panel/singlestat/specs/singlestat-specs.ts b/public/app/plugins/panel/singlestat/specs/singlestat-specs.ts index bb51be9777b..3f67063bc0f 100644 --- a/public/app/plugins/panel/singlestat/specs/singlestat-specs.ts +++ b/public/app/plugins/panel/singlestat/specs/singlestat-specs.ts @@ -17,6 +17,9 @@ describe('SingleStatCtrl', function() { beforeEach(angularMocks.module('grafana.services')); beforeEach(angularMocks.module('grafana.controllers')); + beforeEach(angularMocks.module(function($compileProvider) { + $compileProvider.preAssignBindingsEnabled(true); + })); beforeEach(ctx.providePhase()); beforeEach(ctx.createPanelController(SingleStatCtrl)); diff --git a/public/test/specs/helpers.js b/public/test/specs/helpers.js index 96744672302..53c761aaa6c 100644 --- a/public/test/specs/helpers.js +++ b/public/test/specs/helpers.js @@ -162,6 +162,7 @@ define([ this.fillVariableValuesForUrl = function() {}; this.updateTemplateData = function() { }; this.variableExists = function() { return false; }; + this.variableInitialized = function() { }; this.highlightVariablesAsHtml = function(str) { return str; }; this.setGrafanaVariable = function(name, value) { this.data[name] = value; diff --git a/public/test/specs/shareModalCtrl-specs.js b/public/test/specs/shareModalCtrl-specs.js index 7e2df968e97..df0e4d6fe47 100644 --- a/public/test/specs/shareModalCtrl-specs.js +++ b/public/test/specs/shareModalCtrl-specs.js @@ -16,6 +16,9 @@ define([ beforeEach(module('grafana.controllers')); beforeEach(module('grafana.services')); + beforeEach(module(function($compileProvider) { + $compileProvider.preAssignBindingsEnabled(true); + })); beforeEach(ctx.providePhase()); @@ -28,7 +31,7 @@ define([ ctx.scope.panel = { id: 22 }; ctx.scope.init(); - expect(ctx.scope.shareUrl).to.be('http://server/#/test?from=1000&to=2000&panelId=22&fullscreen'); + expect(ctx.scope.shareUrl).to.be('http://server/#!/test?from=1000&to=2000&panelId=22&fullscreen'); }); it('should generate render url', function() { @@ -48,7 +51,7 @@ define([ ctx.scope.panel = null; ctx.scope.init(); - expect(ctx.scope.shareUrl).to.be('http://server/#/test?from=1000&to=2000'); + expect(ctx.scope.shareUrl).to.be('http://server/#!/test?from=1000&to=2000'); }); it('should add theme when specified', function() { @@ -57,7 +60,7 @@ define([ ctx.scope.panel = null; ctx.scope.init(); - expect(ctx.scope.shareUrl).to.be('http://server/#/test?from=1000&to=2000&theme=light'); + expect(ctx.scope.shareUrl).to.be('http://server/#!/test?from=1000&to=2000&theme=light'); }); it('should include template variables in url', function() { @@ -70,7 +73,7 @@ define([ }; ctx.scope.buildUrl(); - expect(ctx.scope.shareUrl).to.be('http://server/#/test?from=1000&to=2000&var-app=mupp&var-server=srv-01'); + expect(ctx.scope.shareUrl).to.be('http://server/#!/test?from=1000&to=2000&var-app=mupp&var-server=srv-01'); }); });