Merge pull request #364 from radiolips/tests/frontend-1
Fix _is_one_column_mode -> _isOneColumnMode and add in obsolete unit …
This commit is contained in:
commit
ba1ee253bb
2
dist/gridstack.js
vendored
2
dist/gridstack.js
vendored
|
@ -1466,7 +1466,7 @@
|
||||||
GridStack.prototype._update_container_height = obsolete(GridStack.prototype._updateContainerHeight,
|
GridStack.prototype._update_container_height = obsolete(GridStack.prototype._updateContainerHeight,
|
||||||
'_update_container_height', '_updateContainerHeight');
|
'_update_container_height', '_updateContainerHeight');
|
||||||
GridStack.prototype._is_one_column_mode = obsolete(GridStack.prototype._isOneColumnMode,
|
GridStack.prototype._is_one_column_mode = obsolete(GridStack.prototype._isOneColumnMode,
|
||||||
'_is_one_column_mode',' _isOneColumnMode');
|
'_is_one_column_mode','_isOneColumnMode');
|
||||||
GridStack.prototype._prepare_element = obsolete(GridStack.prototype._prepareElement,
|
GridStack.prototype._prepare_element = obsolete(GridStack.prototype._prepareElement,
|
||||||
'_prepare_element', '_prepareElement');
|
'_prepare_element', '_prepareElement');
|
||||||
GridStack.prototype.set_animation = obsolete(GridStack.prototype.setAnimation,
|
GridStack.prototype.set_animation = obsolete(GridStack.prototype.setAnimation,
|
||||||
|
|
2
dist/gridstack.min.js
vendored
2
dist/gridstack.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/gridstack.min.map
vendored
2
dist/gridstack.min.map
vendored
File diff suppressed because one or more lines are too long
|
@ -330,4 +330,305 @@ describe('gridstack', function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('grid.isAreaEmpty', function() {
|
||||||
|
beforeEach(function() {
|
||||||
|
document.body.insertAdjacentHTML(
|
||||||
|
'afterbegin', gridstackHTML);
|
||||||
|
});
|
||||||
|
afterEach(function() {
|
||||||
|
document.body.removeChild(document.getElementsByClassName('grid-stack')[0]);
|
||||||
|
});
|
||||||
|
it('should set return false.', function() {
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
var shouldBeFalse = grid.isAreaEmpty(1, 1, 1, 1);
|
||||||
|
expect(shouldBeFalse).toBe(false);
|
||||||
|
});
|
||||||
|
it('should set return true.', function() {
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
var shouldBeTrue = grid.isAreaEmpty(5, 5, 1, 1);
|
||||||
|
expect(shouldBeTrue).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('grid obsolete warnings', function() {
|
||||||
|
beforeEach(function() {
|
||||||
|
document.body.insertAdjacentHTML(
|
||||||
|
'afterbegin', gridstackHTML);
|
||||||
|
});
|
||||||
|
afterEach(function() {
|
||||||
|
document.body.removeChild(document.getElementsByClassName('grid-stack')[0]);
|
||||||
|
});
|
||||||
|
it('should log a warning if set_static is called.', function() {
|
||||||
|
console.warn = jasmine.createSpy('log');
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
grid.set_static(true);
|
||||||
|
expect(console.warn).toHaveBeenCalledWith('gridstack.js: Function `set_static` is deprecated as of v0.2.5 and has been replaced with `setStatic`. It will be **completely** removed in v1.0.');
|
||||||
|
});
|
||||||
|
it('should log a warning if _set_static_class is called.', function() {
|
||||||
|
console.warn = jasmine.createSpy('log');
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
grid._set_static_class();
|
||||||
|
expect(console.warn).toHaveBeenCalledWith('gridstack.js: Function `_set_static_class` is deprecated as of v0.2.5 and has been replaced with `_setStaticClass`. It will be **completely** removed in v1.0.');
|
||||||
|
});
|
||||||
|
it('should log a warning if is_area_empty is called.', function() {
|
||||||
|
console.warn = jasmine.createSpy('log');
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
grid.is_area_empty(1, 1, 1, 1);
|
||||||
|
expect(console.warn).toHaveBeenCalledWith('gridstack.js: Function `is_area_empty` is deprecated as of v0.2.5 and has been replaced with `isAreaEmpty`. It will be **completely** removed in v1.0.');
|
||||||
|
});
|
||||||
|
it('should log a warning if batch_update is called.', function() {
|
||||||
|
console.warn = jasmine.createSpy('log');
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
grid.batch_update();
|
||||||
|
expect(console.warn).toHaveBeenCalledWith('gridstack.js: Function `batch_update` is deprecated as of v0.2.5 and has been replaced with `batchUpdate`. It will be **completely** removed in v1.0.');
|
||||||
|
});
|
||||||
|
it('should log a warning if get_cell_from_pixel is called.', function() {
|
||||||
|
console.warn = jasmine.createSpy('log');
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
var pixel = {top: 100, left: 72};
|
||||||
|
grid.get_cell_from_pixel(pixel);
|
||||||
|
expect(console.warn).toHaveBeenCalledWith('gridstack.js: Function `get_cell_from_pixel` is deprecated as of v0.2.5 and has been replaced with `getCellFromPixel`. It will be **completely** removed in v1.0.');
|
||||||
|
});
|
||||||
|
it('should log a warning if cell_width is called.', function() {
|
||||||
|
console.warn = jasmine.createSpy('log');
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
grid.cell_width();
|
||||||
|
expect(console.warn).toHaveBeenCalledWith('gridstack.js: Function `cell_width` is deprecated as of v0.2.5 and has been replaced with `cellWidth`. It will be **completely** removed in v1.0.');
|
||||||
|
});
|
||||||
|
it('should log a warning if cell_height is called.', function() {
|
||||||
|
console.warn = jasmine.createSpy('log');
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
grid.cell_height();
|
||||||
|
expect(console.warn).toHaveBeenCalledWith('gridstack.js: Function `cell_height` is deprecated as of v0.2.5 and has been replaced with `cellHeight`. It will be **completely** removed in v1.0.');
|
||||||
|
});
|
||||||
|
it('should log a warning if _update_element is called.', function() {
|
||||||
|
console.warn = jasmine.createSpy('log');
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
grid._update_element();
|
||||||
|
expect(console.warn).toHaveBeenCalledWith('gridstack.js: Function `_update_element` is deprecated as of v0.2.5 and has been replaced with `_updateElement`. It will be **completely** removed in v1.0.');
|
||||||
|
});
|
||||||
|
it('should log a warning if min_width is called.', function() {
|
||||||
|
console.warn = jasmine.createSpy('log');
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
var items = $('.grid-stack-item');
|
||||||
|
for (var i = 0; i < items.length; i++) {
|
||||||
|
grid.min_width(items[i], 2);
|
||||||
|
}
|
||||||
|
expect(console.warn).toHaveBeenCalledWith('gridstack.js: Function `min_width` is deprecated as of v0.2.5 and has been replaced with `minWidth`. It will be **completely** removed in v1.0.');
|
||||||
|
});
|
||||||
|
it('should log a warning if min_height is called.', function() {
|
||||||
|
console.warn = jasmine.createSpy('log');
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
var items = $('.grid-stack-item');
|
||||||
|
for (var i = 0; i < items.length; i++) {
|
||||||
|
grid.min_height(items[i], 2);
|
||||||
|
}
|
||||||
|
expect(console.warn).toHaveBeenCalledWith('gridstack.js: Function `min_height` is deprecated as of v0.2.5 and has been replaced with `minHeight`. It will be **completely** removed in v1.0.');
|
||||||
|
});
|
||||||
|
it('should log a warning if remove_all is called.', function() {
|
||||||
|
console.warn = jasmine.createSpy('log');
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
grid.remove_all();
|
||||||
|
expect(console.warn).toHaveBeenCalledWith('gridstack.js: Function `remove_all` is deprecated as of v0.2.5 and has been replaced with `removeAll`. It will be **completely** removed in v1.0.');
|
||||||
|
});
|
||||||
|
it('should log a warning if remove_widget is called.', function() {
|
||||||
|
console.warn = jasmine.createSpy('log');
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
var items = $('.grid-stack-item');
|
||||||
|
for (var i = 0; i < items.length; i++) {
|
||||||
|
grid.remove_widget(items[i]);
|
||||||
|
}
|
||||||
|
expect(console.warn).toHaveBeenCalledWith('gridstack.js: Function `remove_widget` is deprecated as of v0.2.5 and has been replaced with `removeWidget`. It will be **completely** removed in v1.0.');
|
||||||
|
});
|
||||||
|
it('should log a warning if will_it_fit is called.', function() {
|
||||||
|
console.warn = jasmine.createSpy('log');
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
grid.will_it_fit(0, 0, 1, 1, false);
|
||||||
|
expect(console.warn).toHaveBeenCalledWith('gridstack.js: Function `will_it_fit` is deprecated as of v0.2.5 and has been replaced with `willItFit`. It will be **completely** removed in v1.0.');
|
||||||
|
});
|
||||||
|
it('should log a warning if make_widget is called.', function() {
|
||||||
|
console.warn = jasmine.createSpy('log');
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
var items = $('.grid-stack-item');
|
||||||
|
for (var i = 0; i < items.length; i++) {
|
||||||
|
grid.make_widget(items[i]);
|
||||||
|
}
|
||||||
|
expect(console.warn).toHaveBeenCalledWith('gridstack.js: Function `make_widget` is deprecated as of v0.2.5 and has been replaced with `makeWidget`. It will be **completely** removed in v1.0.');
|
||||||
|
});
|
||||||
|
it('should log a warning if add_widget is called.', function() {
|
||||||
|
console.warn = jasmine.createSpy('log');
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
var items = $('.grid-stack-item');
|
||||||
|
for (var i = 0; i < items.length; i++) {
|
||||||
|
grid.add_widget(items[i]);
|
||||||
|
}
|
||||||
|
expect(console.warn).toHaveBeenCalledWith('gridstack.js: Function `add_widget` is deprecated as of v0.2.5 and has been replaced with `addWidget`. It will be **completely** removed in v1.0.');
|
||||||
|
});
|
||||||
|
it('should log a warning if set_animation is called.', function() {
|
||||||
|
console.warn = jasmine.createSpy('log');
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
grid.set_animation(true);
|
||||||
|
expect(console.warn).toHaveBeenCalledWith('gridstack.js: Function `set_animation` is deprecated as of v0.2.5 and has been replaced with `setAnimation`. It will be **completely** removed in v1.0.');
|
||||||
|
});
|
||||||
|
it('should log a warning if _prepare_element is called.', function() {
|
||||||
|
console.warn = jasmine.createSpy('log');
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
var items = $('.grid-stack-item');
|
||||||
|
for (var i = 0; i < items.length; i++) {
|
||||||
|
grid._prepare_element(items[i]);
|
||||||
|
}
|
||||||
|
expect(console.warn).toHaveBeenCalledWith('gridstack.js: Function `_prepare_element` is deprecated as of v0.2.5 and has been replaced with `_prepareElement`. It will be **completely** removed in v1.0.');
|
||||||
|
});
|
||||||
|
it('should log a warning if _is_one_column_mode is called.', function() {
|
||||||
|
console.warn = jasmine.createSpy('log');
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
grid._is_one_column_mode();
|
||||||
|
expect(console.warn).toHaveBeenCalledWith('gridstack.js: Function `_is_one_column_mode` is deprecated as of v0.2.5 and has been replaced with `_isOneColumnMode`. It will be **completely** removed in v1.0.');
|
||||||
|
});
|
||||||
|
it('should log a warning if _update_container_height is called.', function() {
|
||||||
|
console.warn = jasmine.createSpy('log');
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
grid._update_container_height();
|
||||||
|
expect(console.warn).toHaveBeenCalledWith('gridstack.js: Function `_update_container_height` is deprecated as of v0.2.5 and has been replaced with `_updateContainerHeight`. It will be **completely** removed in v1.0.');
|
||||||
|
});
|
||||||
|
it('should log a warning if _update_styles is called.', function() {
|
||||||
|
console.warn = jasmine.createSpy('log');
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
grid._update_styles();
|
||||||
|
expect(console.warn).toHaveBeenCalledWith('gridstack.js: Function `_update_styles` is deprecated as of v0.2.5 and has been replaced with `_updateStyles`. It will be **completely** removed in v1.0.');
|
||||||
|
});
|
||||||
|
it('should log a warning if _init_styles is called.', function() {
|
||||||
|
console.warn = jasmine.createSpy('log');
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
grid._init_styles();
|
||||||
|
expect(console.warn).toHaveBeenCalledWith('gridstack.js: Function `_init_styles` is deprecated as of v0.2.5 and has been replaced with `_initStyles`. It will be **completely** removed in v1.0.');
|
||||||
|
});
|
||||||
|
it('should log a warning if _trigger_change_event is called.', function() {
|
||||||
|
console.warn = jasmine.createSpy('log');
|
||||||
|
var options = {
|
||||||
|
cellHeight: 80,
|
||||||
|
verticalMargin: 10
|
||||||
|
};
|
||||||
|
$('.grid-stack').gridstack(options);
|
||||||
|
var grid = $('.grid-stack').data('gridstack');
|
||||||
|
grid._trigger_change_event();
|
||||||
|
expect(console.warn).toHaveBeenCalledWith('gridstack.js: Function `_trigger_change_event` is deprecated as of v0.2.5 and has been replaced with `_triggerChangeEvent`. It will be **completely** removed in v1.0.');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1466,7 +1466,7 @@
|
||||||
GridStack.prototype._update_container_height = obsolete(GridStack.prototype._updateContainerHeight,
|
GridStack.prototype._update_container_height = obsolete(GridStack.prototype._updateContainerHeight,
|
||||||
'_update_container_height', '_updateContainerHeight');
|
'_update_container_height', '_updateContainerHeight');
|
||||||
GridStack.prototype._is_one_column_mode = obsolete(GridStack.prototype._isOneColumnMode,
|
GridStack.prototype._is_one_column_mode = obsolete(GridStack.prototype._isOneColumnMode,
|
||||||
'_is_one_column_mode',' _isOneColumnMode');
|
'_is_one_column_mode','_isOneColumnMode');
|
||||||
GridStack.prototype._prepare_element = obsolete(GridStack.prototype._prepareElement,
|
GridStack.prototype._prepare_element = obsolete(GridStack.prototype._prepareElement,
|
||||||
'_prepare_element', '_prepareElement');
|
'_prepare_element', '_prepareElement');
|
||||||
GridStack.prototype.set_animation = obsolete(GridStack.prototype.setAnimation,
|
GridStack.prototype.set_animation = obsolete(GridStack.prototype.setAnimation,
|
||||||
|
|
Loading…
Reference in a new issue