Skip to content

Commit 7af6bf7

Browse files
author
David Morse
committed
Add unit testing for core API, ensure all demos work, and add unit testing to ensure they stay working.
1 parent 385cc75 commit 7af6bf7

14 files changed

+11562
-11105
lines changed

demos/expandable-widgets.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,20 @@ <h1>Expandable widgets</h1>
4141
<script type="text/javascript">
4242
var gridster;
4343

44-
$(function () {
45-
4644
gridster = $(".gridster ul").gridster({
4745
widget_base_dimensions: [100, 100],
4846
widget_margins: [5, 5],
4947
helper: 'clone'
5048
}).data('gridster');
5149

50+
gridster.$el.ready(function () {
5251

5352
// resize widgets on hover
5453
gridster.$el
55-
.on('mouseenter', '> li', function () {
54+
.on('mouseenter', 'li', function () {
5655
gridster.resize_widget($(this), 3, 3);
5756
})
58-
.on('mouseleave', '> li', function () {
57+
.on('mouseleave', 'li', function () {
5958
gridster.resize_widget($(this), 1, 1);
6059
});
6160

demos/grid-from-serialize.html

Lines changed: 8 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -28,54 +28,14 @@ <h1>Build grid from serialized positions</h1>
2828

2929
// same object than generated with gridster.serialize() method
3030
var serialization = [
31-
{
32-
col: 1,
33-
row: 1,
34-
size_x: 2,
35-
size_y: 2
36-
},
37-
{
38-
col: 3,
39-
row: 1,
40-
size_x: 1,
41-
size_y: 2
42-
},
43-
{
44-
col: 4,
45-
row: 1,
46-
size_x: 1,
47-
size_y: 1
48-
},
49-
{
50-
col: 2,
51-
row: 3,
52-
size_x: 3,
53-
size_y: 1
54-
},
55-
{
56-
col: 1,
57-
row: 4,
58-
size_x: 1,
59-
size_y: 1
60-
},
61-
{
62-
col: 1,
63-
row: 3,
64-
size_x: 1,
65-
size_y: 1
66-
},
67-
{
68-
col: 2,
69-
row: 4,
70-
size_x: 1,
71-
size_y: 1
72-
},
73-
{
74-
col: 2,
75-
row: 5,
76-
size_x: 1,
77-
size_y: 1
78-
}
31+
{ col: 1, row: 1, size_x: 2, size_y: 2 },
32+
{ col: 3, row: 1, size_x: 1, size_y: 2 },
33+
{ col: 4, row: 1, size_x: 1, size_y: 1 },
34+
{ col: 2, row: 3, size_x: 3, size_y: 1 },
35+
{ col: 1, row: 4, size_x: 1, size_y: 1 },
36+
{ col: 1, row: 3, size_x: 1, size_y: 1 },
37+
{ col: 2, row: 4, size_x: 1, size_y: 1 },
38+
{ col: 2, row: 5, size_x: 1, size_y: 1 }
7939
];
8040

8141

demos/resize-limits.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ <h1>Resize with limits</h1>
1616
<code>data-min-sizex</code> and <code>data-min-sizey</code> HTML attributes to limit widget dimensions when resizing.</p>
1717

1818
<p>If a global max_size is specified through the config option, can be overwrited in specified widgets with HTML data-attributes or using <code>set_widget_max_size</code>
19-
method.</p>
19+
method. This page has a global max limit of 4x4</p>
2020

2121

2222
<div class="gridster">
2323
<ul>
24-
<li data-row="1" data-col="1" data-sizex="2" data-sizey="2" data-max-sizex="2" data-max-sizey="6">
24+
<li data-row="1" data-col="1" data-sizex="2" data-sizey="6" data-min-sizex="2" data-min-sizey="6" data-max-sizex="2" data-max-sizey="6">
2525
0
2626
<br>
27-
<small>Overwrited to 2, 6</small>
27+
<small>Overridden to 2, 6</small>
2828
</li>
2929
<li data-row="1" data-col="3" data-sizex="1" data-sizey="2" data-max-sizex="6" data-max-sizey="2">
3030
1
3131
<br>
32-
<small>Overwrited max-size to 6, 2</small>
32+
<small>Overridden max-size to 6, 2</small>
3333
</li>
3434
<li data-row="1" data-col="4" data-sizex="1" data-sizey="1">2</li>
3535
<li data-row="3" data-col="2" data-sizex="3" data-sizey="1">3</li>
@@ -41,7 +41,7 @@ <h1>Resize with limits</h1>
4141
<li data-row="1" data-col="5" data-sizex="3" data-sizey="3" data-min-sizex="3" data-min-sizey="3">
4242
9
4343
<br>
44-
<small>Overwrited min-size to 3, 3</small>
44+
<small>Overridden min-size to 3, 3</small>
4545
</li>
4646
<li data-row="5" data-col="1" data-sizex="1" data-sizey="2">10</li>
4747
<li data-row="4" data-col="3" data-sizex="1" data-sizey="2">11</li>
@@ -59,7 +59,7 @@ <h1>Resize with limits</h1>
5959
$(function () {
6060

6161
gridster = $(".gridster ul").gridster({
62-
widget_base_dimensions: [100, 55],
62+
widget_base_dimensions: [100, 100],
6363
widget_margins: [5, 5],
6464
helper: 'clone',
6565
resize: {

demos/resize.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ <h1>Resize</h1>
4545
$(function () {
4646

4747
gridster = $(".gridster ul").gridster({
48-
widget_base_dimensions: [100, 55],
48+
widget_base_dimensions: [100, 100],
4949
widget_margins: [5, 5],
5050
helper: 'clone',
5151
resize: {

dist/jquery.gridster.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! gridster.js - v0.6.6 - 2015-04-10
1+
/*! gridster.js - v0.6.6 - 2015-04-12
22
* http://gridster.net/
33
* Copyright (c) 2015 ducksboard; Licensed MIT */
44

0 commit comments

Comments
 (0)