From: Mike Sherov Date: Mon, 10 Feb 2014 22:43:24 +0000 (-0800) Subject: Merge branch 'master' into interactions X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c15481eeb1806938ce2b3adfa1866e5a8a78fa31;p=jquery-ui.git Merge branch 'master' into interactions Conflicts: demos/draggable/constrain-movement.html demos/draggable/cursor-style.html demos/draggable/default.html demos/draggable/events.html demos/draggable/handle.html demos/draggable/revert.html demos/draggable/visual-feedback.html demos/droppable/default.html grunt.js tests/unit/draggable/draggable.html tests/unit/draggable/draggable_core.js tests/unit/draggable/draggable_options.js tests/unit/draggable/draggable_test_helpers.js tests/unit/droppable/droppable.html tests/unit/droppable/droppable_options.js ui/draggable.js ui/jquery.ui.droppable.js ui/sortable.js --- c15481eeb1806938ce2b3adfa1866e5a8a78fa31 diff --cc Gruntfile.js index 000000000,545329df0..ac9fa9cb8 mode 000000,100644..100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@@ -1,0 -1,230 +1,231 @@@ + module.exports = function( grunt ) { + + "use strict"; + + var + // files + coreFiles = [ + "core.js", + "widget.js", + "mouse.js", ++ "interaction.js", + "draggable.js", + "droppable.js", + "resizable.js", + "selectable.js", + "sortable.js", + "effect.js" + ], + + uiFiles = coreFiles.map(function( file ) { + return "ui/" + file; + }).concat( expandFiles( "ui/*.js" ).filter(function( file ) { + return coreFiles.indexOf( file.substring( 3 ) ) === -1; + }) ), + + allI18nFiles = expandFiles( "ui/i18n/*.js" ), + + cssFiles = [ + "core", + "accordion", + "autocomplete", + "button", + "datepicker", + "dialog", + "menu", + "progressbar", + "resizable", + "selectable", + "selectmenu", + "slider", + "spinner", + "tabs", + "tooltip", + "theme" + ].map(function( component ) { + return "themes/base/" + component + ".css"; + }), + + // minified files + minify = { + options: { + preserveComments: false + }, + main: { + options: { + banner: createBanner( uiFiles ) + }, + files: { + "dist/jquery-ui.min.js": "dist/jquery-ui.js" + } + }, + i18n: { + options: { + banner: createBanner( allI18nFiles ) + }, + files: { + "dist/i18n/jquery-ui-i18n.min.js": "dist/i18n/jquery-ui-i18n.js" + } + } + }, + + compareFiles = { + all: [ + "dist/jquery-ui.js", + "dist/jquery-ui.min.js" + ] + }; + + function mapMinFile( file ) { + return "dist/" + file.replace( /\.js$/, ".min.js" ).replace( /ui\//, "minified/" ); + } + + function expandFiles( files ) { + return grunt.util._.pluck( grunt.file.expandMapping( files ), "src" ).map(function( values ) { + return values[ 0 ]; + }); + } + + uiFiles.concat( allI18nFiles ).forEach(function( file ) { + minify[ file ] = { + options: { + banner: createBanner() + }, + files: {} + }; + minify[ file ].files[ mapMinFile( file ) ] = file; + }); + + uiFiles.forEach(function( file ) { + // TODO this doesn't do anything until https://github.com/rwldrn/grunt-compare-size/issues/13 + compareFiles[ file ] = [ file, mapMinFile( file ) ]; + }); + + // grunt plugins + grunt.loadNpmTasks( "grunt-contrib-jshint" ); + grunt.loadNpmTasks( "grunt-contrib-uglify" ); + grunt.loadNpmTasks( "grunt-contrib-concat" ); + grunt.loadNpmTasks( "grunt-contrib-qunit" ); + grunt.loadNpmTasks( "grunt-contrib-csslint" ); + grunt.loadNpmTasks( "grunt-jscs-checker" ); + grunt.loadNpmTasks( "grunt-html" ); + grunt.loadNpmTasks( "grunt-compare-size" ); + grunt.loadNpmTasks( "grunt-git-authors" ); + grunt.loadNpmTasks( "grunt-esformatter" ); + // local testswarm and build tasks + grunt.loadTasks( "build/tasks" ); + + function stripDirectory( file ) { + return file.replace( /.+\/(.+?)>?$/, "$1" ); + } + + function createBanner( files ) { + // strip folders + var fileNames = files && files.map( stripDirectory ); + return "/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - " + + "<%= grunt.template.today('isoDate') %>\n" + + "<%= pkg.homepage ? '* ' + pkg.homepage + '\\n' : '' %>" + + (files ? "* Includes: " + fileNames.join(", ") + "\n" : "") + + "* Copyright <%= grunt.template.today('yyyy') %> <%= pkg.author.name %>;" + + " Licensed <%= _.pluck(pkg.licenses, 'type').join(', ') %> */\n"; + } + + grunt.initConfig({ + pkg: grunt.file.readJSON( "package.json" ), + files: { + dist: "<%= pkg.name %>-<%= pkg.version %>" + }, + compare_size: compareFiles, + concat: { + ui: { + options: { + banner: createBanner( uiFiles ), + stripBanners: { + block: true + } + }, + src: uiFiles, + dest: "dist/jquery-ui.js" + }, + i18n: { + options: { + banner: createBanner( allI18nFiles ) + }, + src: allI18nFiles, + dest: "dist/i18n/jquery-ui-i18n.js" + }, + css: { + options: { + banner: createBanner( cssFiles ), + stripBanners: { + block: true + } + }, + src: cssFiles, + dest: "dist/jquery-ui.css" + } + }, + jscs: { + // datepicker, sortable, resizable and draggable are getting rewritten, ignore until that's done + ui: [ "ui/*.js", "!ui/datepicker.js", "!ui/sortable.js", "!ui/resizable.js", "!ui/draggable.js" ], + // TODO enable this once we have a tool that can help with fixing formatting of existing files + // tests: "tests/unit/**/*.js", + grunt: "Gruntfile.js" + }, + uglify: minify, + htmllint: { + // ignore files that contain invalid html, used only for ajax content testing + all: grunt.file.expand( [ "demos/**/*.html", "tests/**/*.html" ] ).filter(function( file ) { + return !/(?:ajax\/content\d\.html|tabs\/data\/test\.html|tests\/unit\/core\/core.*\.html)/.test( file ); + }) + }, + qunit: { + files: expandFiles( "tests/unit/**/*.html" ).filter(function( file ) { + // disabling everything that doesn't (quite) work with PhantomJS for now + // TODO except for all|index|test, try to include more as we go + return !( /(all|index|test|dialog|tooltip)\.html$/ ).test( file ); + }) + }, + jshint: { + options: { + jshintrc: true + }, + all: [ + "ui/*.js", + "Gruntfile.js", + "build/**/*.js", + "tests/unit/**/*.js" + ] + }, + csslint: { + base_theme: { + src: "themes/base/*.css", + options: { + csslintrc: ".csslintrc" + } + } + }, + + esformatter: { + options: { + preset: "jquery" + }, + ui: "ui/*.js", + tests: "tests/unit/**/*.js", + build: { + options: { + skipHashbang: true + }, + src: "build/**/*.js" + }, + grunt: "Gruntfile.js" + } + }); + + grunt.registerTask( "default", [ "lint", "test" ]); + grunt.registerTask( "lint", [ "asciilint", "jshint", "jscs", "csslint", "htmllint" ]); + grunt.registerTask( "test", [ "qunit" ]); + grunt.registerTask( "sizer", [ "concat:ui", "uglify:main", "compare_size:all" ]); + grunt.registerTask( "sizer_all", [ "concat:ui", "uglify", "compare_size" ]); + + }; diff --cc demos/draggable/constrain-movement.html index c29576e50,1dcab0213..e46fb7b27 --- a/demos/draggable/constrain-movement.html +++ b/demos/draggable/constrain-movement.html @@@ -3,12 -3,12 +3,12 @@@ jQuery UI Draggable - Constrain movement - - - - - - + + + + - ++ + + + + + +
+ Map of Vienna +
+ +
+

Drag the map around inside the viewport. Works with touch devices. The container is kept small for the demo to work.

+
+ + diff --cc demos/draggable/revert.html index 0fd5d04ce,7ccccdf55..121aeef74 --- a/demos/draggable/revert.html +++ b/demos/draggable/revert.html @@@ -3,15 -3,15 +3,15 @@@ jQuery UI Draggable - Revert position - - - - - - + + + + - ++ + - - - - + + + + - ++ + + + + + +
+ +
+ +
+ + +
-

This demo shows how you can create a simple box-drawing (aka lasso) interaction built on top of the interaction utility (jquery.ui.interaction.js).

++

This demo shows how you can create a simple box-drawing (aka lasso) interaction built on top of the interaction utility (interaction.js).

+

Draw a box by starting in the box above using the mouse or a touch input device.

+
+ + + diff --cc demos/interaction/default.html index 4f69b20e1,000000000..2b8b92bb0 mode 100644,000000..100644 --- a/demos/interaction/default.html +++ b/demos/interaction/default.html @@@ -1,63 -1,0 +1,63 @@@ + + + + + jQuery UI Interaction - Default functionality - - - - - ++ ++ ++ ++ ++ + + + + + + +
+ +
+ +
+
Start:
+
0
+
Move:
+
0
+
Stop:
+
0
+
+ +
+ + +
+

This demo shows a simple interaction built using the interaction utility (jquery.ui.interaction.js).

+

Make a down-move-up motion starting on the blue box above using the mouse or a touch input device to see the interaction events

+
+ + + diff --cc tests/unit/draggable/draggable.html index c6f16ee17,02977c6cc..1a381e314 --- a/tests/unit/draggable/draggable.html +++ b/tests/unit/draggable/draggable.html @@@ -17,18 -53,18 +53,20 @@@ ++ diff --cc tests/unit/draggable/draggable_core.js index 9875a481e,7df0969b1..9e977b52d --- a/tests/unit/draggable/draggable_core.js +++ b/tests/unit/draggable/draggable_core.js @@@ -59,111 -48,243 +48,323 @@@ test( "No options, relative", function( }); test( "No options, absolute", function() { - expect( 1 ); - TestHelpers.draggable.shouldMove( absoluteElement.draggable() ); + expect( 2 ); + TestHelpers.draggable.shouldMove( $( "#draggable2" ).draggable(), "no options, absolute" ); }); --test( "resizable handle with complex markup (#8756 / #8757)", function() { -- expect( 2 ); ++//TODO: re-enable when resizable is ported to interactions ++// test( "resizable handle with complex markup (#8756 / #8757)", function() { ++// expect( 2 ); + - relativeElement - .append( - $("
") - .addClass("ui-resizable-handle ui-resizable-w") - .append( $("
") ) - ); ++// $( "#draggable1" ) ++// .append( ++// $("
") ++// .addClass("ui-resizable-handle ui-resizable-w") ++// .append( $("
") ) ++// ); + - var handle = $(".ui-resizable-w div"), - target = relativeElement.draggable().resizable({ handles: "all" }); ++// var handle = $(".ui-resizable-w div"), ++// target = $( "#draggable1" ).draggable().resizable({ handles: "all" }); + - // todo: fix resizable so it doesn't require a mouseover - handle.simulate("mouseover").simulate( "drag", { dx: -50 } ); - equal( target.width(), 250, "compare width" ); ++// // todo: fix resizable so it doesn't require a mouseover ++// handle.simulate("mouseover").simulate( "drag", { dx: -50 } ); ++// equal( target.width(), 250, "compare width" ); + - // todo: fix resizable so it doesn't require a mouseover - handle.simulate("mouseover").simulate( "drag", { dx: 50 } ); - equal( target.width(), 200, "compare width" ); - }); ++// // todo: fix resizable so it doesn't require a mouseover ++// handle.simulate("mouseover").simulate( "drag", { dx: 50 } ); ++// equal( target.width(), 200, "compare width" ); ++// }); + +test("_blockFrames, absolute parent", function() { + expect( 3 ); + var el = $("#draggable1").draggable(), + parent = $("
"), + iframe = $("