From 94ec84e7b9c89358dc00e4039009af9e287bbd05 Mon Sep 17 00:00:00 2001 From: Brian Ford Date: Fri, 9 Aug 2013 10:02:48 -0700 Subject: [PATCH] chore(ngMobile): rename module ngTouch and file to angular-touch.js BREAKING CHANGE: since all the code in the ngMobile module is touch related, we are renaming the module to ngTouch. To migrate, please replace all references to "ngMobile" with "ngTouch" and "angular-mobile.js" to "angular-touch.js". Closes #3526 --- Gruntfile.js | 14 +++++++------- angularFiles.js | 12 ++++++------ docs/src/templates/index.html | 2 +- karma-docs.conf.js | 2 +- src/{ngMobile => ngTouch}/directive/ngClick.js | 6 +++--- src/{ngMobile => ngTouch}/directive/ngSwipe.js | 6 +++--- src/{ngMobile => ngTouch}/swipe.js | 10 +++++----- src/{ngMobile/mobile.js => ngTouch/touch.js} | 6 +++--- .../{ngMobile => ngTouch}/directive/ngClickSpec.js | 4 ++-- .../{ngMobile => ngTouch}/directive/ngSwipeSpec.js | 2 +- test/{ngMobile => ngTouch}/swipeSpec.js | 2 +- 11 files changed, 33 insertions(+), 33 deletions(-) rename src/{ngMobile => ngTouch}/directive/ngClick.js (98%) rename src/{ngMobile => ngTouch}/directive/ngSwipe.js (96%) rename src/{ngMobile => ngTouch}/swipe.js (96%) rename src/{ngMobile/mobile.js => ngTouch/touch.js} (64%) rename test/{ngMobile => ngTouch}/directive/ngClickSpec.js (99%) rename test/{ngMobile => ngTouch}/directive/ngSwipeSpec.js (99%) rename test/{ngMobile => ngTouch}/swipeSpec.js (99%) diff --git a/Gruntfile.js b/Gruntfile.js index 6416352592c7..b9aba806a116 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -124,13 +124,13 @@ module.exports = function(grunt) { dest: 'build/angular-loader.js', src: util.wrap(['src/loader.js'], 'loader') }, - mobile: { - dest: 'build/angular-mobile.js', + touch: { + dest: 'build/angular-touch.js', src: util.wrap([ - 'src/ngMobile/mobile.js', - 'src/ngMobile/swipe.js', - 'src/ngMobile/directive/ngClick.js', - 'src/ngMobile/directive/ngSwipe.js' + 'src/ngTouch/touch.js', + 'src/ngTouch/swipe.js', + 'src/ngTouch/directive/ngClick.js', + 'src/ngTouch/directive/ngSwipe.js' ], 'module') }, mocks: { @@ -174,7 +174,7 @@ module.exports = function(grunt) { animate: 'build/angular-animate.js', cookies: 'build/angular-cookies.js', loader: 'build/angular-loader.js', - mobile: 'build/angular-mobile.js', + touch: 'build/angular-touch.js', resource: 'build/angular-resource.js', route: 'build/angular-route.js', sanitize: 'build/angular-sanitize.js' diff --git a/angularFiles.js b/angularFiles.js index 60bae40a40f9..a8509b3f28ff 100755 --- a/angularFiles.js +++ b/angularFiles.js @@ -75,10 +75,10 @@ angularFiles = { 'src/ngSanitize/sanitize.js', 'src/ngSanitize/filter/linky.js', 'src/ngMock/angular-mocks.js', - 'src/ngMobile/mobile.js', - 'src/ngMobile/swipe.js', - 'src/ngMobile/directive/ngClick.js', - 'src/ngMobile/directive/ngSwipe.js', + 'src/ngTouch/touch.js', + 'src/ngTouch/swipe.js', + 'src/ngTouch/directive/ngClick.js', + 'src/ngTouch/directive/ngSwipe.js', 'docs/components/angular-bootstrap/bootstrap.js' ], @@ -113,7 +113,7 @@ angularFiles = { 'test/ngRoute/**/*.js', 'test/ngSanitize/**/*.js', 'test/ngMock/*.js', - 'test/ngMobile/**/*.js' + 'test/ngTouch/**/*.js' ], 'karma': [ @@ -150,7 +150,7 @@ angularFiles = { 'test/ngRoute/**/*.js', 'test/ngResource/*.js', 'test/ngSanitize/**/*.js', - 'test/ngMobile/**/*.js' + 'test/ngTouch/**/*.js' ], 'karmaJquery': [ diff --git a/docs/src/templates/index.html b/docs/src/templates/index.html index 8f86b468538b..e4afc731ccd3 100644 --- a/docs/src/templates/index.html +++ b/docs/src/templates/index.html @@ -45,7 +45,7 @@ addTag('script', {src: path('angular-route.js') }, sync); addTag('script', {src: path('angular-cookies.js') }, sync); addTag('script', {src: path('angular-sanitize.js') }, sync); - addTag('script', {src: path('angular-mobile.js') }, sync); + addTag('script', {src: path('angular-touch.js') }, sync); addTag('script', {src: path('angular-animate.js') }, sync); addTag('script', {src: 'components/angular-bootstrap.js' }, sync); addTag('script', {src: 'components/angular-bootstrap-prettify.js' }, sync); diff --git a/karma-docs.conf.js b/karma-docs.conf.js index 7d21570d2235..e1790214e778 100644 --- a/karma-docs.conf.js +++ b/karma-docs.conf.js @@ -12,7 +12,7 @@ module.exports = function(config) { 'build/angular-cookies.js', 'build/angular-mocks.js', 'build/angular-resource.js', - 'build/angular-mobile.js', + 'build/angular-touch.js', 'build/angular-sanitize.js', 'build/angular-route.js', 'build/angular-animate.js', diff --git a/src/ngMobile/directive/ngClick.js b/src/ngTouch/directive/ngClick.js similarity index 98% rename from src/ngMobile/directive/ngClick.js rename to src/ngTouch/directive/ngClick.js index 6df71ddb980b..f1d8ccaa3d1c 100644 --- a/src/ngMobile/directive/ngClick.js +++ b/src/ngTouch/directive/ngClick.js @@ -2,7 +2,7 @@ /** * @ngdoc directive - * @name ngMobile.directive:ngClick + * @name ngTouch.directive:ngClick * * @description * A more powerful replacement for the default ngClick designed to be used on touchscreen @@ -31,7 +31,7 @@ */ -ngMobile.config(['$provide', function($provide) { +ngTouch.config(['$provide', function($provide) { $provide.decorator('ngClickDirective', ['$delegate', function($delegate) { // drop the default ngClick directive $delegate.shift(); @@ -39,7 +39,7 @@ ngMobile.config(['$provide', function($provide) { }]); }]); -ngMobile.directive('ngClick', ['$parse', '$timeout', '$rootElement', +ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement', function($parse, $timeout, $rootElement) { var TAP_DURATION = 750; // Shorter than 750ms is a tap, longer is a taphold or drag. var MOVE_TOLERANCE = 12; // 12px seems to work in most mobile browsers. diff --git a/src/ngMobile/directive/ngSwipe.js b/src/ngTouch/directive/ngSwipe.js similarity index 96% rename from src/ngMobile/directive/ngSwipe.js rename to src/ngTouch/directive/ngSwipe.js index 4238954280e5..e754113ce87c 100644 --- a/src/ngMobile/directive/ngSwipe.js +++ b/src/ngTouch/directive/ngSwipe.js @@ -2,7 +2,7 @@ /** * @ngdoc directive - * @name ngMobile.directive:ngSwipeLeft + * @name ngTouch.directive:ngSwipeLeft * * @description * Specify custom behavior when an element is swiped to the left on a touchscreen device. @@ -29,7 +29,7 @@ /** * @ngdoc directive - * @name ngMobile.directive:ngSwipeRight + * @name ngTouch.directive:ngSwipeRight * * @description * Specify custom behavior when an element is swiped to the right on a touchscreen device. @@ -55,7 +55,7 @@ */ function makeSwipeDirective(directiveName, direction, eventName) { - ngMobile.directive(directiveName, ['$parse', '$swipe', function($parse, $swipe) { + ngTouch.directive(directiveName, ['$parse', '$swipe', function($parse, $swipe) { // The maximum vertical delta for a swipe should be less than 75px. var MAX_VERTICAL_DISTANCE = 75; // Vertical distance should not be more than a fraction of the horizontal distance. diff --git a/src/ngMobile/swipe.js b/src/ngTouch/swipe.js similarity index 96% rename from src/ngMobile/swipe.js rename to src/ngTouch/swipe.js index 99e58eee1296..655043f85486 100644 --- a/src/ngMobile/swipe.js +++ b/src/ngTouch/swipe.js @@ -2,13 +2,13 @@ /** * @ngdoc object - * @name ngMobile.$swipe + * @name ngTouch.$swipe * * @description * The `$swipe` service is a service that abstracts the messier details of hold-and-drag swipe * behavior, to make implementing swipe-related directives more convenient. * - * It is used by the `ngSwipeLeft` and `ngSwipeRight` directives in `ngMobile`, and by + * It is used by the `ngSwipeLeft` and `ngSwipeRight` directives in `ngTouch`, and by * `ngCarousel` in a separate component. * * # Usage @@ -17,7 +17,7 @@ * documentation for `bind` below. */ -ngMobile.factory('$swipe', [function() { +ngTouch.factory('$swipe', [function() { // The total distance in any direction before we make the call on swipe vs. scroll. var MOVE_BUFFER_RADIUS = 10; @@ -37,8 +37,8 @@ ngMobile.factory('$swipe', [function() { return { /** * @ngdoc method - * @name ngMobile.$swipe#bind - * @methodOf ngMobile.$swipe + * @name ngTouch.$swipe#bind + * @methodOf ngTouch.$swipe * * @description * The main method of `$swipe`. It takes an element to be watched for swipe motions, and an diff --git a/src/ngMobile/mobile.js b/src/ngTouch/touch.js similarity index 64% rename from src/ngMobile/mobile.js rename to src/ngTouch/touch.js index daa28f5ba036..844350aa6dce 100644 --- a/src/ngMobile/mobile.js +++ b/src/ngTouch/touch.js @@ -2,12 +2,12 @@ /** * @ngdoc overview - * @name ngMobile + * @name ngTouch * @description * Touch events and other mobile helpers. * Based on jQuery Mobile touch event handling (jquerymobile.com) */ -// define ngMobile module -var ngMobile = angular.module('ngMobile', []); +// define ngTouch module +var ngTouch = angular.module('ngTouch', []); diff --git a/test/ngMobile/directive/ngClickSpec.js b/test/ngTouch/directive/ngClickSpec.js similarity index 99% rename from test/ngMobile/directive/ngClickSpec.js rename to test/ngTouch/directive/ngClickSpec.js index 523949777a3a..2a11adeebf33 100644 --- a/test/ngMobile/directive/ngClickSpec.js +++ b/test/ngTouch/directive/ngClickSpec.js @@ -1,6 +1,6 @@ 'use strict'; -describe('ngClick (mobile)', function() { +describe('ngClick (touch)', function() { var element, time, orig_now; // TODO(braden): Once we have other touch-friendly browsers on CI, allow them here. @@ -16,7 +16,7 @@ describe('ngClick (mobile)', function() { beforeEach(function() { - module('ngMobile'); + module('ngTouch'); orig_now = Date.now; time = 0; Date.now = mockTime; diff --git a/test/ngMobile/directive/ngSwipeSpec.js b/test/ngTouch/directive/ngSwipeSpec.js similarity index 99% rename from test/ngMobile/directive/ngSwipeSpec.js rename to test/ngTouch/directive/ngSwipeSpec.js index f51556c60e9c..588a123df6f3 100644 --- a/test/ngMobile/directive/ngSwipeSpec.js +++ b/test/ngTouch/directive/ngSwipeSpec.js @@ -23,7 +23,7 @@ var swipeTests = function(description, restrictBrowsers, startEvent, moveEvent, } beforeEach(function() { - module('ngMobile'); + module('ngTouch'); }); afterEach(function() { diff --git a/test/ngMobile/swipeSpec.js b/test/ngTouch/swipeSpec.js similarity index 99% rename from test/ngMobile/swipeSpec.js rename to test/ngTouch/swipeSpec.js index 8befcfc9e6ce..7431f0c19901 100644 --- a/test/ngMobile/swipeSpec.js +++ b/test/ngTouch/swipeSpec.js @@ -23,7 +23,7 @@ var swipeTests = function(description, restrictBrowsers, startEvent, moveEvent, } beforeEach(function() { - module('ngMobile'); + module('ngTouch'); }); afterEach(function() {