Skip to content

Commit 21d5c23

Browse files
jacobsvanteLukas Oppermann
authored andcommitted
Test browserify support
Probably useful for other node-using bundlers as well
1 parent bae666b commit 21d5c23

File tree

5 files changed

+22
-5
lines changed

5 files changed

+22
-5
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: node_js
22
node_js:
3-
- "0.10"
4-
- "0.8"
3+
- "node"
54
- "iojs"
65
before_install: npm install
76
before_script: npm run build

gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,4 @@ gulp.task('bump-version', function() {
9292
/* ---------- */
9393
/* tasks */
9494
gulp.task('test', ['lint']);
95-
gulp.task('build', ['test', 'umd', 'build-version']);
95+
gulp.task('build', ['umd', 'build-version', 'test']);

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "html5sortable",
3-
"main": "dist/html.sortable.min.js",
3+
"main": "dist/html.sortable.js",
44
"version": "0.2.3",
55
"license": "MIT",
66
"description": "Lightweight jQuery plugin to create sortable lists and grids using native HTML5 drag and drop API.",
@@ -48,5 +48,8 @@
4848
"scripts": {
4949
"test": "node_modules/.bin/mochify --phantomjs node_modules/.bin/phantomjs && gulp test",
5050
"build": "gulp build"
51+
},
52+
"dependencies": {
53+
"jquery": "^2.1.4"
5154
}
5255
}

src/html.sortable.src.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ var sortable = function(options) {
2222
placeholderClass: 'sortable-placeholder',
2323
draggingClass: 'sortable-dragging'
2424
}, options);
25-
25+
/* TODO: maxstatements should be 25, fix and remove line below */
26+
/*jshint maxstatements:false */
2627
return this.each(function() {
2728

2829
var index;

test/test_browserify.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
assert = require('assert');
2+
3+
describe('Browserify', function(){
4+
it('should be able to require jquery', function() {
5+
require('jquery');
6+
});
7+
it('should be able to require html.sortable', function() {
8+
require('../dist/html.sortable.js');
9+
});
10+
it('should find the exported function on a jQuery object', function() {
11+
var $ = require('jquery');
12+
assert.equal((typeof $().sortable), 'function');
13+
});
14+
});

0 commit comments

Comments
 (0)