File tree Expand file tree Collapse file tree 7 files changed +77
-14
lines changed Expand file tree Collapse file tree 7 files changed +77
-14
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ gulp.task('umd', function() {
4848 name : '$' ,
4949 amd : 'jquery' ,
5050 cjs : 'jquery' ,
51- global : 'jquery '
51+ global : 'jQuery '
5252 } ] ;
5353 } ,
5454 exports : function ( ) {
Original file line number Diff line number Diff line change 31313232 },
3333 "devDependencies" : {
34+ "chai" : " ^2.3.0" ,
3435 "del" : " ^1.1.1" ,
3536 "gulp" : " ^3.8.11" ,
3637 "gulp-bump" : " ^0.3.0" ,
4142 "gulp-uglify" : " ^1.2.0" ,
4243 "gulp-umd" : " ^0.1.3" ,
4344 "gulp-util" : " ^3.0.4" ,
45+ "jsdom" : " ^3.x" ,
4446 "jshint-stylish" : " ^1.0.1" ,
47+ "mocha" : " ^2.2.4" ,
48+ "mocha-phantomjs" : " ^3.5.3" ,
4549 "mochify" : " ^2.8.1" ,
46- "phantomjs" : " ^1.9.16"
50+ "phantomjs" : " ^1.9.16" ,
51+ "requirejs" : " ^2.1.17"
4752 },
4853 "scripts" : {
49- "test" : " node_modules/.bin/mochify --phantomjs node_modules/.bin/phantomjs && gulp test" ,
54+ "test" : " npm run test-mocha && npm run test-phantom && npm run test-require && gulp test" ,
55+ "test-mocha" : " ./node_modules/.bin/mocha test/api.js test/angular.js" ,
56+ "test-require" : " ./node_modules/.bin/mochify --phantomjs ./node_modules/.bin/phantomjs ./test/test_browserify.js -R spec" ,
57+ "test-phantom" : " ./node_modules/.bin/mocha-phantomjs -p ./node_modules/.bin/phantomjs ./test/html/*.html" ,
5058 "build" : " gulp build"
5159 },
5260 "dependencies" : {
Original file line number Diff line number Diff line change 1+ require . config ( {
2+ baseUrl : "./" ,
3+ paths : {
4+ "jquery" : "../../node_modules/jquery/dist/jquery"
5+ }
6+ } ) ;
7+ require ( [ "../../dist/html.sortable.js" ] , function ( sortable ) {
8+ // test specific use cases
9+ describe ( "AMD" , function ( ) {
10+ it ( "should require jQuery" , function ( ) {
11+ assert . typeOf ( $ , "function" ) ;
12+ } ) ;
13+
14+ it ( "should define sortable" , function ( ) {
15+ assert . typeOf ( sortable , "function" ) ;
16+ } ) ;
17+
18+ it ( "should define $().sortable" , function ( ) {
19+ assert . typeOf ( $ ( ) . sortable , "function" ) ;
20+ } ) ;
21+
22+ } ) ;
23+
24+ if ( window . mochaPhantomJS ) { mochaPhantomJS . run ( ) ; }
25+ else { mocha . run ( ) ; }
26+ } ) ;
Original file line number Diff line number Diff line change 11// testing basic api
2+ var assert = require ( "chai" ) . assert ;
3+ var sortable ;
4+
5+ describe ( 'Basics' , function ( ) {
6+ before ( function ( ) {
7+ GLOBAL . document = require ( "jsdom" ) . jsdom ( '<html lang="en-US"></html>' ) ;
8+ GLOBAL . window = document . defaultView ;
9+ sortable = require ( "../dist/html.sortable.js" ) ;
10+ } ) ;
11+
12+ it ( 'sortable should be a function' , function ( ) {
13+ assert . typeOf ( sortable , "function" ) ;
14+ } ) ;
15+
16+ } )
Original file line number Diff line number Diff line change 1+ < meta http-equiv ="content-type " content ="text/html; charset=utf-8 " />
2+ < html >
3+ < body >
4+ < div id ="mocha "> </ div >
5+ < link rel ="stylesheet " href ="../../node_modules/mocha/mocha.css " />
6+ < script src ="../../node_modules/mocha/mocha.js "> </ script >
7+ < script src ="../../node_modules/chai/chai.js "> </ script >
8+ < script >
9+ mocha . ui ( 'bdd' ) ;
10+ mocha . reporter ( 'html' ) ;
11+ var assert = chai . assert ;
12+ </ script >
13+ < script data-main ="../amd.js " src ="../../node_modules/requirejs/require.js "> </ script >
14+ </ body >
15+ </ html >
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11assert = require ( 'assert' ) ;
22
33describe ( '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- } ) ;
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+ } ) ;
1414} ) ;
You can’t perform that action at this time.
0 commit comments