From 8160e68f935ce1947615034ad397bb1690f391bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 17 Nov 2017 16:18:30 +0100 Subject: [PATCH] fix: build & tests --- jest.config.js | 2 +- public/app/core/components/search/search.html | 34 +++--- .../dashboard/specs/save_as_modal.jest.ts | 105 +++++++++--------- 3 files changed, 68 insertions(+), 73 deletions(-) diff --git a/jest.config.js b/jest.config.js index cbe77c4e30f..ead97e39dad 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,6 +1,6 @@ module.exports = { - verbose: true, + verbose: false, "globals": { "ts-jest": { "tsConfigFile": "tsconfig.json" diff --git a/public/app/core/components/search/search.html b/public/app/core/components/search/search.html index 0b6cceec6b2..4342042b052 100644 --- a/public/app/core/components/search/search.html +++ b/public/app/core/components/search/search.html @@ -51,27 +51,27 @@ - -
-
No dashboards matching your query were found.
+
+
No dashboards matching your query were found.
-
- - - - {{tag}} +
+ + + + {{tag}} + + + + - - - - - - - {{::row.title}} - - + + + {{::row.title}} + + +
diff --git a/public/app/features/dashboard/specs/save_as_modal.jest.ts b/public/app/features/dashboard/specs/save_as_modal.jest.ts index 913209eb01f..b2ab77f2255 100644 --- a/public/app/features/dashboard/specs/save_as_modal.jest.ts +++ b/public/app/features/dashboard/specs/save_as_modal.jest.ts @@ -1,67 +1,62 @@ -import {SaveDashboardAsModalCtrl} from '../save_as_modal'; -import {describe, it, expect} from 'test/lib/common'; +import { SaveDashboardAsModalCtrl } from '../save_as_modal'; +import { describe, it, expect } from 'test/lib/common'; describe('saving dashboard as', () => { - function scenario(name, panel, verify) { - describe(name, () => { - var json = { - title: "name", - rows: [ { panels: [ - panel - ]}] - }; + function scenario(name, panel, verify) { + describe(name, () => { + var json = { + title: 'name', + panels: [panel], + }; - var mockDashboardSrv = { - getCurrent: function() { - return { - id: 5, - getSaveModelClone: function() { - return json; - } - }; - } - }; + var mockDashboardSrv = { + getCurrent: function() { + return { + id: 5, + meta: {}, + getSaveModelClone: function() { + return json; + }, + }; + }, + }; - var ctrl = new SaveDashboardAsModalCtrl(mockDashboardSrv); - var ctx: any = { - clone: ctrl.clone, - ctrl: ctrl, - panel: {} - }; - for (let row of ctrl.clone.rows) { - for (let panel of row.panels) { - ctx.panel = panel; - } - } - it("verify", () => { - verify(ctx); - }); - }); - } + var ctrl = new SaveDashboardAsModalCtrl(mockDashboardSrv); + var ctx: any = { + clone: ctrl.clone, + ctrl: ctrl, + panel: panel + }; - scenario("default values", {}, (ctx) => { - var clone = ctx.clone; - expect(clone.id).toBe(null); - expect(clone.title).toBe("name Copy"); - expect(clone.editable).toBe(true); - expect(clone.hideControls).toBe(false); + it('verify', () => { + verify(ctx); + }); }); + } - var graphPanel = { id: 1, type: "graph", alert: { rule: 1}, thresholds: { value: 3000} }; + scenario('default values', {}, ctx => { + var clone = ctx.clone; + expect(clone.id).toBe(null); + expect(clone.title).toBe('name Copy'); + expect(clone.editable).toBe(true); + expect(clone.hideControls).toBe(false); + }); - scenario("should remove alert from graph panel", graphPanel , (ctx) => { - expect(ctx.panel.alert).toBe(undefined); - }); + var graphPanel = { id: 1, type: 'graph', alert: { rule: 1 }, thresholds: { value: 3000 } }; - scenario("should remove threshold from graph panel", graphPanel, (ctx) => { - expect(ctx.panel.thresholds).toBe(undefined); - }); + scenario('should remove alert from graph panel', graphPanel, ctx => { + expect(ctx.panel.alert).toBe(undefined); + }); - scenario("singlestat should keep threshold", { id: 1, type: "singlestat", thresholds: { value: 3000} }, (ctx) => { - expect(ctx.panel.thresholds).not.toBe(undefined); - }); + scenario('should remove threshold from graph panel', graphPanel, ctx => { + expect(ctx.panel.thresholds).toBe(undefined); + }); - scenario("table should keep threshold", { id: 1, type: "table", thresholds: { value: 3000} }, (ctx) => { - expect(ctx.panel.thresholds).not.toBe(undefined); - }); + scenario('singlestat should keep threshold', { id: 1, type: 'singlestat', thresholds: { value: 3000 } }, ctx => { + expect(ctx.panel.thresholds).not.toBe(undefined); + }); + + scenario('table should keep threshold', { id: 1, type: 'table', thresholds: { value: 3000 } }, ctx => { + expect(ctx.panel.thresholds).not.toBe(undefined); + }); });