Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e4fecff

Browse files
committed
error with setup height
1 parent 208a8ba commit e4fecff

File tree

3 files changed

+91
-5
lines changed

3 files changed

+91
-5
lines changed

protractor.conf.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ exports.config = {
44
capabilities: {
55
browserName: 'firefox',
66
version: '',
7-
platform: 'ANY'
7+
platform: 'ANY',
8+
loggingPrefs: {
9+
browser: 'SEVERE'
10+
}
811
},
912
};

spec/e2e/gridstack-spec.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
1-
describe('gridstack.js two grids demo', function() {
1+
describe('gridstack.js with height', function() {
22
beforeAll(function() {
33
browser.ignoreSynchronization = true;
44
});
55

66
beforeEach(function() {
7-
browser.get('http://localhost:8080/demo/two.html');
7+
browser.get('http://localhost:8080/spec/e2e/html/gridstack-with-height.html');
88
});
99

10-
it('should have proper title', function() {
11-
expect(browser.getTitle()).toEqual('Two grids demo');
10+
it('shouldn\'t throw exeption when dragging widget outside the grid', function() {
11+
var widget = element(by.id('item-1'));
12+
var gridContainer = element(by.id('grid'));
13+
14+
browser.actions()
15+
.mouseDown(widget, {x: 20, y: 20})
16+
.mouseMove(gridContainer, {x: 300, y: 20})
17+
.mouseUp()
18+
.perform();
19+
20+
browser.manage().logs().get('browser').then(function(browserLog) {
21+
expect(browserLog.length).toEqual(0);
22+
});
1223
});
1324
});
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<!--[if lt IE 9]>
5+
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
6+
<![endif]-->
7+
8+
<meta charset="utf-8">
9+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
10+
<meta name="viewport" content="width=device-width, initial-scale=1">
11+
<title>gridstack.js tests</title>
12+
13+
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
14+
<link rel="stylesheet" href="../../../dist/gridstack.css"/>
15+
16+
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
17+
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.0/jquery-ui.js"></script>
18+
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
19+
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script>
20+
<script src="../../../dist/gridstack.js"></script>
21+
22+
<style type="text/css">
23+
.grid-stack {
24+
background: lightgoldenrodyellow;
25+
}
26+
27+
.grid-stack-item-content {
28+
color: #2c3e50;
29+
text-align: center;
30+
background-color: #18bc9c;
31+
}
32+
</style>
33+
</head>
34+
<body>
35+
<div class="container-fluid">
36+
<h1>gridstack.js tests</h1>
37+
38+
<br/>
39+
40+
<div class="grid-stack" id="grid">
41+
</div>
42+
</div>
43+
44+
45+
<script type="text/javascript">
46+
$(function() {
47+
var options = {
48+
height: 5
49+
};
50+
$('.grid-stack').gridstack(options);
51+
52+
new function() {
53+
var items = [
54+
{x: 0, y: 0, width: 2, height: 2},
55+
{x: 2, y: 5, width: 1, height: 1}
56+
];
57+
58+
this.grid = $('.grid-stack').data('gridstack');
59+
this.grid.removeAll();
60+
items = GridStackUI.Utils.sort(items);
61+
var id = 0;
62+
_.each(items, function(node) {
63+
var w = $('<div><div class="grid-stack-item-content" /><div/>');
64+
w.attr('id', 'item-' + (++id));
65+
this.grid.addWidget(w,
66+
node.x, node.y, node.width, node.height);
67+
}, this);
68+
};
69+
});
70+
</script>
71+
</body>
72+
</html>

0 commit comments

Comments
 (0)