diff --git a/x-pack/plugins/ml/public/components/chart_tooltip/__tests__/chart_tooltip.js b/x-pack/plugins/ml/public/components/chart_tooltip/__tests__/chart_tooltip.js new file mode 100644 index 000000000000..5f5c1c465947 --- /dev/null +++ b/x-pack/plugins/ml/public/components/chart_tooltip/__tests__/chart_tooltip.js @@ -0,0 +1,26 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import ngMock from 'ng_mock'; +import expect from 'expect.js'; + +describe('ML - mlChartTooltipService', () => { + let mlChartTooltipService; + + beforeEach(ngMock.module('kibana')); + beforeEach(() => { + ngMock.inject(function ($injector) { + mlChartTooltipService = $injector.get('mlChartTooltipService'); + }); + }); + + it('service API duck typing', () => { + expect(mlChartTooltipService).to.be.an('object'); + expect(mlChartTooltipService.show).to.be.a('function'); + expect(mlChartTooltipService.hide).to.be.a('function'); + }); + +}); diff --git a/x-pack/plugins/ml/public/components/chart_tooltip/chart_tooltip.js b/x-pack/plugins/ml/public/components/chart_tooltip/chart_tooltip.js index 1a0a66fb4efb..8f2861a0aad3 100644 --- a/x-pack/plugins/ml/public/components/chart_tooltip/chart_tooltip.js +++ b/x-pack/plugins/ml/public/components/chart_tooltip/chart_tooltip.js @@ -68,20 +68,20 @@ module.directive('mlChartTooltip', function (mlChartTooltipService) { 'display': 'block' }); } + }; - this.hide = function () { - if (this.element !== null) { - this.element.css({ - 'opacity': '0', - }); + this.hide = function () { + if (this.element !== null) { + this.element.css({ + 'opacity': '0', + }); - // after the fade out transition has finished, set the display to - // none so it doesn't block any mouse events underneath it. - this.fadeTimeout = $timeout(() => { - this.element.css('display', 'none'); - this.fadeTimeout = null; - }, FADE_TIMEOUT_MS); - } - }; + // after the fade out transition has finished, set the display to + // none so it doesn't block any mouse events underneath it. + this.fadeTimeout = $timeout(() => { + this.element.css('display', 'none'); + this.fadeTimeout = null; + }, FADE_TIMEOUT_MS); + } }; });