This repository was archived by the owner on Sep 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +32
-4
lines changed Expand file tree Collapse file tree 3 files changed +32
-4
lines changed Original file line number Diff line number Diff line change @@ -82,9 +82,10 @@ function getDirective(name) {
82
82
83
83
/* @ngInject */
84
84
function DirectiveFactory ( $parse ) {
85
- return { restrict : 'A' , link : postLink } ;
86
- function postLink ( scope , element , attr ) {
87
- element . css ( 'touch-action' , 'none' ) ;
85
+ return { restrict : 'A' , link : postLink } ;
86
+
87
+ function postLink ( scope , element , attr ) {
88
+ element . css ( 'touch-action' , attr [ 'mdSwipeTouchAction' ] || 'none' ) ;
88
89
89
90
var fn = $parse ( attr [ directiveName ] ) ;
90
91
element . on ( eventName , function ( ev ) {
Original file line number Diff line number Diff line change
1
+ describe ( 'swipe' , function ( ) {
2
+ var $compile , pageScope ;
3
+
4
+ beforeEach ( module ( 'material.components.swipe' ) ) ;
5
+
6
+ beforeEach ( inject ( function ( $injector ) {
7
+ $compile = $injector . get ( '$compile' ) ;
8
+ pageScope = $injector . get ( '$rootScope' ) . $new ( ) ;
9
+ } ) ) ;
10
+
11
+ it ( 'should apply the specified touch-action to the swipe element' , function ( ) {
12
+ var template = '<div md-swipe-left="dummy = 1" md-swipe-touch-action="pan-y"></div>' ;
13
+ var element = $compile ( template ) ( pageScope ) ;
14
+ pageScope . $apply ( ) ;
15
+
16
+ expect ( element [ 0 ] . style . touchAction ) . toBe ( 'pan-y' ) ;
17
+ } ) ;
18
+
19
+ it ( 'should apply touch-action: none when no touch-action is specified' , function ( ) {
20
+ var template = '<div md-swipe-left="dummy = 1"></div>' ;
21
+ var element = $compile ( template ) ( pageScope ) ;
22
+ pageScope . $apply ( ) ;
23
+
24
+ expect ( element [ 0 ] . style . touchAction ) . toBe ( 'none' ) ;
25
+ } ) ;
26
+ } ) ;
Original file line number Diff line number Diff line change @@ -158,7 +158,7 @@ function MdTabs ($$mdSvgRegistry) {
158
158
'\'md-disabled\': tab.scope.disabled ' +
159
159
'}" ' +
160
160
'ng-disabled="tab.scope.disabled" ' +
161
- 'md-swipe-left="$mdTabsCtrl.nextPage()" ' +
161
+ 'md-swipe-left="$mdTabsCtrl.nextPage()" md-swipe-touch-action="pan-y" ' +
162
162
'md-swipe-right="$mdTabsCtrl.previousPage()" ' +
163
163
'md-tabs-template="::tab.label" ' +
164
164
'md-scope="::tab.parent"></md-tab-item> ' +
@@ -188,6 +188,7 @@ function MdTabs ($$mdSvgRegistry) {
188
188
'aria-labelledby="tab-item-{{::tab.id}}" ' +
189
189
'md-swipe-left="$mdTabsCtrl.swipeContent && $mdTabsCtrl.incrementIndex(1)" ' +
190
190
'md-swipe-right="$mdTabsCtrl.swipeContent && $mdTabsCtrl.incrementIndex(-1)" ' +
191
+ 'md-swipe-touch-action="pan-y" ' +
191
192
'ng-if="tab.hasContent" ' +
192
193
'ng-repeat="(index, tab) in $mdTabsCtrl.tabs" ' +
193
194
'ng-class="{ ' +
You can’t perform that action at this time.
0 commit comments