Add linting support, and, well, lint.

This commit is contained in:
Shruti B Iyer
2017-06-12 16:55:14 +01:00
committed by Dave Page
parent 659eb1c1e8
commit 3f4f8b9e77
31 changed files with 429 additions and 405 deletions

View File

@@ -18,6 +18,7 @@ define([
var onColumnsResizedFunction;
var onHeaderMouseEnterFunction;
var onHeaderMouseLeaveFunction;
var Slick = window.Slick;
beforeEach(function () {
getSelectedRangesSpy = jasmine.createSpy('getSelectedRangesSpy');
@@ -27,15 +28,15 @@ define([
return {
getSelectedRanges: getSelectedRangesSpy,
setSelectedRanges: setSelectedRangesSpy,
}
};
},
getColumns: function () {
return [
{id: 'row-header-column'},
{id: 'column-1'},
{id: 'column-2'}
]
{id: 'column-2'},
];
},
onDragEnd: jasmine.createSpyObj('onDragEnd', ['subscribe']),
@@ -47,7 +48,7 @@ define([
onHeaderMouseEnter: jasmine.createSpyObj('onHeaderMouseEnter', ['subscribe']),
onHeaderMouseLeave: jasmine.createSpyObj('onHeaderMouseLeave', ['subscribe']),
getDataLength: function () { return 10 },
getDataLength: function () { return 10; },
setActiveCell: jasmine.createSpy('setActiveCell'),
getActiveCell: jasmine.createSpy('getActiveCell'),
@@ -108,7 +109,7 @@ define([
describe('when a different column is clicked', function () {
beforeEach(function () {
onHeaderClickFunction({}, {column: {pos: 4}})
onHeaderClickFunction({}, {column: {pos: 4}});
});
it('should set the active cell to the newly clicked columns top cell', function () {
@@ -217,7 +218,7 @@ define([
describe('when the third column is clicked (thereby deselecting it)', function () {
beforeEach(function () {
onHeaderClickFunction({}, {column: {pos: 21}})
onHeaderClickFunction({}, {column: {pos: 21}});
});
it('should set the active cell to the second column', function () {
@@ -227,7 +228,7 @@ define([
describe('when the second column is clicked (thereby deselecting it)', function () {
beforeEach(function () {
onHeaderClickFunction({}, {column: {pos: 5}})
onHeaderClickFunction({}, {column: {pos: 5}});
});
it('should not set the active cell', function () {
@@ -268,7 +269,7 @@ define([
beforeEach(function () {
grid.getActiveCell.and.returnValue({row: 4, cell: 5});
getSelectedRangesSpy.and.returnValue([
new Slick.Range(4, 5)
new Slick.Range(4, 5),
]);
});
@@ -283,7 +284,7 @@ define([
beforeEach(function () {
grid.getActiveCell.and.returnValue({row: 3, cell: 1});
getSelectedRangesSpy.and.returnValue([
RangeSelectionHelper.rangeForRow(grid, 3)
RangeSelectionHelper.rangeForRow(grid, 3),
]);
});
@@ -307,7 +308,7 @@ define([
grid.getActiveCell.and.returnValue({row: 3, cell: 1});
getSelectedRangesSpy.and.returnValue([
RangeSelectionHelper.rangeForRow(grid, 5),
RangeSelectionHelper.rangeForRow(grid, 3)
RangeSelectionHelper.rangeForRow(grid, 3),
]);
});
@@ -330,7 +331,7 @@ define([
describe('and the editable new row', function () {
beforeEach(function () {
onClickFunction({}, {row: 10, cell: 0})
onClickFunction({}, {row: 10, cell: 0});
});
it('does not select the row', function () {
expect(grid.setActiveCell).not.toHaveBeenCalled();

View File

@@ -22,10 +22,12 @@ import 'sources/slickgrid/pgslick.cellrangeselector';
describe('ColumnSelector', function () {
var container, data, columns, options;
var SlickGrid = Slick.Grid;
var KEY_RIGHT = 39;
var KEY_LEFT = 37;
var KEY_UP = 38;
var KEY_DOWN = 40;
var KEY = {
RIGHT: 39,
LEFT: 37,
UP: 38,
DOWN: 40,
};
beforeEach(function () {
container = $('<div></div>');
@@ -35,11 +37,11 @@ describe('ColumnSelector', function () {
data = [{
'some-column-name': 'first value',
'second column': 'second value',
'third column': 'nonselectable value'
'third column': 'nonselectable value',
}, {
'some-column-name': 'row 1 - first value',
'second column': 'row 1 - second value',
'third column': 'row 1 - nonselectable value'
'third column': 'row 1 - nonselectable value',
}];
columns = [
@@ -48,36 +50,36 @@ describe('ColumnSelector', function () {
name: 'row header column name',
selectable: false,
display_name: 'row header column name',
column_type: 'text'
column_type: 'text',
},
{
id: '1',
name: 'some-column-name',
pos: 0,
display_name: 'some-column-name',
column_type: 'text'
column_type: 'text',
},
{
id: '2',
name: 'second column',
pos: 1,
display_name: 'second column',
column_type: 'json'
column_type: 'json',
},
{
id: 'third-column-id',
name: 'third column',
pos: 2,
display_name: 'third column',
column_type: 'text'
column_type: 'text',
},
{
name: 'some-non-selectable-column',
selectable: false,
pos: 3,
display_name: 'some-non-selectable-column',
column_type: 'numeric'
}
column_type: 'numeric',
},
];
});
@@ -170,7 +172,7 @@ describe('ColumnSelector', function () {
describe('and presses shift + right-arrow', function () {
beforeEach(function () {
pressShiftArrow(KEY_RIGHT);
pressShiftArrow(KEY.RIGHT);
});
it('keeps the last column selected', function () {
@@ -202,7 +204,7 @@ describe('ColumnSelector', function () {
describe('and presses shift + right-arrow', function () {
it('first and second columns are selected', function () {
pressShiftArrow(KEY_RIGHT);
pressShiftArrow(KEY.RIGHT);
var selectedRanges = cellSelectionModel.getSelectedRanges();
@@ -266,7 +268,7 @@ describe('ColumnSelector', function () {
var selectedRanges = cellSelectionModel.getSelectedRanges();
expect(selectedRanges.length).toEqual(0);
})
});
});
describe('when the column is not selectable', function () {

View File

@@ -19,52 +19,51 @@ import XCellSelectionModel from 'sources/selection/xcell_selection_model';
describe('copyData', function () {
var grid, sqlEditor, gridContainer, buttonPasteRow;
var Slick, SlickGrid;
var SlickGrid;
beforeEach(function () {
Slick = window.Slick;
SlickGrid = Slick.Grid;
var data = [[1, 'leopord', '12'],
[2, 'lion', '13'],
[3, 'puma', '9']];
var columns = [
{
id: 'row-header-column',
name: 'row header column name',
selectable: false,
display_name: 'row header column name',
column_type: 'text'
},
{
name: 'id',
pos: 0,
label: 'id<br> numeric',
cell: 'number',
can_edit: false,
type: 'numeric'
}, {
name: 'brand',
pos: 1,
label: 'flavor<br> character varying',
cell: 'string',
can_edit: false,
type: 'character varying'
}, {
name: 'size',
pos: 2,
label: 'size<br> numeric',
cell: 'number',
can_edit: false,
type: 'numeric'
}
]
{
id: 'row-header-column',
name: 'row header column name',
selectable: false,
display_name: 'row header column name',
column_type: 'text',
},
{
name: 'id',
pos: 0,
label: 'id<br> numeric',
cell: 'number',
can_edit: false,
type: 'numeric',
}, {
name: 'brand',
pos: 1,
label: 'flavor<br> character varying',
cell: 'string',
can_edit: false,
type: 'character varying',
}, {
name: 'size',
pos: 2,
label: 'size<br> numeric',
cell: 'number',
can_edit: false,
type: 'numeric',
},
]
;
gridContainer = $('<div id=\'grid\'></div>');
$('body').append(gridContainer);
buttonPasteRow = $('<button id=\'btn-paste-row\' disabled></button>');
$('body').append(buttonPasteRow);
grid = new Slick.Grid('#grid', data, columns, {});
grid = new SlickGrid('#grid', data, columns, {});
grid.setSelectionModel(new XCellSelectionModel());
sqlEditor = {slickgrid: grid};
});

View File

@@ -8,7 +8,6 @@
//////////////////////////////////////////////////////////////////////////
import $ from 'jquery';
import _ from 'underscore';
import Slick from 'slickgrid';
import 'slickgrid.grid';
@@ -18,21 +17,20 @@ import XCellSelectionModel from 'sources/selection/xcell_selection_model';
describe('GridSelector', function () {
var container, data, columns, gridSelector, xCellSelectionModel;
var Slick, SlickGrid;
var SlickGrid;
beforeEach(function () {
Slick = window.Slick;
SlickGrid = Slick.Grid;
container = $('<div></div>');
container.height(9999);
columns = [{
id: '1',
name: 'some-column-name',
pos: 0
pos: 0,
}, {
id: '2',
name: 'second column',
pos: 1
pos: 1,
}];
gridSelector = new GridSelector();
@@ -42,7 +40,7 @@ describe('GridSelector', function () {
for (var i = 0; i < 10; i++) {
data.push({'some-column-name': 'some-value-' + i, 'second column': 'second value ' + i});
}
var grid = new Slick.Grid(container, data, columns);
var grid = new SlickGrid(container, data, columns);
xCellSelectionModel = new XCellSelectionModel();
grid.setSelectionModel(xCellSelectionModel);

View File

@@ -23,8 +23,8 @@ describe('RangeBoundaryNavigator', function () {
});
});
describe("when the ranges all overlap partially or touch", function () {
it("returns one long range", function () {
describe('when the ranges all overlap partially or touch', function () {
it('returns one long range', function () {
var rangeBounds = [[3, 6], [1, 4], [7, 14]];
var union = rangeBoundaryNavigator.getUnion(rangeBounds);
@@ -32,7 +32,7 @@ describe('RangeBoundaryNavigator', function () {
expect(union).toEqual([[1, 14]]);
});
it("returns them in order from lowest to highest", function () {
it('returns them in order from lowest to highest', function () {
var rangeBounds = [[3, 6], [2, 3], [10, 12]];
var union = rangeBoundaryNavigator.getUnion(rangeBounds);
@@ -40,9 +40,9 @@ describe('RangeBoundaryNavigator', function () {
expect(union).toEqual([[2, 6], [10, 12]]);
});
describe("when one range completely overlaps another", function() {
describe('when one range completely overlaps another', function() {
it("returns them in order from lowest to highest", function () {
it('returns them in order from lowest to highest', function () {
var rangeBounds = [[9, 14], [2, 3], [11, 13]];
var union = rangeBoundaryNavigator.getUnion(rangeBounds);
@@ -51,19 +51,19 @@ describe('RangeBoundaryNavigator', function () {
});
});
describe("when one range is a subset of another", function () {
it("returns the larger range", function () {
describe('when one range is a subset of another', function () {
it('returns the larger range', function () {
var rangeBounds = [[2, 6], [1, 14], [8, 10]];
var union = rangeBoundaryNavigator.getUnion(rangeBounds);
expect(union).toEqual([[1, 14]]);
})
})
});
});
});
describe("when the ranges do not touch", function () {
it("returns them in order from lowest to highest", function () {
describe('when the ranges do not touch', function () {
it('returns them in order from lowest to highest', function () {
var rangeBounds = [[3, 6], [1, 1], [8, 10]];
var union = rangeBoundaryNavigator.getUnion(rangeBounds);
@@ -73,8 +73,8 @@ describe('RangeBoundaryNavigator', function () {
});
});
describe("#mapDimensionBoundaryUnion", function () {
it("returns a list of the results of the callback", function () {
describe('#mapDimensionBoundaryUnion', function () {
it('returns a list of the results of the callback', function () {
var rangeBounds = [[0, 1], [3, 3]];
var callback = function () {
return 'hello';
@@ -83,7 +83,7 @@ describe('RangeBoundaryNavigator', function () {
expect(result).toEqual(['hello', 'hello', 'hello']);
});
it("calls the callback with each index in the dimension", function () {
it('calls the callback with each index in the dimension', function () {
var rangeBounds = [[0, 1], [3, 3]];
var callback = jasmine.createSpy('callbackSpy');
rangeBoundaryNavigator.mapDimensionBoundaryUnion(rangeBounds, callback);
@@ -91,7 +91,7 @@ describe('RangeBoundaryNavigator', function () {
});
});
describe("#mapOver2DArray", function () {
describe('#mapOver2DArray', function () {
var data, rowCollector, processCell;
beforeEach(function () {
data = [[0, 1, 2, 3], [2, 2, 2, 2], [4, 5, 6, 7]];
@@ -103,76 +103,75 @@ describe('RangeBoundaryNavigator', function () {
};
});
it("calls the callback for each item in the ranges", function () {
it('calls the callback for each item in the ranges', function () {
var rowRanges = [[0, 0], [2, 2]];
var colRanges = [[0, 3]];
var selectionResult = rangeBoundaryNavigator.mapOver2DArray(rowRanges, colRanges, processCell, rowCollector);
expect(selectionResult).toEqual(["[0,1,2,3]", "[4,5,6,7]"]);
expect(selectionResult).toEqual(['[0,1,2,3]', '[4,5,6,7]']);
});
describe("when the ranges are out of order/duplicated", function () {
describe('when the ranges are out of order/duplicated', function () {
var rowRanges, colRanges;
beforeEach(function () {
rowRanges = [[2, 2], [2, 2], [0, 0]];
colRanges = [[0, 3]];
});
it("uses the union of the ranges", function () {
spyOn(rangeBoundaryNavigator, "getUnion").and.callThrough();
it('uses the union of the ranges', function () {
spyOn(rangeBoundaryNavigator, 'getUnion').and.callThrough();
var selectionResult = rangeBoundaryNavigator.mapOver2DArray(rowRanges, colRanges, processCell, rowCollector);
expect(rangeBoundaryNavigator.getUnion).toHaveBeenCalledWith(rowRanges);
expect(rangeBoundaryNavigator.getUnion).toHaveBeenCalledWith(colRanges);
expect(selectionResult).toEqual(["[0,1,2,3]", "[4,5,6,7]"]);
expect(selectionResult).toEqual(['[0,1,2,3]', '[4,5,6,7]']);
});
});
});
describe("#rangesToCsv", function () {
describe('#rangesToCsv', function () {
var data, columnDefinitions, ranges;
beforeEach(function () {
data = [[1, "leopard", "12"],
[2, "lion", "13"],
[3, "cougar", "9"],
[4, "tiger", "10"]];
data = [[1, 'leopard', '12'],
[2, 'lion', '13'],
[3, 'cougar', '9'],
[4, 'tiger', '10']];
columnDefinitions = [{name: 'id', pos: 0}, {name: 'animal', pos: 1}, {name: 'size', pos: 2}];
ranges = [new Slick.Range(0, 0, 0, 2), new Slick.Range(3, 0, 3, 2)];
});
it("returns csv for the provided ranges", function () {
it('returns csv for the provided ranges', function () {
var csvResult = rangeBoundaryNavigator.rangesToCsv(data, columnDefinitions, ranges);
expect(csvResult).toEqual("1,'leopard','12'\n4,'tiger','10'");
expect(csvResult).toEqual('1,\'leopard\',\'12\'\n4,\'tiger\',\'10\'');
});
describe("when no cells are selected", function () {
it("should return an empty string", function () {
describe('when no cells are selected', function () {
it('should return an empty string', function () {
var csvResult = rangeBoundaryNavigator.rangesToCsv(data, columnDefinitions, []);
expect(csvResult).toEqual('');
});
});
describe("when there is an extra column with checkboxes", function () {
describe('when there is an extra column with checkboxes', function () {
beforeEach(function () {
columnDefinitions = [{name: 'not-a-data-column'}, {name: 'id', pos: 0}, {name: 'animal', pos: 1}, {
name: 'size',
pos: 2
pos: 2,
}];
ranges = [new Slick.Range(0, 0, 0, 3), new Slick.Range(3, 0, 3, 3)];
});
it("returns csv for the columns with data", function () {
it('returns csv for the columns with data', function () {
var csvResult = rangeBoundaryNavigator.rangesToCsv(data, columnDefinitions, ranges);
expect(csvResult).toEqual("1,'leopard','12'\n4,'tiger','10'");
expect(csvResult).toEqual('1,\'leopard\',\'12\'\n4,\'tiger\',\'10\'');
});
describe("when no cells are selected", function () {
it("should return an empty string", function () {
describe('when no cells are selected', function () {
it('should return an empty string', function () {
var csvResult = rangeBoundaryNavigator.rangesToCsv(data, columnDefinitions, []);
expect(csvResult).toEqual('');
@@ -180,4 +179,4 @@ describe('RangeBoundaryNavigator', function () {
});
});
});
});
});

View File

@@ -3,21 +3,21 @@ import Slick from 'slickgrid';
import 'slickgrid.grid';
import RangeSelectionHelper from 'sources/selection/range_selection_helper';
describe("RangeSelectionHelper utility functions", function () {
describe('RangeSelectionHelper utility functions', function () {
var grid;
beforeEach(function () {
var container, data, columns, options;
container = $("<div></div>");
container = $('<div></div>');
container.height(9999);
columns = [{
id: '1',
name: 'some-column-name',
pos: 0
pos: 0,
}, {
id: 'second-column-id',
name: 'second column',
pos: 1
pos: 1,
}];
data = [];
@@ -29,18 +29,18 @@ describe("RangeSelectionHelper utility functions", function () {
grid.invalidate();
});
describe("#getIndexesOfCompleteRows", function () {
describe("when selected ranges are not rows", function () {
it("returns an empty array", function () {
describe('#getIndexesOfCompleteRows', function () {
describe('when selected ranges are not rows', function () {
it('returns an empty array', function () {
var rowlessRanges = [RangeSelectionHelper.rangeForColumn(grid, 1)];
expect(RangeSelectionHelper.getIndexesOfCompleteRows(grid, rowlessRanges))
.toEqual([]);
});
});
describe("when selected range", function () {
describe("is a single row", function () {
it("returns an array with one index", function () {
describe('when selected range', function () {
describe('is a single row', function () {
it('returns an array with one index', function () {
var singleRowRange = [RangeSelectionHelper.rangeForRow(grid, 1)];
expect(RangeSelectionHelper.getIndexesOfCompleteRows(grid, singleRowRange))
@@ -48,8 +48,8 @@ describe("RangeSelectionHelper utility functions", function () {
});
});
describe("is multiple rows", function () {
it("returns an array of each row's index", function () {
describe('is multiple rows', function () {
it('returns an array of each row\'s index', function () {
var multipleRowRange = [
RangeSelectionHelper.rangeForRow(grid, 0),
RangeSelectionHelper.rangeForRow(grid, 3),
@@ -62,10 +62,10 @@ describe("RangeSelectionHelper utility functions", function () {
});
});
describe("contains a multi row selection", function () {
it("returns an array of each individual row's index", function () {
describe('contains a multi row selection', function () {
it('returns an array of each individual row\'s index', function () {
var multipleRowRange = [
new Slick.Range(3, 0, 5, 1)
new Slick.Range(3, 0, 5, 1),
];
var indexesOfCompleteRows = RangeSelectionHelper.getIndexesOfCompleteRows(grid, multipleRowRange);
@@ -73,11 +73,11 @@ describe("RangeSelectionHelper utility functions", function () {
expect(indexesOfCompleteRows).toEqual([3, 4, 5]);
});
describe("and also contains a selection that is not a row", function () {
it("returns an array of only the complete rows' indexes", function () {
describe('and also contains a selection that is not a row', function () {
it('returns an array of only the complete rows\' indexes', function () {
var multipleRowRange = [
new Slick.Range(8, 1, 9, 1),
new Slick.Range(3, 0, 5, 1)
new Slick.Range(3, 0, 5, 1),
];
var indexesOfCompleteRows = RangeSelectionHelper.getIndexesOfCompleteRows(grid, multipleRowRange);

View File

@@ -8,7 +8,6 @@
//////////////////////////////////////////////////////////////////////////
import $ from 'jquery';
import _ from 'underscore';
import Slick from 'slickgrid';
import 'slickgrid.grid';
@@ -18,10 +17,12 @@ import ActiveCellCapture from 'sources/selection/active_cell_capture';
import XCellSelectionModel from 'sources/selection/xcell_selection_model';
describe('RowSelector', function () {
var KEY_RIGHT = 39;
var KEY_LEFT = 37;
var KEY_UP = 38;
var KEY_DOWN = 40;
var KEY = {
RIGHT: 39,
LEFT: 37,
UP: 38,
DOWN: 40,
};
var container, data, columnDefinitions, grid, cellSelectionModel;
var SlickGrid = Slick.Grid;
@@ -34,12 +35,12 @@ describe('RowSelector', function () {
id: '1',
name: 'some-column-name',
selectable: true,
pos: 0
pos: 0,
}, {
id: '2',
name: 'second column',
selectable: true,
pos: 1
pos: 1,
}];
var rowSelector = new RowSelector();
@@ -134,7 +135,7 @@ describe('RowSelector', function () {
describe('and presses shift + down-arrow', function () {
beforeEach(function () {
pressShiftArrow(KEY_DOWN);
pressShiftArrow(KEY.DOWN);
});
it('keeps the last row selected', function () {
@@ -301,7 +302,7 @@ describe('RowSelector', function () {
var selectedRanges = cellSelectionModel.getSelectedRanges();
expect(selectedRanges.length).toEqual(0);
})
});
});
});

View File

@@ -8,9 +8,9 @@
//////////////////////////////////////////////////////////////
define([
"jquery",
"underscore",
"sources/selection/set_staged_rows",
'jquery',
'underscore',
'sources/selection/set_staged_rows',
], function ($, _, SetStagedRows) {
describe('set_staged_rows', function () {
var sqlEditorObj, gridSpy, deleteButton, copyButton, selectionSpy;
@@ -20,7 +20,7 @@ define([
{0: 'one', 1: 'two', __temp_PK: '123'},
{0: 'three', 1: 'four', __temp_PK: '456'},
{0: 'five', 1: 'six', __temp_PK: '789'},
{0: 'seven', 1: 'eight', __temp_PK: '432'}
{0: 'seven', 1: 'eight', __temp_PK: '432'},
]);
gridSpy.getColumns.and.returnValue([
{
@@ -29,7 +29,7 @@ define([
}, {
pos: 1,
selectable: true,
}
},
]);
selectionSpy = jasmine.createSpyObj('selectionSpy', ['setSelectedRows', 'getSelectedRanges']);
@@ -42,23 +42,23 @@ define([
editor: {
handler: {
data_store: {
staged_rows: {'456': {}}
staged_rows: {'456': {}},
},
can_edit: false
}
can_edit: false,
},
},
keys: null,
selection: selectionSpy,
columns: [
{
name: 'a pk column',
pos: 0
pos: 0,
},
{
name: 'some column',
pos: 1
}
]
pos: 1,
},
],
};
$('body').append(deleteButton);
@@ -195,7 +195,7 @@ define([
{0: 'one', 1: 'two', __temp_PK: '123'},
{1: 'four', __temp_PK: '456'},
{1: 'six', __temp_PK: '789'},
{0: 'seven', 1: 'eight', __temp_PK: '432'}
{0: 'seven', 1: 'eight', __temp_PK: '432'},
]);
});
@@ -228,7 +228,7 @@ define([
it('should not clear the staged rows', function () {
expect(sqlEditorObj.editor.handler.data_store.staged_rows).toEqual({
'456': {0: 'three'},
'789': {0: 'five'}
'789': {0: 'five'},
});
});

View File

@@ -10,6 +10,7 @@
import XCellSelectionModel from 'sources/selection/xcell_selection_model';
import 'slickgrid.grid';
import Slick from 'slickgrid';
import $ from 'jquery';
describe('XCellSelectionModel', function () {
var KEY_RIGHT = 39;
@@ -31,15 +32,15 @@ describe('XCellSelectionModel', function () {
}, {
id: '1',
name: 'some-column-name',
pos: 0
pos: 0,
}, {
id: 'second-column-id',
name: 'second column',
pos: 1
pos: 1,
}, {
id: 'third-column-id',
name: 'third column',
pos: 2
pos: 2,
},
];
@@ -52,13 +53,13 @@ describe('XCellSelectionModel', function () {
'fourth column': 'fourth value ' + i,
});
}
container = $("<div></div>");
container = $('<div></div>');
container.height(9999);
container.width(9999);
grid = new SlickGrid(container, data, columns);
grid.setSelectionModel(new XCellSelectionModel());
$("body").append(container);
$('body').append(container);
});
afterEach(function () {
@@ -397,13 +398,13 @@ describe('XCellSelectionModel', function () {
target: $cell,
isPropagationStopped: jasmine.createSpy('isPropagationStopped').and.returnValue(false),
isImmediatePropagationStopped: jasmine.createSpy('isImmediatePropagationStopped').and.returnValue(false),
stopImmediatePropagation: jasmine.createSpy('stopImmediatePropagation')
stopImmediatePropagation: jasmine.createSpy('stopImmediatePropagation'),
};
dd = {
grid: grid,
startX: cellLeftPosition(initialPosition.cell),
startY: cellTopPosition($cell, initialPosition.row)
startY: cellTopPosition($cell, initialPosition.row),
};
grid.onDragStart.notify(dd, event, grid);
@@ -421,7 +422,7 @@ describe('XCellSelectionModel', function () {
stopImmediatePropagation: jasmine.createSpy('stopImmediatePropagation'),
pageX: cellLeftPosition(finalPosition.cell),
pageY: cellTopPosition($cell, finalPosition.row)
pageY: cellTopPosition($cell, finalPosition.row),
};
grid.onDrag.notify(dd, event, grid);
@@ -448,7 +449,7 @@ describe('XCellSelectionModel', function () {
});
it('do not notify onDragEnd', function () {
expect(grid.onDragEnd.notify).not.toHaveBeenCalled()
expect(grid.onDragEnd.notify).not.toHaveBeenCalled();
});
});
@@ -482,14 +483,14 @@ describe('XCellSelectionModel', function () {
});
function pressKey(keyCode) {
var pressEvent = new $.Event("keydown");
var pressEvent = new $.Event('keydown');
pressEvent.which = keyCode;
$(container.find('.grid-canvas')).trigger(pressEvent);
}
function pressShiftPlusKey(keyCode) {
var pressEvent = new $.Event("keydown");
var pressEvent = new $.Event('keydown');
pressEvent.shiftKey = true;
pressEvent.which = keyCode;