Skip to content
This repository has been archived by the owner on Jul 3, 2019. It is now read-only.

ESLINT - no-var #129

Merged
merged 1 commit into from Aug 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintrc
Expand Up @@ -51,7 +51,6 @@
}
],
"no-use-before-define": 0,
"no-var": 0,
"no-void": 0,
"no-with": 2,
"padded-blocks": 0,
Expand Down
@@ -1,5 +1,5 @@
describe('BindRowsWithHeaders', () => {
var id = 'testContainer';
const id = 'testContainer';

beforeEach(function() {
this.$container = $(`<div id="${id}"></div>`).appendTo('body');
Expand All @@ -13,7 +13,7 @@ describe('BindRowsWithHeaders', () => {
});

it('should call rowHeader function with correct index as argument (strict mode)', () => {
var callback = jasmine.createSpy();
const callback = jasmine.createSpy();
handsontable({
data: Handsontable.helper.createSpreadsheetData(5, 10),
rowHeaders: callback,
Expand Down Expand Up @@ -43,7 +43,7 @@ describe('BindRowsWithHeaders', () => {
});

it('should correct bind rows with headers after re-load data calling loadData method (strict mode)', async() => {
var hot = handsontable({
const hot = handsontable({
data: Handsontable.helper.createSpreadsheetData(10, 10),
rowHeaders: true,
bindRowsWithHeaders: 'strict',
Expand Down
30 changes: 15 additions & 15 deletions src/plugins/bindRowsWithHeaders/test/bindStrategy.unit.js
Expand Up @@ -2,16 +2,16 @@ import BindStrategy from 'handsontable-pro/plugins/bindRowsWithHeaders/bindStrat

describe('BindRowsWithHeaders -> BindStrategy', () => {
it('should throw error when used strategy is not exists', () => {
var strategy = new BindStrategy();
const strategy = new BindStrategy();

expect(() => {
strategy.setStrategy('test2');
}).toThrow();
});

it('should create a map based on `length` argument', () => {
var strategyMock = { _arrayMap: [] };
var strategy = new BindStrategy();
const strategyMock = { _arrayMap: [] };
const strategy = new BindStrategy();

strategy.strategy = strategyMock;
strategy.createMap(4);
Expand All @@ -24,8 +24,8 @@ describe('BindRowsWithHeaders -> BindStrategy', () => {
});

it('should re-create a map based on current map length', () => {
var strategyMock = { _arrayMap: [] };
var strategy = new BindStrategy();
const strategyMock = { _arrayMap: [] };
const strategy = new BindStrategy();

strategy.strategy = strategyMock;
strategy.strategy._arrayMap[0] = 4;
Expand All @@ -40,8 +40,8 @@ describe('BindRowsWithHeaders -> BindStrategy', () => {
});

it('should forward `createRow` method call to the strategy object', () => {
var strategyMock = jasmine.createSpyObj('strategy', ['createRow']);
var strategy = new BindStrategy();
const strategyMock = jasmine.createSpyObj('strategy', ['createRow']);
const strategy = new BindStrategy();

strategy.strategy = strategyMock;
strategy.createRow(1, 1);
Expand All @@ -54,8 +54,8 @@ describe('BindRowsWithHeaders -> BindStrategy', () => {
});

it('should forward `removeRow` method call to the strategy object', () => {
var strategyMock = jasmine.createSpyObj('strategy', ['removeRow']);
var strategy = new BindStrategy();
const strategyMock = jasmine.createSpyObj('strategy', ['removeRow']);
const strategy = new BindStrategy();

strategy.strategy = strategyMock;
strategy.removeRow(1, 1);
Expand All @@ -68,8 +68,8 @@ describe('BindRowsWithHeaders -> BindStrategy', () => {
});

it('should forward `translate` method call to the strategy object', () => {
var strategyMock = jasmine.createSpyObj('strategy', ['getValueByIndex']);
var strategy = new BindStrategy();
const strategyMock = jasmine.createSpyObj('strategy', ['getValueByIndex']);
const strategy = new BindStrategy();

strategy.strategy = strategyMock;
strategy.translate(1);
Expand All @@ -78,8 +78,8 @@ describe('BindRowsWithHeaders -> BindStrategy', () => {
});

it('should forward `clearMap` method call to the strategy object', () => {
var strategyMock = jasmine.createSpyObj('strategy', ['clearMap']);
var strategy = new BindStrategy();
const strategyMock = jasmine.createSpyObj('strategy', ['clearMap']);
const strategy = new BindStrategy();

strategy.strategy = strategyMock;
strategy.clearMap();
Expand All @@ -88,8 +88,8 @@ describe('BindRowsWithHeaders -> BindStrategy', () => {
});

it('should destroy object after call `destroy` method', () => {
var strategyMock = jasmine.createSpyObj('strategy', ['destroy']);
var strategy = new BindStrategy();
const strategyMock = jasmine.createSpyObj('strategy', ['destroy']);
const strategy = new BindStrategy();

strategy.strategy = strategyMock;
strategy.destroy();
Expand Down
44 changes: 22 additions & 22 deletions src/plugins/collapsibleColumns/test/collapsibleColumns.e2e.js
@@ -1,14 +1,14 @@
describe('CollapsibleColumns', () => {
var id = 'testContainer';
const id = 'testContainer';

beforeEach(function() {
this.$container = $(`<div id="${id}"></div>`).appendTo('body');

this.generateComplexSetup = function(rows, cols, obj) {
var data = [];
const data = [];

for (var i = 0; i < rows; i++) {
for (var j = 0; j < cols; j++) {
for (let i = 0; i < rows; i++) {
for (let j = 0; j < cols; j++) {
if (!data[i]) {
data[i] = [];
}
Expand Down Expand Up @@ -55,7 +55,7 @@ describe('CollapsibleColumns', () => {

describe('initialization', () => {
it('should be possible to disable the plugin using the disablePlugin method', () => {
var hot = handsontable({
const hot = handsontable({
data: Handsontable.helper.createSpreadsheetData(10, 10),
hiddenColumns: true,
nestedHeaders: [
Expand All @@ -65,7 +65,7 @@ describe('CollapsibleColumns', () => {
collapsibleColumns: true
});

var collapsibleColumnsPlugin = hot.getPlugin('collapsibleColumns');
const collapsibleColumnsPlugin = hot.getPlugin('collapsibleColumns');

expect($('.collapsibleIndicator').size()).toBeGreaterThan(0);

Expand All @@ -76,7 +76,7 @@ describe('CollapsibleColumns', () => {
});

it('should be possible to re-enable the plugin using the enablePlugin method', () => {
var hot = handsontable({
const hot = handsontable({
data: Handsontable.helper.createSpreadsheetData(10, 10),
hiddenColumns: true,
nestedHeaders: [
Expand All @@ -86,7 +86,7 @@ describe('CollapsibleColumns', () => {
collapsibleColumns: true
});

var collapsibleColumnsPlugin = hot.getPlugin('collapsibleColumns');
const collapsibleColumnsPlugin = hot.getPlugin('collapsibleColumns');

collapsibleColumnsPlugin.disablePlugin();
hot.render();
Expand All @@ -97,7 +97,7 @@ describe('CollapsibleColumns', () => {
});

it('should be possible to initialize the plugin using the updateSettings method', () => {
var hot = handsontable({
const hot = handsontable({
data: Handsontable.helper.createSpreadsheetData(10, 10),
hiddenColumns: true,
nestedHeaders: [
Expand Down Expand Up @@ -127,8 +127,8 @@ describe('CollapsibleColumns', () => {
collapsibleColumns: true
});

var button = $('.collapsibleIndicator').first();
var colgroupArray = $('colgroup col');
const button = $('.collapsibleIndicator').first();
const colgroupArray = $('colgroup col');

expect(parseInt(colgroupArray.eq(0).width(), 10)).toBeGreaterThan(0);
expect(parseInt(colgroupArray.eq(1).width(), 10)).toBeGreaterThan(0);
Expand Down Expand Up @@ -160,8 +160,8 @@ describe('CollapsibleColumns', () => {
collapsibleColumns: true
});

var button = $('.collapsibleIndicator').first();
var colgroupArray = $('colgroup col');
const button = $('.collapsibleIndicator').first();
const colgroupArray = $('colgroup col');

expect(parseInt(colgroupArray.eq(0).width(), 10)).toBeGreaterThan(0);
expect(parseInt(colgroupArray.eq(1).width(), 10)).toBeGreaterThan(0);
Expand All @@ -183,7 +183,7 @@ describe('CollapsibleColumns', () => {
});

xit('should maintain the collapse functionality, when the table has been scrolled', function() {
var hot = handsontable({
const hot = handsontable({
data: Handsontable.helper.createSpreadsheetData(10, 90),
hiddenColumns: true,
nestedHeaders: this.generateComplexSetup(4, 70, true),
Expand All @@ -195,8 +195,8 @@ describe('CollapsibleColumns', () => {
hot.scrollViewportTo(void 0, 37);
hot.render();

var button = $('.collapsibleIndicator').eq(0);
var colgroupArray = $('colgroup col');
const button = $('.collapsibleIndicator').eq(0);
const colgroupArray = $('colgroup col');

button.simulate('mousedown');

Expand All @@ -222,8 +222,8 @@ describe('CollapsibleColumns', () => {
collapsibleColumns: true
});

var button = $('.collapsibleIndicator').first();
var colgroupArray = $('colgroup col');
const button = $('.collapsibleIndicator').first();
const colgroupArray = $('colgroup col');
button.simulate('mousedown');

expect(parseInt(colgroupArray.eq(0).width(), 10)).toBeGreaterThan(0);
Expand All @@ -247,7 +247,7 @@ describe('CollapsibleColumns', () => {
});

it('should maintain the expand functionality, when the table has been scrolled', function(done) {
var hot = handsontable({
const hot = handsontable({
data: Handsontable.helper.createSpreadsheetData(10, 90),
hiddenColumns: true,
nestedHeaders: this.generateComplexSetup(4, 70, true),
Expand All @@ -260,8 +260,8 @@ describe('CollapsibleColumns', () => {
hot.scrollViewportTo(void 0, 37);
hot.render();

var button = $('.collapsibleIndicator').eq(0);
var colgroupArray = $('colgroup col');
let button = $('.collapsibleIndicator').eq(0);
const colgroupArray = $('colgroup col');

button.simulate('mousedown');
button = $('.collapsibleIndicator').eq(0);
Expand Down Expand Up @@ -293,7 +293,7 @@ describe('CollapsibleColumns', () => {
height: 300
});

var TRs = document.querySelectorAll('.handsontable THEAD TR');
const TRs = document.querySelectorAll('.handsontable THEAD TR');

expect(TRs[0].querySelector('TH:nth-child(2) .collapsibleIndicator')).not.toEqual(null);
expect(TRs[0].querySelector('TH:nth-child(10) .collapsibleIndicator')).toEqual(null);
Expand Down