keycodes 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/keycodes.rb +79 -0
- metadata +69 -0
data/lib/keycodes.rb
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
module Keys
|
|
2
|
+
|
|
3
|
+
#
|
|
4
|
+
# Mapping of keycodes that can be send to DOM nodes in a browser
|
|
5
|
+
# @see http://www.google.com.au/search?&q=unicode+pua&btnG=Search
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
KEYS = {
|
|
9
|
+
# \x works on both 1.8.6/1.9
|
|
10
|
+
:null => "\xEE\x80\x80",
|
|
11
|
+
:cancel => "\xEE\x80\x81",
|
|
12
|
+
:help => "\xEE\x80\x82",
|
|
13
|
+
:backspace => "\xEE\x80\x83",
|
|
14
|
+
:tab => "\xEE\x80\x84",
|
|
15
|
+
:clear => "\xEE\x80\x85",
|
|
16
|
+
:return => "\xEE\x80\x86",
|
|
17
|
+
:enter => "\xEE\x80\x87",
|
|
18
|
+
:shift => "\xEE\x80\x88",
|
|
19
|
+
:left_shift => "\xEE\x80\x88",
|
|
20
|
+
:control => "\xEE\x80\x89",
|
|
21
|
+
:left_control => "\xEE\x80\x89",
|
|
22
|
+
:alt => "\xEE\x80\x8A",
|
|
23
|
+
:left_alt => "\xEE\x80\x8A",
|
|
24
|
+
:pause => "\xEE\x80\x8B",
|
|
25
|
+
:escape => "\xEE\x80\x8C",
|
|
26
|
+
:space => "\xEE\x80\x8D",
|
|
27
|
+
:page_up => "\xEE\x80\x8E",
|
|
28
|
+
:page_down => "\xEE\x80\x8F",
|
|
29
|
+
:end => "\xEE\x80\x90",
|
|
30
|
+
:home => "\xEE\x80\x91",
|
|
31
|
+
:left => "\xEE\x80\x92",
|
|
32
|
+
:arrow_left => "\xEE\x80\x92",
|
|
33
|
+
:up => "\xEE\x80\x93",
|
|
34
|
+
:arrow_up => "\xEE\x80\x93",
|
|
35
|
+
:right => "\xEE\x80\x94",
|
|
36
|
+
:arrow_right => "\xEE\x80\x94",
|
|
37
|
+
:down => "\xEE\x80\x95",
|
|
38
|
+
:arrow_down => "\xEE\x80\x95",
|
|
39
|
+
:insert => "\xEE\x80\x96",
|
|
40
|
+
:delete => "\xEE\x80\x97",
|
|
41
|
+
:semicolon => "\xEE\x80\x98",
|
|
42
|
+
:equals => "\xEE\x80\x99",
|
|
43
|
+
:numpad0 => "\xEE\x80\x9A",
|
|
44
|
+
:numpad1 => "\xEE\x80\x9B",
|
|
45
|
+
:numpad2 => "\xEE\x80\x9C",
|
|
46
|
+
:numpad3 => "\xEE\x80\x9D",
|
|
47
|
+
:numpad4 => "\xEE\x80\x9E",
|
|
48
|
+
:numpad5 => "\xEE\x80\x9F",
|
|
49
|
+
:numpad6 => "\xEE\x80\xA0",
|
|
50
|
+
:numpad7 => "\xEE\x80\xA1",
|
|
51
|
+
:numpad8 => "\xEE\x80\xA2",
|
|
52
|
+
:numpad9 => "\xEE\x80\xA3",
|
|
53
|
+
:multiply => "\xEE\x80\xA4",
|
|
54
|
+
:add => "\xEE\x80\xA5",
|
|
55
|
+
:separator => "\xEE\x80\xA6",
|
|
56
|
+
:subtract => "\xEE\x80\xA7",
|
|
57
|
+
:decimal => "\xEE\x80\xA8",
|
|
58
|
+
:divide => "\xEE\x80\xA9",
|
|
59
|
+
:f1 => "\xEE\x80\xB1",
|
|
60
|
+
:f2 => "\xEE\x80\xB2",
|
|
61
|
+
:f3 => "\xEE\x80\xB3",
|
|
62
|
+
:f4 => "\xEE\x80\xB4",
|
|
63
|
+
:f5 => "\xEE\x80\xB5",
|
|
64
|
+
:f6 => "\xEE\x80\xB6",
|
|
65
|
+
:f7 => "\xEE\x80\xB7",
|
|
66
|
+
:f8 => "\xEE\x80\xB8",
|
|
67
|
+
:f9 => "\xEE\x80\xB9",
|
|
68
|
+
:f10 => "\xEE\x80\xBA",
|
|
69
|
+
:f11 => "\xEE\x80\xBB",
|
|
70
|
+
:f12 => "\xEE\x80\xBC",
|
|
71
|
+
:meta => "\xEE\x80\xBD",
|
|
72
|
+
:command => "\xEE\x80\xBD" # alias
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
def self.[](key)
|
|
76
|
+
KEYS[key] || raise(Error::UnsupportedOperationError, "no such key #{key.inspect}")
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: keycodes
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
hash: 29
|
|
5
|
+
prerelease:
|
|
6
|
+
segments:
|
|
7
|
+
- 0
|
|
8
|
+
- 0
|
|
9
|
+
- 1
|
|
10
|
+
version: 0.0.1
|
|
11
|
+
platform: ruby
|
|
12
|
+
authors:
|
|
13
|
+
- John Barker
|
|
14
|
+
autorequire:
|
|
15
|
+
bindir: bin
|
|
16
|
+
cert_chain: []
|
|
17
|
+
|
|
18
|
+
date: 2011-05-11 00:00:00 +08:00
|
|
19
|
+
default_executable:
|
|
20
|
+
dependencies: []
|
|
21
|
+
|
|
22
|
+
description: Provides a mapping of symbols to common keycodes used in interacting with web browsers, intended to be used by capybara drivers.
|
|
23
|
+
email: jebarker@gmail.com
|
|
24
|
+
executables: []
|
|
25
|
+
|
|
26
|
+
extensions: []
|
|
27
|
+
|
|
28
|
+
extra_rdoc_files: []
|
|
29
|
+
|
|
30
|
+
files:
|
|
31
|
+
- lib/keycodes.rb
|
|
32
|
+
has_rdoc: true
|
|
33
|
+
homepage:
|
|
34
|
+
licenses: []
|
|
35
|
+
|
|
36
|
+
post_install_message:
|
|
37
|
+
rdoc_options: []
|
|
38
|
+
|
|
39
|
+
require_paths:
|
|
40
|
+
- lib
|
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
42
|
+
none: false
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
hash: 3
|
|
47
|
+
segments:
|
|
48
|
+
- 0
|
|
49
|
+
version: "0"
|
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
|
+
none: false
|
|
52
|
+
requirements:
|
|
53
|
+
- - ">"
|
|
54
|
+
- !ruby/object:Gem::Version
|
|
55
|
+
hash: 25
|
|
56
|
+
segments:
|
|
57
|
+
- 1
|
|
58
|
+
- 3
|
|
59
|
+
- 1
|
|
60
|
+
version: 1.3.1
|
|
61
|
+
requirements: []
|
|
62
|
+
|
|
63
|
+
rubyforge_project:
|
|
64
|
+
rubygems_version: 1.6.2
|
|
65
|
+
signing_key:
|
|
66
|
+
specification_version: 3
|
|
67
|
+
summary: Provides common key code mappings
|
|
68
|
+
test_files: []
|
|
69
|
+
|