touch_action 0.0.2alpha → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -2
- data/README.md +9 -9
- data/lib/touch_action.rb +17 -48
- data/lib/touch_action/javascripts/tap.js.erb +1 -1
- data/lib/touch_action/version.rb +1 -1
- data/spec/features/doubletap_spec.rb +13 -0
- data/spec/features/flick_spec.rb +32 -0
- data/spec/features/move_spec.rb +15 -0
- data/spec/features/pinch_spec.rb +15 -0
- data/spec/features/press_spec.rb +13 -0
- data/spec/features/rotate_spec.rb +16 -0
- data/spec/features/tap_spec.rb +20 -0
- data/spec/spec_helper.rb +56 -0
- data/spec/support/static_website/public/css/style.css +77 -0
- data/spec/support/static_website/public/images/frog.jpg +0 -0
- data/spec/support/static_website/public/index.html +198 -0
- data/spec/support/static_website/public/js/fastclick.js +805 -0
- data/spec/support/static_website/public/js/hammer.js +2463 -0
- data/spec/support/static_website/public/js/jquery-1.7.2.min.js +4 -0
- data/spec/support/static_website/public/js/jquery-2.1.1.min.js +4 -0
- data/spec/support/static_website/public/js/pinchzoom.js +761 -0
- data/spec/support/static_website/public/js/touch_square.js +0 -0
- data/spec/support/static_website/public/pinch.html +45 -0
- data/spec/support/static_website/public/tap.html +80 -0
- data/spec/support/static_website/rack_app.rb +46 -0
- data/spec/unit/watir-webdriver/element_spec.rb +11 -0
- data/touch_action.gemspec +4 -0
- metadata +102 -28
File without changes
|
@@ -0,0 +1,45 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/html4/loose.dtd">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>Pinchzoom.js Demo</title>
|
6
|
+
|
7
|
+
<style type="text/css">
|
8
|
+
div.pinch-zoom,
|
9
|
+
div.pinch-zoom img{
|
10
|
+
width: 100%;
|
11
|
+
-webkit-user-drag: none;
|
12
|
+
}
|
13
|
+
|
14
|
+
</style>
|
15
|
+
<link rel="stylesheet" href="style.css" />
|
16
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
17
|
+
<meta name="apple-mobile-web-app-capable" content="yes" />
|
18
|
+
|
19
|
+
<!-- pinchzoom requires: jquery -->
|
20
|
+
<script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script>
|
21
|
+
<script type="text/javascript" src="../js/pinchzoom.js"></script>
|
22
|
+
<script type="text/javascript">
|
23
|
+
$(function () {
|
24
|
+
$('div.pinch-zoom').each(function () {
|
25
|
+
new RTP.PinchZoom($(this), {});
|
26
|
+
});
|
27
|
+
})
|
28
|
+
</script>
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
|
32
|
+
<div class="page">
|
33
|
+
<div class="pinch-zoom">
|
34
|
+
<div class="description">
|
35
|
+
<h1>Pinchzoom.js</h1>
|
36
|
+
<p>
|
37
|
+
Multi-touch zoom in Javascript
|
38
|
+
</p>
|
39
|
+
</div>
|
40
|
+
<img src="images/frog.jpg"/>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
</body>
|
45
|
+
</html>
|
@@ -0,0 +1,80 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>Touch Page Test</title>
|
6
|
+
|
7
|
+
|
8
|
+
<script type='application/javascript' src='js/hammer.js'></script>
|
9
|
+
<script type='application/javascript' src='js/jquery-2.1.1.min.js'></script>
|
10
|
+
<script type='application/javascript' src='js/fastclick.js'></script>
|
11
|
+
<link rel="stylesheet" type="text/css" href="css/style.css" />
|
12
|
+
</head>
|
13
|
+
<body>
|
14
|
+
|
15
|
+
|
16
|
+
<div id="myElement"></div>
|
17
|
+
<p>Tap, double tap or press (and hold) on the div above and Hammer.js will recognize it.</p>
|
18
|
+
|
19
|
+
<br>
|
20
|
+
<h4>FastClick JS tests:</h4>
|
21
|
+
<a href="#" id='fastclick'>FastClick link</a>
|
22
|
+
<p id="fast-click-test" data-click-number='0'>Not clicked</p>
|
23
|
+
<br><br>
|
24
|
+
|
25
|
+
<a href="#" id='slowclick' class='needsclick'>Common Link</a>
|
26
|
+
<p id="slow-click-test" data-click-number='0'>Not clicked</p>
|
27
|
+
<br><br>
|
28
|
+
<p>By <a href="https://github.com/Ricardonacif">Ricardo Nacif</a> </p>
|
29
|
+
|
30
|
+
<script>
|
31
|
+
$(function() {
|
32
|
+
FastClick.attach(document.body);
|
33
|
+
});
|
34
|
+
|
35
|
+
$("#fastclick").click(function(){
|
36
|
+
times = $('#fast-click-test').data('click-number');
|
37
|
+
times++;
|
38
|
+
$('#fast-click-test').data('click-number', times);
|
39
|
+
$('#fast-click-test').text("You clicked " + times + ' times');
|
40
|
+
return false;
|
41
|
+
});
|
42
|
+
|
43
|
+
$("#slowclick").click(function(){
|
44
|
+
times = $('#slow-click-test').data('click-number');
|
45
|
+
times++;
|
46
|
+
$('#slow-click-test').data('click-number', times);
|
47
|
+
$('#slow-click-test').text("You clicked " + times + ' times');
|
48
|
+
return false;
|
49
|
+
});
|
50
|
+
|
51
|
+
|
52
|
+
var myElement = document.getElementById('myElement');
|
53
|
+
|
54
|
+
// We create a manager object, which is the same as Hammer(), but without the presetted recognizers.
|
55
|
+
var mc = new Hammer.Manager(myElement);
|
56
|
+
|
57
|
+
// Default, tap recognizer
|
58
|
+
mc.add( new Hammer.Tap() );
|
59
|
+
|
60
|
+
// Tap recognizer with minimal 4 taps
|
61
|
+
mc.add( new Hammer.Tap({ event: 'doubletap', taps: 2 }) );
|
62
|
+
|
63
|
+
mc.add( new Hammer.Press({ event: 'press' }) );
|
64
|
+
|
65
|
+
// we want to recognize this simulatenous, so a doubletap will be detected even while a tap has been recognized.
|
66
|
+
// the tap event will be emitted on every tap
|
67
|
+
mc.get('doubletap').recognizeWith('tap');
|
68
|
+
|
69
|
+
|
70
|
+
mc.on("press", function(ev) {
|
71
|
+
myElement.textContent += ev.type +" ";
|
72
|
+
});
|
73
|
+
|
74
|
+
mc.on("tap doubletap", function(ev) {
|
75
|
+
myElement.textContent += ev.type +" ";
|
76
|
+
});
|
77
|
+
|
78
|
+
</script>
|
79
|
+
</body>
|
80
|
+
</html>
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'rack'
|
2
|
+
@app = Rack::Builder.new do
|
3
|
+
|
4
|
+
use Rack::Static,
|
5
|
+
:urls => ["/images", "/js", "/css"],
|
6
|
+
:root => "./spec/support/static_website/public"
|
7
|
+
|
8
|
+
map "/" do
|
9
|
+
run lambda { |env|
|
10
|
+
[
|
11
|
+
200,
|
12
|
+
{
|
13
|
+
'Content-Type' => 'text/html',
|
14
|
+
'Cache-Control' => 'public, max-age=86400'
|
15
|
+
},
|
16
|
+
File.open('./spec/support/static_website/public/index.html', File::RDONLY)
|
17
|
+
]
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
map "/tap" do
|
22
|
+
run lambda { |env|
|
23
|
+
[
|
24
|
+
200,
|
25
|
+
{
|
26
|
+
'Content-Type' => 'text/html',
|
27
|
+
'Cache-Control' => 'public, max-age=86400'
|
28
|
+
},
|
29
|
+
File.open('./spec/support/static_website/public/tap.html', File::RDONLY)
|
30
|
+
]
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
map "/pinch" do
|
35
|
+
run lambda { |env|
|
36
|
+
[
|
37
|
+
200,
|
38
|
+
{
|
39
|
+
'Content-Type' => 'text/html',
|
40
|
+
'Cache-Control' => 'public, max-age=86400'
|
41
|
+
},
|
42
|
+
File.open('./spec/support/static_website/public/pinch.html', File::RDONLY)
|
43
|
+
]
|
44
|
+
}
|
45
|
+
end
|
46
|
+
end.to_app
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Watir::Element do
|
4
|
+
describe "Watir::Element instance" do
|
5
|
+
it 'should respond to the method touch_action' do
|
6
|
+
@browser.goto('http://localhost:9292')
|
7
|
+
element = @browser.div(id: 'hit')
|
8
|
+
expect(element.respond_to?(:touch_action)).to be_equal(true)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/touch_action.gemspec
CHANGED
@@ -23,4 +23,8 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.7"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
25
25
|
spec.add_development_dependency "pry"
|
26
|
+
spec.add_development_dependency "rack"
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.1.0"
|
28
|
+
spec.add_development_dependency "thin"
|
29
|
+
|
26
30
|
end
|
metadata
CHANGED
@@ -1,78 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: touch_action
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
5
|
-
prerelease: 5
|
4
|
+
version: 0.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ricardo Nacif
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-21 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: watir-webdriver
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: bundler
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- - ~>
|
31
|
+
- - "~>"
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '1.7'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- - ~>
|
38
|
+
- - "~>"
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '1.7'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rake
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- - ~>
|
45
|
+
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '10.0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- - ~>
|
52
|
+
- - "~>"
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '10.0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: pry
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - ">="
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rack
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 3.1.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 3.1.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: thin
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
76
109
|
- !ruby/object:Gem::Version
|
77
110
|
version: '0'
|
78
111
|
description: Adds touch gestures to Watir and Selenium using YUI JS.
|
@@ -82,7 +115,7 @@ executables: []
|
|
82
115
|
extensions: []
|
83
116
|
extra_rdoc_files: []
|
84
117
|
files:
|
85
|
-
- .gitignore
|
118
|
+
- ".gitignore"
|
86
119
|
- CHANGELOG.md
|
87
120
|
- Gemfile
|
88
121
|
- LICENSE.txt
|
@@ -98,30 +131,71 @@ files:
|
|
98
131
|
- lib/touch_action/javascripts/rotate.js.erb
|
99
132
|
- lib/touch_action/javascripts/tap.js.erb
|
100
133
|
- lib/touch_action/version.rb
|
134
|
+
- spec/features/doubletap_spec.rb
|
135
|
+
- spec/features/flick_spec.rb
|
136
|
+
- spec/features/move_spec.rb
|
137
|
+
- spec/features/pinch_spec.rb
|
138
|
+
- spec/features/press_spec.rb
|
139
|
+
- spec/features/rotate_spec.rb
|
140
|
+
- spec/features/tap_spec.rb
|
141
|
+
- spec/spec_helper.rb
|
142
|
+
- spec/support/static_website/public/css/style.css
|
143
|
+
- spec/support/static_website/public/images/frog.jpg
|
144
|
+
- spec/support/static_website/public/index.html
|
145
|
+
- spec/support/static_website/public/js/fastclick.js
|
146
|
+
- spec/support/static_website/public/js/hammer.js
|
147
|
+
- spec/support/static_website/public/js/jquery-1.7.2.min.js
|
148
|
+
- spec/support/static_website/public/js/jquery-2.1.1.min.js
|
149
|
+
- spec/support/static_website/public/js/pinchzoom.js
|
150
|
+
- spec/support/static_website/public/js/touch_square.js
|
151
|
+
- spec/support/static_website/public/pinch.html
|
152
|
+
- spec/support/static_website/public/tap.html
|
153
|
+
- spec/support/static_website/rack_app.rb
|
154
|
+
- spec/unit/watir-webdriver/element_spec.rb
|
101
155
|
- touch_action.gemspec
|
102
156
|
homepage: ''
|
103
157
|
licenses:
|
104
158
|
- MIT
|
159
|
+
metadata: {}
|
105
160
|
post_install_message:
|
106
161
|
rdoc_options: []
|
107
162
|
require_paths:
|
108
163
|
- lib
|
109
164
|
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
-
none: false
|
111
165
|
requirements:
|
112
|
-
- -
|
166
|
+
- - ">="
|
113
167
|
- !ruby/object:Gem::Version
|
114
168
|
version: '0'
|
115
169
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
-
none: false
|
117
170
|
requirements:
|
118
|
-
- -
|
171
|
+
- - ">="
|
119
172
|
- !ruby/object:Gem::Version
|
120
|
-
version:
|
173
|
+
version: '0'
|
121
174
|
requirements: []
|
122
175
|
rubyforge_project:
|
123
|
-
rubygems_version:
|
176
|
+
rubygems_version: 2.2.2
|
124
177
|
signing_key:
|
125
|
-
specification_version:
|
178
|
+
specification_version: 4
|
126
179
|
summary: Adds touch gestures to Watir and Selenium using YUI JS.
|
127
|
-
test_files:
|
180
|
+
test_files:
|
181
|
+
- spec/features/doubletap_spec.rb
|
182
|
+
- spec/features/flick_spec.rb
|
183
|
+
- spec/features/move_spec.rb
|
184
|
+
- spec/features/pinch_spec.rb
|
185
|
+
- spec/features/press_spec.rb
|
186
|
+
- spec/features/rotate_spec.rb
|
187
|
+
- spec/features/tap_spec.rb
|
188
|
+
- spec/spec_helper.rb
|
189
|
+
- spec/support/static_website/public/css/style.css
|
190
|
+
- spec/support/static_website/public/images/frog.jpg
|
191
|
+
- spec/support/static_website/public/index.html
|
192
|
+
- spec/support/static_website/public/js/fastclick.js
|
193
|
+
- spec/support/static_website/public/js/hammer.js
|
194
|
+
- spec/support/static_website/public/js/jquery-1.7.2.min.js
|
195
|
+
- spec/support/static_website/public/js/jquery-2.1.1.min.js
|
196
|
+
- spec/support/static_website/public/js/pinchzoom.js
|
197
|
+
- spec/support/static_website/public/js/touch_square.js
|
198
|
+
- spec/support/static_website/public/pinch.html
|
199
|
+
- spec/support/static_website/public/tap.html
|
200
|
+
- spec/support/static_website/rack_app.rb
|
201
|
+
- spec/unit/watir-webdriver/element_spec.rb
|