').css({
height: 40,
width: 40
})
@@ -72,7 +72,7 @@ function createData(seriesData) {
yAxisDiv = el.append('div')
.attr('class', 'y-axis-div');
- var dataObj = new Data(data, {
+ let dataObj = new Data(data, {
defaultYMin: true
}, persistedState);
@@ -133,10 +133,10 @@ describe('Vislib yAxis Class Test Suite', function () {
let yScale;
let graphData;
let domain;
- var height = 50;
+ let height = 50;
function checkDomain(min, max) {
- var domain = yScale.domain();
+ let domain = yScale.domain();
expect(domain[0]).to.be.lessThan(min + 1);
expect(domain[1]).to.be.greaterThan(max - 1);
return domain;
@@ -181,9 +181,9 @@ describe('Vislib yAxis Class Test Suite', function () {
it('should have domain between 0 and max value', function () {
- var min = 0;
- var max = _.max(_.flattenDeep(graphData));
- var domain = checkDomain(min, max);
+ let min = 0;
+ let max = _.max(_.flattenDeep(graphData));
+ let domain = checkDomain(min, max);
expect(domain[1]).to.be.greaterThan(0);
checkRange();
});
@@ -200,9 +200,9 @@ describe('Vislib yAxis Class Test Suite', function () {
});
it('should have domain between min value and 0', function () {
- var min = _.min(_.flattenDeep(graphData));
- var max = 0;
- var domain = checkDomain(min, max);
+ let min = _.min(_.flattenDeep(graphData));
+ let max = 0;
+ let domain = checkDomain(min, max);
expect(domain[0]).to.be.lessThan(0);
checkRange();
});
@@ -219,9 +219,9 @@ describe('Vislib yAxis Class Test Suite', function () {
});
it('should have domain between min and max values', function () {
- var min = _.min(_.flattenDeep(graphData));
- var max = _.max(_.flattenDeep(graphData));
- var domain = checkDomain(min, max);
+ let min = _.min(_.flattenDeep(graphData));
+ let max = _.max(_.flattenDeep(graphData));
+ let domain = checkDomain(min, max);
expect(domain[0]).to.be.lessThan(0);
expect(domain[1]).to.be.greaterThan(0);
checkRange();
@@ -236,8 +236,8 @@ describe('Vislib yAxis Class Test Suite', function () {
});
it('should throw a NaN error', function () {
- var min = 'Not a number';
- var max = 12;
+ let min = 'Not a number';
+ let max = 12;
expect(function () {
yAxis._validateUserExtents(min, max);
@@ -250,7 +250,7 @@ describe('Vislib yAxis Class Test Suite', function () {
domain = [];
domain[0] = yAxis._attr.yAxis.min = 20;
domain[1] = yAxis._attr.yAxis.max = 80;
- var newDomain = yAxis._validateUserExtents(domain);
+ let newDomain = yAxis._validateUserExtents(domain);
expect(newDomain[0]).to.be(domain[0] / 100);
expect(newDomain[1]).to.be(domain[1] / 100);
@@ -258,7 +258,7 @@ describe('Vislib yAxis Class Test Suite', function () {
it('should return the user defined value', function () {
domain = [20, 50];
- var newDomain = yAxis._validateUserExtents(domain);
+ let newDomain = yAxis._validateUserExtents(domain);
expect(newDomain[0]).to.be(domain[0]);
expect(newDomain[1]).to.be(domain[1]);
@@ -267,8 +267,8 @@ describe('Vislib yAxis Class Test Suite', function () {
describe('should throw an error when', function () {
it('min === max', function () {
- var min = 12;
- var max = 12;
+ let min = 12;
+ let max = 12;
expect(function () {
yAxis._validateAxisExtents(min, max);
@@ -276,8 +276,8 @@ describe('Vislib yAxis Class Test Suite', function () {
});
it('min > max', function () {
- var min = 30;
- var max = 10;
+ let min = 30;
+ let max = 10;
expect(function () {
yAxis._validateAxisExtents(min, max);
@@ -287,7 +287,7 @@ describe('Vislib yAxis Class Test Suite', function () {
});
describe('getScaleType method', function () {
- var fnNames = ['linear', 'log', 'square root'];
+ let fnNames = ['linear', 'log', 'square root'];
it('should return a function', function () {
fnNames.forEach(function (fnName) {
@@ -319,7 +319,7 @@ describe('Vislib yAxis Class Test Suite', function () {
});
it('should return a yMin value of 1', function () {
- var yMin = yAxis._logDomain(0, 200)[0];
+ let yMin = yAxis._logDomain(0, 200)[0];
expect(yMin).to.be(1);
});
});
@@ -343,13 +343,13 @@ describe('Vislib yAxis Class Test Suite', function () {
it('should use percentage format for percentages', function () {
yAxis._attr.mode = 'percentage';
- var tickFormat = yAxis.getYAxis().tickFormat();
+ let tickFormat = yAxis.getYAxis().tickFormat();
expect(tickFormat(1)).to.be('100%');
});
it('should use decimal format for small values', function () {
yAxis.yMax = 1;
- var tickFormat = yAxis.getYAxis().tickFormat();
+ let tickFormat = yAxis.getYAxis().tickFormat();
expect(tickFormat(0.8)).to.be('0.8');
});
@@ -384,23 +384,23 @@ describe('Vislib yAxis Class Test Suite', function () {
});
describe('#tickFormat()', function () {
- var formatter = function () {};
+ let formatter = function () {};
it('returns a basic number formatter by default', function () {
- var yAxis = buildYAxis();
+ let yAxis = buildYAxis();
expect(yAxis.tickFormat()).to.not.be(formatter);
expect(yAxis.tickFormat()(1)).to.be('1');
});
it('returns the yAxisFormatter when passed', function () {
- var yAxis = buildYAxis({
+ let yAxis = buildYAxis({
yAxisFormatter: formatter
});
expect(yAxis.tickFormat()).to.be(formatter);
});
it('returns a percentage formatter when the vis is in percentage mode', function () {
- var yAxis = buildYAxis({
+ let yAxis = buildYAxis({
yAxisFormatter: formatter,
_attr: {
mode: 'percentage'
diff --git a/src/ui/public/vislib/__tests__/vis.js b/src/ui/public/vislib/__tests__/vis.js
index d80730ecfca7f..9129ca2a9d84c 100644
--- a/src/ui/public/vislib/__tests__/vis.js
+++ b/src/ui/public/vislib/__tests__/vis.js
@@ -11,14 +11,14 @@ import $ from 'jquery';
import FixturesVislibVisFixtureProvider from 'fixtures/vislib/_vis_fixture';
import PersistedStatePersistedStateProvider from 'ui/persisted_state/persisted_state';
-var dataArray = [
+let dataArray = [
series,
columns,
rows,
stackedSeries
];
-var names = [
+let names = [
'series',
'columns',
'rows',
@@ -28,8 +28,8 @@ var names = [
dataArray.forEach(function (data, i) {
describe('Vislib Vis Test Suite for ' + names[i] + ' Data', function () {
- var beforeEvent = 'click';
- var afterEvent = 'brush';
+ let beforeEvent = 'click';
+ let afterEvent = 'brush';
let vis;
let persistedState;
let secondVis;
@@ -129,7 +129,7 @@ dataArray.forEach(function (data, i) {
});
describe('on Method', function () {
- var events = [
+ let events = [
beforeEvent,
afterEvent
];
@@ -173,7 +173,7 @@ dataArray.forEach(function (data, i) {
});
it('should cause a listener for each event to be attached to each chart', function () {
- var charts = vis.handler.charts;
+ let charts = vis.handler.charts;
charts.forEach(function (chart, i) {
expect(chart.events.listenerCount(beforeEvent)).to.be.above(0);
@@ -220,7 +220,7 @@ dataArray.forEach(function (data, i) {
});
it('should remove a listener', function () {
- var charts = vis.handler.charts;
+ let charts = vis.handler.charts;
expect(vis.listeners(beforeEvent)).to.not.contain(listener1);
expect(vis.listeners(beforeEvent)).to.contain(listener2);
@@ -236,7 +236,7 @@ dataArray.forEach(function (data, i) {
});
it('should remove the event and all listeners when only event passed an argument', function () {
- var charts = vis.handler.charts;
+ let charts = vis.handler.charts;
vis.off(afterEvent);
// should remove 'brush' event
@@ -251,7 +251,7 @@ dataArray.forEach(function (data, i) {
});
it('should remove the event from the chart when the last listener is removed', function () {
- var charts = vis.handler.charts;
+ let charts = vis.handler.charts;
vis.off(afterEvent, listener2);
expect(vis.listenerCount(afterEvent)).to.be(0);
diff --git a/src/ui/public/vislib/__tests__/visualizations/area_chart.js b/src/ui/public/vislib/__tests__/visualizations/area_chart.js
index 6c8bb24f5b52b..72c125746e223 100644
--- a/src/ui/public/vislib/__tests__/visualizations/area_chart.js
+++ b/src/ui/public/vislib/__tests__/visualizations/area_chart.js
@@ -9,7 +9,7 @@ import notQuiteEnoughVariables from 'fixtures/vislib/mock_data/not_enough_data/_
import $ from 'jquery';
import FixturesVislibVisFixtureProvider from 'fixtures/vislib/_vis_fixture';
import PersistedStatePersistedStateProvider from 'ui/persisted_state/persisted_state';
-var someOtherVariables = {
+let someOtherVariables = {
'series pos': require('fixtures/vislib/mock_data/date_histogram/_series'),
'series pos neg': require('fixtures/vislib/mock_data/date_histogram/_series_pos_neg'),
'series neg': require('fixtures/vislib/mock_data/date_histogram/_series_neg'),
@@ -18,7 +18,7 @@ var someOtherVariables = {
'stackedSeries': require('fixtures/vislib/mock_data/date_histogram/_stacked_series')
};
-var visLibParams = {
+let visLibParams = {
type: 'area',
addLegend: true,
addTooltip: true
@@ -158,12 +158,12 @@ _.forOwn(someOtherVariables, function (variablesAreCool, imaVariable) {
it('should not draw circles where d.y === 0', function () {
vis.handler.charts.forEach(function (chart) {
- var series = chart.chartData.series;
- var isZero = series.some(function (d) {
+ let series = chart.chartData.series;
+ let isZero = series.some(function (d) {
return d.y === 0;
});
- var circles = $.makeArray($(chart.chartEl).find('circle'));
- var isNotDrawn = circles.some(function (d) {
+ let circles = $.makeArray($(chart.chartEl).find('circle'));
+ let isNotDrawn = circles.some(function (d) {
return d.__data__.y === 0;
});
@@ -183,7 +183,7 @@ _.forOwn(someOtherVariables, function (variablesAreCool, imaVariable) {
it('should return a yMin and yMax', function () {
vis.handler.charts.forEach(function (chart) {
- var yAxis = chart.handler.yAxis;
+ let yAxis = chart.handler.yAxis;
expect(yAxis.domain[0]).to.not.be(undefined);
expect(yAxis.domain[1]).to.not.be(undefined);
@@ -192,7 +192,7 @@ _.forOwn(someOtherVariables, function (variablesAreCool, imaVariable) {
it('should render a zero axis line', function () {
vis.handler.charts.forEach(function (chart) {
- var yAxis = chart.handler.yAxis;
+ let yAxis = chart.handler.yAxis;
if (yAxis.yMin < 0 && yAxis.yMax > 0) {
expect($(chart.chartEl).find('line.zero-line').length).to.be(1);
@@ -224,8 +224,8 @@ _.forOwn(someOtherVariables, function (variablesAreCool, imaVariable) {
it('should return yAxis extents equal to data extents', function () {
vis.handler.charts.forEach(function (chart) {
- var yAxis = chart.handler.yAxis;
- var yVals = [vis.handler.data.getYMin(), vis.handler.data.getYMax()];
+ let yAxis = chart.handler.yAxis;
+ let yVals = [vis.handler.data.getYMin(), vis.handler.data.getYMax()];
expect(yAxis.domain[0]).to.equal(yVals[0]);
expect(yAxis.domain[1]).to.equal(yVals[1]);
diff --git a/src/ui/public/vislib/__tests__/visualizations/chart.js b/src/ui/public/vislib/__tests__/visualizations/chart.js
index e2c9601e0d25f..73ce39d9fab29 100644
--- a/src/ui/public/vislib/__tests__/visualizations/chart.js
+++ b/src/ui/public/vislib/__tests__/visualizations/chart.js
@@ -14,12 +14,12 @@ describe('Vislib _chart Test Suite', function () {
let Data;
let persistedState;
let Vis;
- var chartData = {};
+ let chartData = {};
let vis;
let el;
let myChart;
let config;
- var data = {
+ let data = {
hits : 621,
label : '',
ordered : {
diff --git a/src/ui/public/vislib/__tests__/visualizations/column_chart.js b/src/ui/public/vislib/__tests__/visualizations/column_chart.js
index 57ebe0cea8cba..e168d039513b5 100644
--- a/src/ui/public/vislib/__tests__/visualizations/column_chart.js
+++ b/src/ui/public/vislib/__tests__/visualizations/column_chart.js
@@ -10,14 +10,14 @@ import series from 'fixtures/vislib/mock_data/date_histogram/_series';
import seriesPosNeg from 'fixtures/vislib/mock_data/date_histogram/_series_pos_neg';
import seriesNeg from 'fixtures/vislib/mock_data/date_histogram/_series_neg';
import termsColumns from 'fixtures/vislib/mock_data/terms/_columns';
-//var histogramRows = require('fixtures/vislib/mock_data/histogram/_rows');
+//let histogramRows = require('fixtures/vislib/mock_data/histogram/_rows');
import stackedSeries from 'fixtures/vislib/mock_data/date_histogram/_stacked_series';
import $ from 'jquery';
import FixturesVislibVisFixtureProvider from 'fixtures/vislib/_vis_fixture';
import PersistedStatePersistedStateProvider from 'ui/persisted_state/persisted_state';
// tuple, with the format [description, mode, data]
-var dataTypesArray = [
+let dataTypesArray = [
['series', 'stacked', series],
['series with positive and negative values', 'stacked', seriesPosNeg],
['series with negative values', 'stacked', seriesNeg],
@@ -27,14 +27,14 @@ var dataTypesArray = [
];
dataTypesArray.forEach(function (dataType, i) {
- var name = dataType[0];
- var mode = dataType[1];
- var data = dataType[2];
+ let name = dataType[0];
+ let mode = dataType[1];
+ let data = dataType[2];
describe('Vislib Column Chart Test Suite for ' + name + ' Data', function () {
let vis;
let persistedState;
- var visLibParams = {
+ let visLibParams = {
type: 'histogram',
hasTimeField: true,
addLegend: true,
@@ -104,7 +104,7 @@ dataTypesArray.forEach(function (dataType, i) {
describe('addBarEvents method', function () {
function checkChart(chart) {
- var rect = $(chart.chartEl).find('.series rect').get(0);
+ let rect = $(chart.chartEl).find('.series rect').get(0);
// check for existance of stuff and things
return {
@@ -121,23 +121,23 @@ dataTypesArray.forEach(function (dataType, i) {
it('should attach the brush if data is a set of ordered dates', function () {
vis.handler.charts.forEach(function (chart) {
- var has = checkChart(chart);
- var ordered = vis.handler.data.get('ordered');
- var date = Boolean(ordered && ordered.date);
+ let has = checkChart(chart);
+ let ordered = vis.handler.data.get('ordered');
+ let date = Boolean(ordered && ordered.date);
expect(has.brush).to.be(date);
});
});
it('should attach a click event', function () {
vis.handler.charts.forEach(function (chart) {
- var has = checkChart(chart);
+ let has = checkChart(chart);
expect(has.click).to.be(true);
});
});
it('should attach a hover event', function () {
vis.handler.charts.forEach(function (chart) {
- var has = checkChart(chart);
+ let has = checkChart(chart);
expect(has.mouseOver).to.be(true);
});
});
@@ -152,7 +152,7 @@ dataTypesArray.forEach(function (dataType, i) {
it('should return a yMin and yMax', function () {
vis.handler.charts.forEach(function (chart) {
- var yAxis = chart.handler.yAxis;
+ let yAxis = chart.handler.yAxis;
expect(yAxis.domain[0]).to.not.be(undefined);
expect(yAxis.domain[1]).to.not.be(undefined);
@@ -161,7 +161,7 @@ dataTypesArray.forEach(function (dataType, i) {
it('should render a zero axis line', function () {
vis.handler.charts.forEach(function (chart) {
- var yAxis = chart.handler.yAxis;
+ let yAxis = chart.handler.yAxis;
if (yAxis.yMin < 0 && yAxis.yMax > 0) {
expect($(chart.chartEl).find('line.zero-line').length).to.be(1);
@@ -193,9 +193,9 @@ dataTypesArray.forEach(function (dataType, i) {
it('should return yAxis extents equal to data extents', function () {
vis.handler.charts.forEach(function (chart) {
- var yAxis = chart.handler.yAxis;
- var min = vis.handler.data.getYMin();
- var max = vis.handler.data.getYMax();
+ let yAxis = chart.handler.yAxis;
+ let min = vis.handler.data.getYMin();
+ let max = vis.handler.data.getYMax();
expect(yAxis.domain[0]).to.equal(min);
expect(yAxis.domain[1]).to.equal(max);
diff --git a/src/ui/public/vislib/__tests__/visualizations/line_chart.js b/src/ui/public/vislib/__tests__/visualizations/line_chart.js
index 59248dd6390dd..bd4ffcb7b5885 100644
--- a/src/ui/public/vislib/__tests__/visualizations/line_chart.js
+++ b/src/ui/public/vislib/__tests__/visualizations/line_chart.js
@@ -15,7 +15,7 @@ import $ from 'jquery';
import FixturesVislibVisFixtureProvider from 'fixtures/vislib/_vis_fixture';
import PersistedStatePersistedStateProvider from 'ui/persisted_state/persisted_state';
-var dataTypes = [
+let dataTypes = [
['series pos', seriesPos],
['series pos neg', seriesPosNeg],
['series neg', seriesNeg],
@@ -26,8 +26,8 @@ var dataTypes = [
describe('Vislib Line Chart', function () {
dataTypes.forEach(function (type, i) {
- var name = type[0];
- var data = type[1];
+ let name = type[0];
+ let data = type[1];
describe(name + ' Data', function () {
let vis;
@@ -35,7 +35,7 @@ describe('Vislib Line Chart', function () {
beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private) {
- var visLibParams = {
+ let visLibParams = {
type: 'line',
addLegend: true,
addTooltip: true,
@@ -133,7 +133,7 @@ describe('Vislib Line Chart', function () {
it('should return a yMin and yMax', function () {
vis.handler.charts.forEach(function (chart) {
- var yAxis = chart.handler.yAxis;
+ let yAxis = chart.handler.yAxis;
expect(yAxis.domain[0]).to.not.be(undefined);
expect(yAxis.domain[1]).to.not.be(undefined);
@@ -142,7 +142,7 @@ describe('Vislib Line Chart', function () {
it('should render a zero axis line', function () {
vis.handler.charts.forEach(function (chart) {
- var yAxis = chart.handler.yAxis;
+ let yAxis = chart.handler.yAxis;
if (yAxis.yMin < 0 && yAxis.yMax > 0) {
expect($(chart.chartEl).find('line.zero-line').length).to.be(1);
@@ -174,8 +174,8 @@ describe('Vislib Line Chart', function () {
it('should return yAxis extents equal to data extents', function () {
vis.handler.charts.forEach(function (chart) {
- var yAxis = chart.handler.yAxis;
- var yVals = [vis.handler.data.getYMin(), vis.handler.data.getYMax()];
+ let yAxis = chart.handler.yAxis;
+ let yVals = [vis.handler.data.getYMin(), vis.handler.data.getYMax()];
expect(yAxis.domain[0]).to.equal(yVals[0]);
expect(yAxis.domain[1]).to.equal(yVals[1]);
diff --git a/src/ui/public/vislib/__tests__/visualizations/pie_chart.js b/src/ui/public/vislib/__tests__/visualizations/pie_chart.js
index 741b3ec6260bd..26edaecadc6fa 100644
--- a/src/ui/public/vislib/__tests__/visualizations/pie_chart.js
+++ b/src/ui/public/vislib/__tests__/visualizations/pie_chart.js
@@ -11,39 +11,39 @@ import PersistedStatePersistedStateProvider from 'ui/persisted_state/persisted_s
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import AggResponseHierarchicalBuildHierarchicalDataProvider from 'ui/agg_response/hierarchical/build_hierarchical_data';
-var rowAgg = [
+let rowAgg = [
{ type: 'avg', schema: 'metric', params: { field: 'bytes' } },
{ type: 'terms', schema: 'split', params: { field: 'extension', rows: true }},
{ type: 'terms', schema: 'segment', params: { field: 'machine.os' }},
{ type: 'terms', schema: 'segment', params: { field: 'geo.src' }}
];
-var colAgg = [
+let colAgg = [
{ type: 'avg', schema: 'metric', params: { field: 'bytes' } },
{ type: 'terms', schema: 'split', params: { field: 'extension', row: false }},
{ type: 'terms', schema: 'segment', params: { field: 'machine.os' }},
{ type: 'terms', schema: 'segment', params: { field: 'geo.src' }}
];
-var sliceAgg = [
+let sliceAgg = [
{ type: 'avg', schema: 'metric', params: { field: 'bytes' } },
{ type: 'terms', schema: 'segment', params: { field: 'machine.os' }},
{ type: 'terms', schema: 'segment', params: { field: 'geo.src' }}
];
-var aggArray = [
+let aggArray = [
rowAgg,
colAgg,
sliceAgg
];
-var names = [
+let names = [
'rows',
'columns',
'slices'
];
-var sizes = [
+let sizes = [
0,
5,
15,
@@ -53,13 +53,13 @@ var sizes = [
];
describe('No global chart settings', function () {
- var visLibParams1 = {
+ let visLibParams1 = {
el: '
',
type: 'pie',
addLegend: true,
addTooltip: true
};
- var visLibParams2 = {
+ let visLibParams2 = {
el: '
',
type: 'pie',
addLegend: true,
@@ -83,13 +83,13 @@ describe('No global chart settings', function () {
indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider);
buildHierarchicalData = Private(AggResponseHierarchicalBuildHierarchicalDataProvider);
- var id1 = 1;
- var id2 = 1;
- var stubVis1 = new Vis(indexPattern, {
+ let id1 = 1;
+ let id2 = 1;
+ let stubVis1 = new Vis(indexPattern, {
type: 'pie',
aggs: rowAgg
});
- var stubVis2 = new Vis(indexPattern, {
+ let stubVis2 = new Vis(indexPattern, {
type: 'pie',
aggs: colAgg
});
@@ -120,19 +120,19 @@ describe('No global chart settings', function () {
});
describe('_validatePieData method', function () {
- var allZeros = [
+ let allZeros = [
{ slices: { children: [] } },
{ slices: { children: [] } },
{ slices: { children: [] } }
];
- var someZeros = [
+ let someZeros = [
{ slices: { children: [{}] } },
{ slices: { children: [{}] } },
{ slices: { children: [] } }
];
- var noZeros = [
+ let noZeros = [
{ slices: { children: [{}] } },
{ slices: { children: [{}] } },
{ slices: { children: [{}] } }
@@ -157,7 +157,7 @@ describe('No global chart settings', function () {
aggArray.forEach(function (dataAgg, i) {
describe('Vislib PieChart Class Test Suite for ' + names[i] + ' data', function () {
- var visLibParams = {
+ let visLibParams = {
type: 'pie',
addLegend: true,
addTooltip: true
@@ -177,8 +177,8 @@ aggArray.forEach(function (dataAgg, i) {
indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider);
buildHierarchicalData = Private(AggResponseHierarchicalBuildHierarchicalDataProvider);
- var id = 1;
- var stubVis = new Vis(indexPattern, {
+ let id = 1;
+ let stubVis = new Vis(indexPattern, {
type: 'pie',
aggs: dataAgg
});
diff --git a/src/ui/public/vislib/__tests__/visualizations/tile_maps/map.js b/src/ui/public/vislib/__tests__/visualizations/tile_maps/map.js
index cbad9bfc54c59..b74f779c1510b 100644
--- a/src/ui/public/vislib/__tests__/visualizations/tile_maps/map.js
+++ b/src/ui/public/vislib/__tests__/visualizations/tile_maps/map.js
@@ -10,14 +10,14 @@ import $ from 'jquery';
import VislibVisualizationsMapProvider from 'ui/vislib/visualizations/_map';
// // Data
-// var dataArray = [
+// let dataArray = [
// ['geojson', require('fixtures/vislib/mock_data/geohash/_geo_json')],
// ['columns', require('fixtures/vislib/mock_data/geohash/_columns')],
// ['rows', require('fixtures/vislib/mock_data/geohash/_rows')],
// ];
// // TODO: Test the specific behavior of each these
-// var mapTypes = [
+// let mapTypes = [
// 'Scaled Circle Markers',
// 'Shaded Circle Markers',
// 'Shaded Geohash Grid',
@@ -25,10 +25,10 @@ import VislibVisualizationsMapProvider from 'ui/vislib/visualizations/_map';
// ];
describe('TileMap Map Tests', function () {
- var $mockMapEl = $('
');
+ let $mockMapEl = $('
');
let TileMapMap;
- var leafletStubs = {};
- var leafletMocks = {};
+ let leafletStubs = {};
+ let leafletMocks = {};
beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private) {
@@ -57,7 +57,7 @@ describe('TileMap Map Tests', function () {
});
it('should add zoom controls', function () {
- var mapOptions = createStub.firstCall.args[0];
+ let mapOptions = createStub.firstCall.args[0];
expect(mapOptions).to.be.an('object');
if (mapOptions.zoomControl) expect(mapOptions.zoomControl).to.be.ok();
@@ -82,8 +82,8 @@ describe('TileMap Map Tests', function () {
expect(leafletStubs.tileLayer.callCount).to.equal(1);
expect(leafletStubs.map.callCount).to.equal(1);
- var callArgs = leafletStubs.map.firstCall.args;
- var mapOptions = callArgs[1];
+ let callArgs = leafletStubs.map.firstCall.args;
+ let mapOptions = callArgs[1];
expect(callArgs[0]).to.be($mockMapEl.get(0));
expect(mapOptions).to.have.property('zoom');
expect(mapOptions).to.have.property('center');
@@ -122,21 +122,21 @@ describe('TileMap Map Tests', function () {
});
it('should attach interaction events', function () {
- var expectedTileEvents = ['tileload'];
- var expectedMapEvents = ['draw:created', 'moveend', 'zoomend', 'unload'];
- var matchedEvents = {
+ let expectedTileEvents = ['tileload'];
+ let expectedMapEvents = ['draw:created', 'moveend', 'zoomend', 'unload'];
+ let matchedEvents = {
tiles: 0,
maps: 0,
};
_.times(leafletMocks.tileLayer.on.callCount, function (index) {
- var ev = leafletMocks.tileLayer.on.getCall(index).args[0];
+ let ev = leafletMocks.tileLayer.on.getCall(index).args[0];
if (_.includes(expectedTileEvents, ev)) matchedEvents.tiles++;
});
expect(matchedEvents.tiles).to.equal(expectedTileEvents.length);
_.times(leafletMocks.map.on.callCount, function (index) {
- var ev = leafletMocks.map.on.getCall(index).args[0];
+ let ev = leafletMocks.map.on.getCall(index).args[0];
if (_.includes(expectedMapEvents, ev)) matchedEvents.maps++;
});
expect(matchedEvents.maps).to.equal(expectedMapEvents.length);
@@ -157,14 +157,14 @@ describe('TileMap Map Tests', function () {
it('should pass the map options to the marker', function () {
map._addMarkers();
- var args = createStub.firstCall.args[0];
+ let args = createStub.firstCall.args[0];
expect(args).to.have.property('tooltipFormatter');
expect(args).to.have.property('valueFormatter');
expect(args).to.have.property('attr');
});
it('should destroy existing markers', function () {
- var destroyStub = sinon.stub();
+ let destroyStub = sinon.stub();
map._markers = { destroy: destroyStub };
map._addMarkers();
@@ -182,20 +182,20 @@ describe('TileMap Map Tests', function () {
it('should return an empty array if no data', function () {
map = new TileMapMap($mockMapEl, {}, {});
- var rects = map._getDataRectangles();
+ let rects = map._getDataRectangles();
expect(rects).to.have.length(0);
});
it('should return an array of arrays of rectangles', function () {
- var rects = map._getDataRectangles();
+ let rects = map._getDataRectangles();
_.times(5, function () {
- var index = _.random(rects.length - 1);
- var rect = rects[index];
- var featureRect = geoJsonData.geoJson.features[index].properties.rectangle;
+ let index = _.random(rects.length - 1);
+ let rect = rects[index];
+ let featureRect = geoJsonData.geoJson.features[index].properties.rectangle;
expect(rect.length).to.equal(featureRect.length);
// should swap the array
- var checkIndex = _.random(rect.length - 1);
+ let checkIndex = _.random(rect.length - 1);
expect(rect[checkIndex]).to.eql(featureRect[checkIndex]);
});
});
diff --git a/src/ui/public/vislib/__tests__/visualizations/tile_maps/markers.js b/src/ui/public/vislib/__tests__/visualizations/tile_maps/markers.js
index 5e9c7b5609b29..04ed6fdbea14d 100644
--- a/src/ui/public/vislib/__tests__/visualizations/tile_maps/markers.js
+++ b/src/ui/public/vislib/__tests__/visualizations/tile_maps/markers.js
@@ -12,9 +12,9 @@ import VislibVisualizationsMarkerTypesShadedCirclesProvider from 'ui/vislib/visu
import VislibVisualizationsMarkerTypesScaledCirclesProvider from 'ui/vislib/visualizations/marker_types/scaled_circles';
import VislibVisualizationsMarkerTypesHeatmapProvider from 'ui/vislib/visualizations/marker_types/heatmap';
// defaults to roughly the lower 48 US states
-var defaultSWCoords = [13.496, -143.789];
-var defaultNECoords = [55.526, -57.919];
-var bounds = {};
+let defaultSWCoords = [13.496, -143.789];
+let defaultNECoords = [55.526, -57.919];
+let bounds = {};
let MarkerType;
let map;
@@ -29,7 +29,7 @@ function getBounds() {
return L.latLngBounds(bounds.southWest, bounds.northEast);
}
-var mockMap = {
+let mockMap = {
addLayer: _.noop,
closePopup: _.noop,
getBounds: getBounds,
@@ -76,8 +76,8 @@ describe('Marker Tests', function () {
it('should not filter any features', function () {
// set bounds to the entire world
setBounds([-87.252, -343.828], [87.252, 343.125]);
- var boundFilter = markerLayer._filterToMapBounds();
- var mapFeature = mapData.features.filter(boundFilter);
+ let boundFilter = markerLayer._filterToMapBounds();
+ let mapFeature = mapData.features.filter(boundFilter);
expect(mapFeature.length).to.equal(mapData.features.length);
});
@@ -85,8 +85,8 @@ describe('Marker Tests', function () {
it('should filter out data points that are outside of the map bounds', function () {
// set bounds to roughly US southwest
setBounds([31.690, -124.387], [42.324, -102.919]);
- var boundFilter = markerLayer._filterToMapBounds();
- var mapFeature = mapData.features.filter(boundFilter);
+ let boundFilter = markerLayer._filterToMapBounds();
+ let mapFeature = mapData.features.filter(boundFilter);
expect(mapFeature.length).to.be.lessThan(mapData.features.length);
});
@@ -94,8 +94,8 @@ describe('Marker Tests', function () {
describe('legendQuantizer', function () {
it('should return a range of hex colors', function () {
- var minColor = markerLayer._legendQuantizer(mapData.properties.allmin);
- var maxColor = markerLayer._legendQuantizer(mapData.properties.allmax);
+ let minColor = markerLayer._legendQuantizer(mapData.properties.allmin);
+ let maxColor = markerLayer._legendQuantizer(mapData.properties.allmax);
expect(minColor.substring(0, 1)).to.equal('#');
expect(minColor).to.have.length(7);
@@ -105,18 +105,18 @@ describe('Marker Tests', function () {
});
it('should return a color with 1 color', function () {
- var geoJson = { properties: { min: 1, max: 1 } };
+ let geoJson = { properties: { min: 1, max: 1 } };
markerLayer = createMarker(MarkerClass, geoJson);
// ensure the quantizer domain is correct
- var color = markerLayer._legendQuantizer(1);
+ let color = markerLayer._legendQuantizer(1);
expect(color).to.not.be(undefined);
expect(color.substring(0, 1)).to.equal('#');
// should always get the same color back
_.times(5, function () {
- var num = _.random(0, 100);
- var randColor = markerLayer._legendQuantizer(0);
+ let num = _.random(0, 100);
+ let randColor = markerLayer._legendQuantizer(0);
expect(randColor).to.equal(color);
});
});
@@ -124,19 +124,19 @@ describe('Marker Tests', function () {
describe('applyShadingStyle', function () {
it('should return a style object', function () {
- var style = markerLayer.applyShadingStyle(100);
+ let style = markerLayer.applyShadingStyle(100);
expect(style).to.be.an('object');
- var keys = _.keys(style);
- var expected = ['fillColor', 'color'];
+ let keys = _.keys(style);
+ let expected = ['fillColor', 'color'];
_.each(expected, function (key) {
expect(keys).to.contain(key);
});
});
it('should use the legendQuantizer', function () {
- var spy = sinon.spy(markerLayer, '_legendQuantizer');
- var style = markerLayer.applyShadingStyle(100);
+ let spy = sinon.spy(markerLayer, '_legendQuantizer');
+ let style = markerLayer.applyShadingStyle(100);
expect(spy.callCount).to.equal(1);
});
});
@@ -144,9 +144,9 @@ describe('Marker Tests', function () {
describe('showTooltip', function () {
it('should use the tooltip formatter', function () {
let content;
- var sample = _.sample(mapData.features);
+ let sample = _.sample(mapData.features);
- var stub = sinon.stub(markerLayer, '_tooltipFormatter', function (val) {
+ let stub = sinon.stub(markerLayer, '_tooltipFormatter', function (val) {
return;
});
@@ -186,12 +186,12 @@ describe('Marker Tests', function () {
});
it('should use the value formatter', function () {
- var formatterSpy = sinon.spy(markerLayer, '_valueFormatter');
+ let formatterSpy = sinon.spy(markerLayer, '_valueFormatter');
// called twice for every legend color defined
- var expectedCallCount = markerLayer._legendColors.length * 2;
+ let expectedCallCount = markerLayer._legendColors.length * 2;
markerLayer.addLegend();
- var legend = markerLayer._legend.onAdd();
+ let legend = markerLayer._legend.onAdd();
expect(formatterSpy.callCount).to.equal(expectedCallCount);
expect(legend).to.be.a(HTMLDivElement);
@@ -202,14 +202,14 @@ describe('Marker Tests', function () {
describe('Shaded Circles', function () {
beforeEach(ngMock.module('MarkerFactory'));
beforeEach(ngMock.inject(function (Private) {
- var MarkerClass = Private(VislibVisualizationsMarkerTypesShadedCirclesProvider);
+ let MarkerClass = Private(VislibVisualizationsMarkerTypesShadedCirclesProvider);
markerLayer = createMarker(MarkerClass);
}));
describe('geohashMinDistance method', function () {
it('should return a finite number', function () {
- var sample = _.sample(mapData.features);
- var distance = markerLayer._geohashMinDistance(sample);
+ let sample = _.sample(mapData.features);
+ let distance = markerLayer._geohashMinDistance(sample);
expect(distance).to.be.a('number');
expect(_.isFinite(distance)).to.be(true);
@@ -224,34 +224,34 @@ describe('Marker Tests', function () {
beforeEach(ngMock.inject(function (Private) {
zoom = _.random(1, 18);
sinon.stub(mockMap, 'getZoom', _.constant(zoom));
- var MarkerClass = Private(VislibVisualizationsMarkerTypesScaledCirclesProvider);
+ let MarkerClass = Private(VislibVisualizationsMarkerTypesScaledCirclesProvider);
markerLayer = createMarker(MarkerClass);
}));
describe('radiusScale method', function () {
- var valueArray = [10, 20, 30, 40, 50, 60];
- var max = _.max(valueArray);
- var prev = -1;
+ let valueArray = [10, 20, 30, 40, 50, 60];
+ let max = _.max(valueArray);
+ let prev = -1;
it('should return 0 for value of 0', function () {
expect(markerLayer._radiusScale(0)).to.equal(0);
});
it('should return a scaled value for negative and positive numbers', function () {
- var upperBound = markerLayer._radiusScale(max);
- var results = [];
+ let upperBound = markerLayer._radiusScale(max);
+ let results = [];
function roundValue(value) {
// round number to 6 decimal places
- var r = Math.pow(10, 6);
+ let r = Math.pow(10, 6);
return Math.round(value * r) / r;
}
_.each(valueArray, function (value, i) {
- var ratio = Math.pow(value / max, 0.5);
- var comparison = ratio * upperBound;
- var radius = markerLayer._radiusScale(value);
- var negRadius = markerLayer._radiusScale(value * -1);
+ let ratio = Math.pow(value / max, 0.5);
+ let comparison = ratio * upperBound;
+ let radius = markerLayer._radiusScale(value);
+ let negRadius = markerLayer._radiusScale(value * -1);
results.push(radius);
expect(negRadius).to.equal(radius);
@@ -269,7 +269,7 @@ describe('Marker Tests', function () {
describe('Heatmaps', function () {
beforeEach(ngMock.module('MarkerFactory'));
beforeEach(ngMock.inject(function (Private) {
- var MarkerClass = Private(VislibVisualizationsMarkerTypesHeatmapProvider);
+ let MarkerClass = Private(VislibVisualizationsMarkerTypesHeatmapProvider);
markerLayer = createMarker(MarkerClass);
}));
@@ -281,7 +281,7 @@ describe('Marker Tests', function () {
});
it('should return an array or values for each feature', function () {
- var arr = markerLayer._dataToHeatArray(max);
+ let arr = markerLayer._dataToHeatArray(max);
expect(arr).to.be.an('array');
expect(arr).to.have.length(mapData.features.length);
@@ -289,11 +289,11 @@ describe('Marker Tests', function () {
it('should return an array item with lat, lng, metric for each feature', function () {
_.times(3, function () {
- var arr = markerLayer._dataToHeatArray(max);
- var index = _.random(mapData.features.length - 1);
- var feature = mapData.features[index];
- var featureValue = feature.properties.value;
- var featureArr = feature.geometry.coordinates.slice(0).concat(featureValue);
+ let arr = markerLayer._dataToHeatArray(max);
+ let index = _.random(mapData.features.length - 1);
+ let feature = mapData.features[index];
+ let featureValue = feature.properties.value;
+ let featureArr = feature.geometry.coordinates.slice(0).concat(featureValue);
expect(arr[index]).to.eql(featureArr);
});
});
@@ -302,11 +302,11 @@ describe('Marker Tests', function () {
_.times(5, function () {
markerLayer._attr.heatNormalizeData = true;
- var arr = markerLayer._dataToHeatArray(max);
- var index = _.random(mapData.features.length - 1);
- var feature = mapData.features[index];
- var featureValue = feature.properties.value / max;
- var featureArr = feature.geometry.coordinates.slice(0).concat(featureValue);
+ let arr = markerLayer._dataToHeatArray(max);
+ let index = _.random(mapData.features.length - 1);
+ let feature = mapData.features[index];
+ let featureValue = feature.properties.value / max;
+ let featureArr = feature.geometry.coordinates.slice(0).concat(featureValue);
expect(arr[index]).to.eql(featureArr);
});
});
@@ -315,18 +315,18 @@ describe('Marker Tests', function () {
describe('tooltipProximity', function () {
it('should return true if feature is close enough to event latlng', function () {
_.times(5, function () {
- var feature = _.sample(mapData.features);
- var point = markerLayer._getLatLng(feature);
- var arr = markerLayer._tooltipProximity(point, feature);
+ let feature = _.sample(mapData.features);
+ let point = markerLayer._getLatLng(feature);
+ let arr = markerLayer._tooltipProximity(point, feature);
expect(arr).to.be(true);
});
});
it('should return false if feature is not close enough to event latlng', function () {
_.times(5, function () {
- var feature = _.sample(mapData.features);
- var point = L.latLng(90, -180);
- var arr = markerLayer._tooltipProximity(point, feature);
+ let feature = _.sample(mapData.features);
+ let point = L.latLng(90, -180);
+ let arr = markerLayer._tooltipProximity(point, feature);
expect(arr).to.be(false);
});
});
@@ -335,9 +335,9 @@ describe('Marker Tests', function () {
describe('nearestFeature', function () {
it('should return nearest geoJson feature object', function () {
_.times(5, function () {
- var feature = _.sample(mapData.features);
- var point = markerLayer._getLatLng(feature);
- var nearestPoint = markerLayer._nearestFeature(point);
+ let feature = _.sample(mapData.features);
+ let point = markerLayer._getLatLng(feature);
+ let nearestPoint = markerLayer._nearestFeature(point);
expect(nearestPoint).to.equal(feature);
});
});
@@ -345,15 +345,15 @@ describe('Marker Tests', function () {
describe('getLatLng', function () {
it('should return a leaflet latLng object', function () {
- var feature = _.sample(mapData.features);
- var latLng = markerLayer._getLatLng(feature);
- var compare = L.latLng(feature.geometry.coordinates.slice(0).reverse());
+ let feature = _.sample(mapData.features);
+ let latLng = markerLayer._getLatLng(feature);
+ let compare = L.latLng(feature.geometry.coordinates.slice(0).reverse());
expect(latLng).to.eql(compare);
});
it('should memoize the result', function () {
- var spy = sinon.spy(L, 'latLng');
- var feature = _.sample(mapData.features);
+ let spy = sinon.spy(L, 'latLng');
+ let feature = _.sample(mapData.features);
markerLayer._getLatLng(feature);
expect(spy.callCount).to.be(1);
diff --git a/src/ui/public/vislib/__tests__/visualizations/tile_maps/tile_map.js b/src/ui/public/vislib/__tests__/visualizations/tile_maps/tile_map.js
index 6f75ac8e05f5a..d1f4c3235fd08 100644
--- a/src/ui/public/vislib/__tests__/visualizations/tile_maps/tile_map.js
+++ b/src/ui/public/vislib/__tests__/visualizations/tile_maps/tile_map.js
@@ -8,7 +8,7 @@ import geoJsonData from 'fixtures/vislib/mock_data/geohash/_geo_json';
import MockMap from 'fixtures/tilemap_map';
import $ from 'jquery';
import VislibVisualizationsTileMapProvider from 'ui/vislib/visualizations/tile_map';
-var mockChartEl = $('
');
+let mockChartEl = $('
');
let TileMap;
let extentsStub;
@@ -18,7 +18,7 @@ function createTileMap(handler, chartEl, chartData) {
chartEl = chartEl || mockChartEl;
chartData = chartData || geoJsonData;
- var tilemap = new TileMap(handler, chartEl, chartData);
+ let tilemap = new TileMap(handler, chartEl, chartData);
return tilemap;
}
@@ -52,7 +52,7 @@ describe('TileMap Tests', function () {
});
it('should call destroy for clean state', function () {
- var destroySpy = sinon.spy(tilemap, 'destroy');
+ let destroySpy = sinon.spy(tilemap, 'destroy');
tilemap.draw();
expect(destroySpy.callCount).to.equal(1);
});
@@ -73,14 +73,14 @@ describe('TileMap Tests', function () {
it('should append maps and required controls', function () {
expect(tilemap.maps).to.have.length(1);
- var map = tilemap.maps[0];
+ let map = tilemap.maps[0];
expect(map.addTitle.callCount).to.equal(0);
expect(map.addFitControl.callCount).to.equal(1);
expect(map.addBoundingControl.callCount).to.equal(1);
});
it('should only add controls if data exists', function () {
- var noData = {
+ let noData = {
geoJson: {
features: [],
properties: {},
@@ -92,17 +92,17 @@ describe('TileMap Tests', function () {
tilemap._appendMap($selection);
expect(tilemap.maps).to.have.length(1);
- var map = tilemap.maps[0];
+ let map = tilemap.maps[0];
expect(map.addTitle.callCount).to.equal(0);
expect(map.addFitControl.callCount).to.equal(0);
expect(map.addBoundingControl.callCount).to.equal(0);
});
it('should append title if set in the data object', function () {
- var mapTitle = 'Test Title';
+ let mapTitle = 'Test Title';
tilemap = createTileMap(null, null, _.assign({ title: mapTitle }, geoJsonData));
tilemap._appendMap($selection);
- var map = tilemap.maps[0];
+ let map = tilemap.maps[0];
expect(map.addTitle.callCount).to.equal(1);
expect(map.addTitle.firstCall.calledWith(mapTitle)).to.equal(true);
@@ -110,8 +110,8 @@ describe('TileMap Tests', function () {
});
describe('destroy', function () {
- var maps = [];
- var mapCount = 5;
+ let maps = [];
+ let mapCount = 5;
beforeEach(function () {
_.times(mapCount, function () {
diff --git a/src/ui/public/vislib/__tests__/visualizations/time_marker.js b/src/ui/public/vislib/__tests__/visualizations/time_marker.js
index 08fe6475b1ded..4f13b37dfbadd 100644
--- a/src/ui/public/vislib/__tests__/visualizations/time_marker.js
+++ b/src/ui/public/vislib/__tests__/visualizations/time_marker.js
@@ -10,13 +10,13 @@ import $ from 'jquery';
import VislibVisualizationsTimeMarkerProvider from 'ui/vislib/visualizations/time_marker';
describe('Vislib Time Marker Test Suite', function () {
- var height = 50;
- var color = '#ff0000';
- var opacity = 0.5;
- var width = 3;
- var customClass = 'custom-time-marker';
- var dateMathTimes = ['now-1m', 'now-5m', 'now-15m'];
- var myTimes = dateMathTimes.map(function (dateMathString) {
+ let height = 50;
+ let color = '#ff0000';
+ let opacity = 0.5;
+ let width = 3;
+ let customClass = 'custom-time-marker';
+ let dateMathTimes = ['now-1m', 'now-5m', 'now-15m'];
+ let myTimes = dateMathTimes.map(function (dateMathString) {
return {
time: dateMathString,
class: customClass,
@@ -25,14 +25,14 @@ describe('Vislib Time Marker Test Suite', function () {
width: width
};
});
- var getExtent = function (dataArray, func) {
+ let getExtent = function (dataArray, func) {
return func(dataArray, function (obj) {
return func(obj.values, function (d) {
return d.x;
});
});
};
- var times = [];
+ let times = [];
let TimeMarker;
let defaultMarker;
let customMarker;
diff --git a/src/ui/public/vislib/components/tooltip/__tests__/positioning.js b/src/ui/public/vislib/components/tooltip/__tests__/positioning.js
index cce03b6df453c..9edb8b45415d8 100644
--- a/src/ui/public/vislib/components/tooltip/__tests__/positioning.js
+++ b/src/ui/public/vislib/components/tooltip/__tests__/positioning.js
@@ -6,17 +6,17 @@ import posTT from '../position_tooltip';
describe('Tooltip Positioning', function () {
- var positions = ['north', 'south', 'east', 'west'];
- var bounds = ['top', 'left', 'bottom', 'right'];
+ let positions = ['north', 'south', 'east', 'west'];
+ let bounds = ['top', 'left', 'bottom', 'right'];
let $window;
let $chart;
let $tooltip;
let $sizer;
function testEl(width, height, $children) {
- var $el = $('
');
+ let $el = $('
');
- var size = {
+ let size = {
width: _.random(width[0], width[1]),
height: _.random(height[0], height[1])
};
@@ -57,7 +57,7 @@ describe('Tooltip Positioning', function () {
xPercent = xPercent || 0.5;
yPercent = yPercent || 0.5;
- var base = $chart.offset();
+ let base = $chart.offset();
return {
clientX: base.left + ($chart.testSize.width * xPercent),
@@ -67,14 +67,14 @@ describe('Tooltip Positioning', function () {
describe('getTtSize()', function () {
it('should measure the outer-size of the tooltip using an un-obstructed clone', function () {
- var w = sinon.spy($.fn, 'outerWidth');
- var h = sinon.spy($.fn, 'outerHeight');
+ let w = sinon.spy($.fn, 'outerWidth');
+ let h = sinon.spy($.fn, 'outerHeight');
posTT.getTtSize($tooltip.html(), $sizer);
[w, h].forEach(function (spy) {
expect(spy).to.have.property('callCount', 1);
- var matchHtml = w.thisValues.filter(function ($t) {
+ let matchHtml = w.thisValues.filter(function ($t) {
return !$t.is($tooltip) && $t.html() === $tooltip.html();
});
expect(matchHtml).to.have.length(1);
@@ -84,8 +84,8 @@ describe('Tooltip Positioning', function () {
describe('getBasePosition()', function () {
it('calculates the offset values for the four positions', function () {
- var size = posTT.getTtSize($tooltip.html(), $sizer);
- var pos = posTT.getBasePosition(size, makeEvent());
+ let size = posTT.getTtSize($tooltip.html(), $sizer);
+ let pos = posTT.getBasePosition(size, makeEvent());
positions.forEach(function (p) {
expect(pos).to.have.property(p);
@@ -98,7 +98,7 @@ describe('Tooltip Positioning', function () {
describe('getBounds()', function () {
it('returns the offsets for the tlrb of the element', function () {
- var cbounds = posTT.getBounds($chart);
+ let cbounds = posTT.getBounds($chart);
bounds.forEach(function (b) {
expect(cbounds).to.have.property(b);
@@ -114,14 +114,14 @@ describe('Tooltip Positioning', function () {
// size the tooltip very small so it won't collide with the edges
$tooltip.css({ width: 15, height: 15 });
$sizer.css({ width: 15, height: 15 });
- var size = posTT.getTtSize($tooltip.html(), $sizer);
+ let size = posTT.getTtSize($tooltip.html(), $sizer);
expect(size).to.have.property('width', 15);
expect(size).to.have.property('height', 15);
// position the element based on a mouse that is in the middle of the chart
- var pos = posTT.getBasePosition(size, makeEvent(0.5, 0.5));
+ let pos = posTT.getBasePosition(size, makeEvent(0.5, 0.5));
- var overflow = posTT.getOverflow(size, pos, [$chart, $window]);
+ let overflow = posTT.getOverflow(size, pos, [$chart, $window]);
positions.forEach(function (p) {
expect(overflow).to.have.property(p);
@@ -131,11 +131,11 @@ describe('Tooltip Positioning', function () {
});
it('identifies an overflow with a positive value in that direction', function () {
- var size = posTT.getTtSize($tooltip.html(), $sizer);
+ let size = posTT.getTtSize($tooltip.html(), $sizer);
// position the element based on a mouse that is in the bottom right hand courner of the chart
- var pos = posTT.getBasePosition(size, makeEvent(0.99, 0.99));
- var overflow = posTT.getOverflow(size, pos, [$chart, $window]);
+ let pos = posTT.getBasePosition(size, makeEvent(0.99, 0.99));
+ let overflow = posTT.getOverflow(size, pos, [$chart, $window]);
positions.forEach(function (p) {
expect(overflow).to.have.property(p);
@@ -157,9 +157,9 @@ describe('Tooltip Positioning', function () {
});
function check(xPercent, yPercent/*, prev, directions... */) {
- var directions = _.drop(arguments, 2);
- var event = makeEvent(xPercent, yPercent);
- var placement = posTT({
+ let directions = _.drop(arguments, 2);
+ let event = makeEvent(xPercent, yPercent);
+ let placement = posTT({
$window: $window,
$chart: $chart,
$sizer: $sizer,
@@ -214,12 +214,12 @@ describe('Tooltip Positioning', function () {
describe('maintain the direction of the tooltip on reposition', function () {
it('mouse moves from the top right to the middle', function () {
- var pos = check(0.99, 0.10, 'bottom', 'left');
+ let pos = check(0.99, 0.10, 'bottom', 'left');
check(0.50, 0.50, pos, 'bottom', 'left');
});
it('mouse moves from the bottom left to the middle', function () {
- var pos = check(0.10, 0.99, 'top', 'right');
+ let pos = check(0.10, 0.99, 'top', 'right');
check(0.50, 0.50, pos, 'top', 'right');
});
});
diff --git a/src/ui/public/vislib_vis_type/__tests__/_build_chart_data.js b/src/ui/public/vislib_vis_type/__tests__/_build_chart_data.js
index 2df792b2da08d..44628c2b39de5 100644
--- a/src/ui/public/vislib_vis_type/__tests__/_build_chart_data.js
+++ b/src/ui/public/vislib_vis_type/__tests__/_build_chart_data.js
@@ -23,14 +23,14 @@ describe('renderbot#buildChartData', function () {
describe('for hierarchical vis', function () {
it('defers to hierarchical aggResponse converter', function () {
- var football = {};
- var renderbot = {
+ let football = {};
+ let renderbot = {
vis: {
isHierarchical: _.constant(true)
}
};
- var stub = sinon.stub(aggResponse, 'hierarchical').returns(football);
+ let stub = sinon.stub(aggResponse, 'hierarchical').returns(football);
expect(buildChartData.call(renderbot, football)).to.be(football);
expect(stub).to.have.property('callCount', 1);
expect(stub.firstCall.args[0]).to.be(renderbot.vis);
@@ -40,14 +40,14 @@ describe('renderbot#buildChartData', function () {
describe('for point plot', function () {
it('calls tabify to simplify the data into a table', function () {
- var renderbot = {
+ let renderbot = {
vis: {
isHierarchical: _.constant(false)
}
};
- var football = { tables: [], hits: { total: 1 } };
+ let football = { tables: [], hits: { total: 1 } };
- var stub = sinon.stub(aggResponse, 'tabify').returns(football);
+ let stub = sinon.stub(aggResponse, 'tabify').returns(football);
expect(buildChartData.call(renderbot, football)).to.eql({ rows: [], hits: 1 });
expect(stub).to.have.property('callCount', 1);
expect(stub.firstCall.args[0]).to.be(renderbot.vis);
@@ -55,8 +55,8 @@ describe('renderbot#buildChartData', function () {
});
it('returns a single chart if the tabify response contains only a single table', function () {
- var chart = { hits: 1, rows: [], columns: [] };
- var renderbot = {
+ let chart = { hits: 1, rows: [], columns: [] };
+ let renderbot = {
vis: {
isHierarchical: _.constant(false),
type: {
@@ -64,20 +64,20 @@ describe('renderbot#buildChartData', function () {
}
}
};
- var esResp = { hits: { total: 1 } };
- var tabbed = { tables: [ new Table() ] };
+ let esResp = { hits: { total: 1 } };
+ let tabbed = { tables: [ new Table() ] };
sinon.stub(aggResponse, 'tabify').returns(tabbed);
expect(buildChartData.call(renderbot, esResp)).to.eql(chart);
});
it('converts table groups into rows/columns wrappers for charts', function () {
- var chart = { hits: 1, rows: [], columns: [] };
- var converter = sinon.stub().returns('chart');
- var esResp = { hits: { total: 1 } };
- var tables = [new Table(), new Table(), new Table(), new Table()];
+ let chart = { hits: 1, rows: [], columns: [] };
+ let converter = sinon.stub().returns('chart');
+ let esResp = { hits: { total: 1 } };
+ let tables = [new Table(), new Table(), new Table(), new Table()];
- var renderbot = {
+ let renderbot = {
vis: {
isHierarchical: _.constant(false),
type: {
@@ -86,7 +86,7 @@ describe('renderbot#buildChartData', function () {
}
};
- var tabify = sinon.stub(aggResponse, 'tabify').returns({
+ let tabify = sinon.stub(aggResponse, 'tabify').returns({
tables: [
{
aggConfig: { params: { row: true } },
@@ -117,7 +117,7 @@ describe('renderbot#buildChartData', function () {
]
});
- var chartData = buildChartData.call(renderbot, esResp);
+ let chartData = buildChartData.call(renderbot, esResp);
// verify tables were converted
expect(converter).to.have.property('callCount', 4);
diff --git a/src/ui/public/vislib_vis_type/__tests__/_vislib_renderbot.js b/src/ui/public/vislib_vis_type/__tests__/_vislib_renderbot.js
index 7f11ef76313c3..b70e61001a9e4 100644
--- a/src/ui/public/vislib_vis_type/__tests__/_vislib_renderbot.js
+++ b/src/ui/public/vislib_vis_type/__tests__/_vislib_renderbot.js
@@ -16,7 +16,7 @@ describe('renderbot', function exportWrapper() {
let VislibRenderbot;
let persistedState;
let normalizeChartData;
- var mockVisType = {
+ let mockVisType = {
name: 'test'
};
@@ -36,8 +36,8 @@ describe('renderbot', function exportWrapper() {
beforeEach(init);
describe('creation', function () {
- var vis = { type: mockVisType };
- var $el = 'element';
+ let vis = { type: mockVisType };
+ let $el = 'element';
let createVisStub;
let renderbot;
@@ -56,7 +56,7 @@ describe('renderbot', function exportWrapper() {
});
describe('_createVis', function () {
- var vis = {
+ let vis = {
type: mockVisType,
listeners: {
'test': _.noop,
@@ -64,7 +64,7 @@ describe('renderbot', function exportWrapper() {
'test3': _.noop
}
};
- var $el = $('
testing
');
+ let $el = $('
testing
');
let listenerSpy;
let renderbot;
@@ -82,15 +82,15 @@ describe('renderbot', function exportWrapper() {
});
describe('param update', function () {
- var params = { one: 'fish', two: 'fish' };
- var vis = {
+ let params = { one: 'fish', two: 'fish' };
+ let vis = {
type: _.defaults({
params: {
defaults: params
}
}, mockVisType)
};
- var $el = $('
testing
');
+ let $el = $('
testing
');
let createVisSpy;
let getParamsStub;
let renderbot;
@@ -119,20 +119,20 @@ describe('renderbot', function exportWrapper() {
});
describe('render', function () {
- var vis = { type: mockVisType, isHierarchical: _.constant(false) };
- var $el = $('
testing
');
- var stubs = {};
+ let vis = { type: mockVisType, isHierarchical: _.constant(false) };
+ let $el = $('
testing
');
+ let stubs = {};
beforeEach(function () {
sinon.stub(VislibRenderbot.prototype, '_getVislibParams', _.constant({}));
});
it('should use #buildChartData', function () {
- var renderbot = new VislibRenderbot(vis, $el, persistedState);
+ let renderbot = new VislibRenderbot(vis, $el, persistedState);
- var football = {};
- var buildStub = sinon.stub(renderbot, 'buildChartData', _.constant(football));
- var renderStub = sinon.stub(renderbot.vislibVis, 'render');
+ let football = {};
+ let buildStub = sinon.stub(renderbot, 'buildChartData', _.constant(football));
+ let renderStub = sinon.stub(renderbot.vislibVis, 'render');
renderbot.render('flat data', persistedState);
expect(renderStub.callCount).to.be(1);
@@ -142,7 +142,7 @@ describe('renderbot', function exportWrapper() {
});
describe('destroy', function () {
- var vis = {
+ let vis = {
type: mockVisType,
listeners: {
'test': _.noop,
@@ -150,7 +150,7 @@ describe('renderbot', function exportWrapper() {
'test3': _.noop
}
};
- var $el = $('
testing
');
+ let $el = $('
testing
');
let listenerSpy;
let renderbot;
@@ -167,7 +167,7 @@ describe('renderbot', function exportWrapper() {
});
it('should destroy the vis', function () {
- var spy = sinon.spy(renderbot.vislibVis, 'destroy');
+ let spy = sinon.spy(renderbot.vislibVis, 'destroy');
renderbot.destroy();
expect(spy.callCount).to.be(1);
});
diff --git a/src/ui/public/watch_multi/__tests__/watch_multi.js b/src/ui/public/watch_multi/__tests__/watch_multi.js
index fe39adb2e428a..e87d124c93a89 100644
--- a/src/ui/public/watch_multi/__tests__/watch_multi.js
+++ b/src/ui/public/watch_multi/__tests__/watch_multi.js
@@ -20,15 +20,15 @@ describe('$scope.$watchMulti', function () {
expect($rootScope.$watchMulti).to.be.a('function');
expect($scope).to.have.property('$watchMulti', $rootScope.$watchMulti);
- var $isoScope = $scope.$new(true);
+ let $isoScope = $scope.$new(true);
expect($isoScope).to.have.property('$watchMulti', $rootScope.$watchMulti);
});
it('returns a working unwatch function', function () {
$scope.a = 0;
$scope.b = 0;
- var triggers = 0;
- var unwatch = $scope.$watchMulti(['a', 'b'], function () { triggers++; });
+ let triggers = 0;
+ let unwatch = $scope.$watchMulti(['a', 'b'], function () { triggers++; });
// initial watch
$scope.$apply();
@@ -53,7 +53,7 @@ describe('$scope.$watchMulti', function () {
describe('simple scope watchers', function () {
it('only triggers a single watch on initialization', function () {
- var stub = sinon.stub();
+ let stub = sinon.stub();
$scope.$watchMulti([
'one',
@@ -66,7 +66,7 @@ describe('$scope.$watchMulti', function () {
});
it('only triggers a single watch when multiple values change', function () {
- var stub = sinon.spy(function (a, b) {});
+ let stub = sinon.spy(function (a, b) {});
$scope.$watchMulti([
'one',
@@ -87,7 +87,7 @@ describe('$scope.$watchMulti', function () {
it('passes an array of the current and previous values, in order',
function () {
- var stub = sinon.spy(function (a, b) {});
+ let stub = sinon.spy(function (a, b) {});
$scope.one = 'a';
$scope.two = 'b';
@@ -116,7 +116,7 @@ describe('$scope.$watchMulti', function () {
});
it('always has an up to date value', function () {
- var count = 0;
+ let count = 0;
$scope.vals = [1, 0];
$scope.$watchMulti([ 'vals[0]', 'vals[1]' ], function (cur, prev) {
@@ -124,7 +124,7 @@ describe('$scope.$watchMulti', function () {
count++;
});
- var $child = $scope.$new();
+ let $child = $scope.$new();
$child.$watch('vals[0]', function (cur) {
$child.vals[1] = cur;
});
@@ -140,11 +140,11 @@ describe('$scope.$watchMulti', function () {
let secondValue;
beforeEach(function () {
- var firstGetter = function () {
+ let firstGetter = function () {
return firstValue;
};
- var secondGetter = function () {
+ let secondGetter = function () {
return secondValue;
};
@@ -158,7 +158,7 @@ describe('$scope.$watchMulti', function () {
});
it('should trigger the watcher on initialization', function () {
- var stub = sinon.stub();
+ let stub = sinon.stub();
firstValue = 'first';
secondValue = 'second';
@@ -174,7 +174,7 @@ describe('$scope.$watchMulti', function () {
describe('nested watchers', function () {
it('should trigger the handler at least once', function () {
- var $scope = $rootScope.$new();
+ let $scope = $rootScope.$new();
$scope.$$watchers = [{
get: _.noop,
fn: _.noop,
@@ -187,8 +187,8 @@ describe('$scope.$watchMulti', function () {
last: false
}];
- var first = sinon.stub();
- var second = sinon.stub();
+ let first = sinon.stub();
+ let second = sinon.stub();
function registerWatchers() {
$scope.$watchMulti([first, second], function () {