Merge commit '93bedb4404597ab74426141aa3aec27ef6134dd1'

This commit is contained in:
d 2016-03-02 08:03:21 -05:00
commit 61fc120b11
11 changed files with 186 additions and 10 deletions

3
.gitignore vendored
View file

@ -1,3 +1,4 @@
node_modules
bower_components
coverage
coverage
*.log

View file

@ -1,11 +1,35 @@
language: node_js
node_js:
- "5.7.0"
env:
- CXX=g++-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
before_install:
- npm install -g protractor
install:
- npm install -g npm@2
- npm install -g grunt-cli
- npm install -g bower
- bower install
- npm install
- ./node_modules/protractor/bin/webdriver-manager update --standalone
before_script:
- npm install -g grunt-cli
- npm install -g bower
- bower install
- npm install
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
script:
- npm run build
- npm test
- npm run build
- npm test
- grunt e2e-test

View file

@ -1,3 +1,4 @@
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-cssmin');
@ -7,6 +8,9 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-jscs');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-protractor-runner');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-protractor-webdriver');
grunt.initConfig({
sass: {
@ -95,7 +99,33 @@ module.exports = function(grunt) {
},
},
},
protractor: {
options: {
configFile: 'protractor.conf.js',
},
all: {}
},
connect: {
all: {
options: {
port: 8080,
hostname: 'localhost',
base: '.',
},
},
},
protractor_webdriver: {
all: {
options: {
command: 'webdriver-manager start',
}
}
}
});
grunt.registerTask('default', ['sass', 'cssmin', 'jshint', 'jscs', 'copy', 'uglify', 'doctoc']);
grunt.registerTask('e2e-test', ['connect', 'protractor_webdriver', 'protractor']);
};

4
dist/gridstack.js vendored
View file

@ -367,6 +367,10 @@
return $.extend({}, n);
}));
if (typeof clonedNode === 'undefined') {
return true;
}
clone.moveNode(clonedNode, x, y, width, height);
var res = true;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -30,8 +30,10 @@
"lodash": "^4.5.1"
},
"devDependencies": {
"connect": "^3.4.1",
"coveralls": "^2.11.6",
"grunt": "^0.4.5",
"grunt-contrib-connect": "^0.11.2",
"grunt-contrib-copy": "^0.8.2",
"grunt-contrib-cssmin": "^0.14.0",
"grunt-contrib-jshint": "^1.0.0",
@ -39,6 +41,8 @@
"grunt-contrib-watch": "^0.6.1",
"grunt-doctoc": "^0.1.1",
"grunt-jscs": "^2.7.0",
"grunt-protractor-runner": "^3.0.0",
"grunt-protractor-webdriver": "^0.2.5",
"grunt-sass": "^1.1.0",
"jasmine-core": "^2.4.1",
"karma": "^0.13.21",
@ -46,6 +50,7 @@
"karma-coveralls": "^1.1.2",
"karma-jasmine": "^0.3.7",
"karma-phantomjs-launcher": "^1.0.0",
"phantomjs": "^2.1.3"
"phantomjs-prebuilt": "^2.1.4",
"serve-static": "^1.10.2"
}
}

12
protractor.conf.js Normal file
View file

@ -0,0 +1,12 @@
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec/e2e/*-spec.js'],
capabilities: {
browserName: 'firefox',
version: '',
platform: 'ANY',
loggingPrefs: {
browser: 'SEVERE'
}
},
};

View file

@ -0,0 +1,24 @@
describe('gridstack.js with height', function() {
beforeAll(function() {
browser.ignoreSynchronization = true;
});
beforeEach(function() {
browser.get('http://localhost:8080/spec/e2e/html/gridstack-with-height.html');
});
it('shouldn\'t throw exeption when dragging widget outside the grid', function() {
var widget = element(by.id('item-1'));
var gridContainer = element(by.id('grid'));
browser.actions()
.mouseDown(widget, {x: 20, y: 20})
.mouseMove(gridContainer, {x: 300, y: 20})
.mouseUp()
.perform();
browser.manage().logs().get('browser').then(function(browserLog) {
expect(browserLog.length).toEqual(0);
});
});
});

View file

@ -0,0 +1,72 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>gridstack.js tests</title>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="../../../dist/gridstack.css"/>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.0/jquery-ui.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script>
<script src="../../../dist/gridstack.js"></script>
<style type="text/css">
.grid-stack {
background: lightgoldenrodyellow;
}
.grid-stack-item-content {
color: #2c3e50;
text-align: center;
background-color: #18bc9c;
}
</style>
</head>
<body>
<div class="container-fluid">
<h1>gridstack.js tests</h1>
<br/>
<div class="grid-stack" id="grid">
</div>
</div>
<script type="text/javascript">
$(function() {
var options = {
height: 5
};
$('.grid-stack').gridstack(options);
new function() {
var items = [
{x: 0, y: 0, width: 2, height: 2},
{x: 2, y: 5, width: 1, height: 1}
];
this.grid = $('.grid-stack').data('gridstack');
this.grid.removeAll();
items = GridStackUI.Utils.sort(items);
var id = 0;
_.each(items, function(node) {
var w = $('<div><div class="grid-stack-item-content" /><div/>');
w.attr('id', 'item-' + (++id));
this.grid.addWidget(w,
node.x, node.y, node.width, node.height);
}, this);
};
});
</script>
</body>
</html>

View file

@ -367,6 +367,10 @@
return $.extend({}, n);
}));
if (typeof clonedNode === 'undefined') {
return true;
}
clone.moveNode(clonedNode, x, y, width, height);
var res = true;