fix unit tests

This commit is contained in:
David Morse
2015-05-18 21:17:13 -06:00
parent de59d89933
commit 08da4a4d74
4 changed files with 16 additions and 3 deletions

View File

@@ -1203,7 +1203,7 @@
isDOM || ($el = wgd.el);
var empty_upper_row = this.can_go_widget_up(wgd);
if (this.shift_widgets_up && empty_upper_row) {
if (this.options.shift_widgets_up && empty_upper_row) {
wgd.row = empty_upper_row;
$el.attr('data-row', empty_upper_row);
this.$el.trigger('gridster:positionchanged', [wgd]);

View File

@@ -7,7 +7,7 @@ require.config({
baseUrl: '../src/',
paths: {
'QUnit': '../libs/qunit/qunit/qunit',
'jquery': '../libs/jquery/jquery',
'jquery': '../libs/jquery/dist/jquery',
'gridster': 'jquery.gridster'
},
map: {

View File

@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>gridster.js Test Suite</title>
<!-- Load JQuery dependency. -->
<script src="../libs/jquery/jquery.js"></script>
<script src="../libs/jquery/dist/jquery.js"></script>
<script>jQuery.noConflict()</script>
<!-- load the gridster source files, run the tests against the broken out javascipt in the source dir-->

View File

@@ -233,6 +233,19 @@
deepEqual(serialized, output);
});
test('When Adding widgets rows static placement is supported', 2, function () {
var input = [{col: 6, row: 3, size_x: 1, size_y: 1}];
var grid = this.el.gridster().data('gridster');
grid.options.shift_widgets_up = false;
//remove any widgets from the html config
grid.remove_all_widgets();
//make sure we are empty
equal(grid.get_num_widgets(), 0, 'Clearing the widgets to prepare for tests');
grid.add_widget('<li />', input[0].size_x, input[0].size_y, input[0].col, input[0].row);
var serialized = grid.serialize();
deepEqual(serialized, input);
});
test('When Adding widgets cols are respected', 2, function () {
var input = [{col: 6, row: 1, size_x: 1, size_y: 1}];
var grid = this.el.gridster().data('gridster');