hatemile 2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. data/CODE_OF_CONDUCT.md +46 -0
  3. data/Gemfile +9 -0
  4. data/LICENSE +202 -0
  5. data/Rakefile +64 -0
  6. data/hatemile.gemspec +37 -0
  7. data/lib/hatemile/accessible_association.rb +62 -0
  8. data/lib/hatemile/accessible_css.rb +43 -0
  9. data/lib/hatemile/accessible_display.rb +178 -0
  10. data/lib/hatemile/accessible_event.rb +95 -0
  11. data/lib/hatemile/accessible_form.rb +101 -0
  12. data/lib/hatemile/accessible_navigation.rb +82 -0
  13. data/lib/hatemile/helper.rb +58 -0
  14. data/lib/hatemile/implementation/accessible_association_implementation.rb +346 -0
  15. data/lib/hatemile/implementation/accessible_css_implementation.rb +772 -0
  16. data/lib/hatemile/implementation/accessible_display_implementation.rb +1362 -0
  17. data/lib/hatemile/implementation/accessible_event_implementation.rb +278 -0
  18. data/lib/hatemile/implementation/accessible_form_implementation.rb +386 -0
  19. data/lib/hatemile/implementation/accessible_navigation_implementation.rb +561 -0
  20. data/lib/hatemile/util/common_functions.rb +106 -0
  21. data/lib/hatemile/util/configure.rb +92 -0
  22. data/lib/hatemile/util/css/rcp/rcp_declaration.rb +77 -0
  23. data/lib/hatemile/util/css/rcp/rcp_parser.rb +115 -0
  24. data/lib/hatemile/util/css/rcp/rcp_rule.rb +86 -0
  25. data/lib/hatemile/util/css/style_sheet_declaration.rb +59 -0
  26. data/lib/hatemile/util/css/style_sheet_parser.rb +43 -0
  27. data/lib/hatemile/util/css/style_sheet_rule.rb +73 -0
  28. data/lib/hatemile/util/html/html_dom_element.rb +234 -0
  29. data/lib/hatemile/util/html/html_dom_node.rb +131 -0
  30. data/lib/hatemile/util/html/html_dom_parser.rb +150 -0
  31. data/lib/hatemile/util/html/html_dom_text_node.rb +43 -0
  32. data/lib/hatemile/util/html/nokogiri/nokogiri_html_dom_element.rb +302 -0
  33. data/lib/hatemile/util/html/nokogiri/nokogiri_html_dom_node.rb +112 -0
  34. data/lib/hatemile/util/html/nokogiri/nokogiri_html_dom_parser.rb +208 -0
  35. data/lib/hatemile/util/html/nokogiri/nokogiri_html_dom_text_node.rb +83 -0
  36. data/lib/hatemile/util/id_generator.rb +53 -0
  37. data/lib/js/common.js +98 -0
  38. data/lib/js/eventlistener.js +36 -0
  39. data/lib/js/include.js +292 -0
  40. data/lib/js/scriptlist_validation_fields.js +13 -0
  41. data/lib/js/validation.js +205 -0
  42. data/lib/locale/en-US.yml +388 -0
  43. data/lib/locale/pt-BR.yml +389 -0
  44. data/lib/skippers.xml +6 -0
  45. data/lib/symbols.xml +40 -0
  46. data/test/locale/en-US.yml +5 -0
  47. data/test/locale/pt-BR.yml +4 -0
  48. data/test/test_accessible_association_implementation.rb +258 -0
  49. data/test/test_accessible_css_implementation.rb +518 -0
  50. data/test/test_accessible_display_implementation.rb +873 -0
  51. data/test/test_accessible_form_implementation.rb +283 -0
  52. data/test/test_accessible_navigation_implementation.rb +228 -0
  53. data/test/test_common_functions.rb +128 -0
  54. data/test/test_configure.rb +73 -0
  55. data/test/test_nokogiri_html_dom_element.rb +586 -0
  56. data/test/test_nokogiri_html_dom_parser.rb +363 -0
  57. data/test/test_nokogiri_html_dom_text_node.rb +225 -0
  58. data/test/test_rcp_declaration.rb +103 -0
  59. data/test/test_rcp_parser.rb +86 -0
  60. data/test/test_rcp_rule.rb +89 -0
  61. metadata +199 -0
@@ -0,0 +1,59 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ ##
14
+ # The Hatemile module contains the interfaces with the acessibility solutions.
15
+ module Hatemile
16
+ ##
17
+ # The Hatemile::Util module contains the utilities of library.
18
+ module Util
19
+ ##
20
+ # The Hatemile::Util::Css module contains the interfaces of CSS handles.
21
+ module Css
22
+ ##
23
+ # The StyleSheetDeclaration interface contains the methods for access the
24
+ # CSS declaration.
25
+ #
26
+ # @abstract
27
+ class StyleSheetDeclaration
28
+ private_class_method :new
29
+
30
+ ##
31
+ # Returns the value of declaration.
32
+ #
33
+ # @abstract
34
+ # @return [String] The value of declaration.
35
+ def get_value
36
+ # Interface method
37
+ end
38
+
39
+ ##
40
+ # Returns a list with the values of declaration.
41
+ #
42
+ # @abstract
43
+ # @return [Array<String>] The list with the values of declaration.
44
+ def get_values
45
+ # Interface method
46
+ end
47
+
48
+ ##
49
+ # Returns the property of declaration.
50
+ #
51
+ # @abstract
52
+ # @return [String] The property of declaration.
53
+ def get_property
54
+ # Interface method
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,43 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ ##
14
+ # The Hatemile module contains the interfaces with the acessibility solutions.
15
+ module Hatemile
16
+ ##
17
+ # The Hatemile::Util module contains the utilities of library.
18
+ module Util
19
+ ##
20
+ # The Hatemile::Util::Css module contains the interfaces of CSS handles.
21
+ module Css
22
+ ##
23
+ # The StyleSheetParser interface contains the methods for access the CSS
24
+ # parser.
25
+ #
26
+ # @abstract
27
+ class StyleSheetParser
28
+ private_class_method :new
29
+
30
+ ##
31
+ # Returns the rules of parser by properties.
32
+ #
33
+ # @abstract
34
+ # @param properties [Array<String>] The properties.
35
+ # @return [Array<Hatemile::Util::Css.stylesheetrule.StyleSheetRule>] The
36
+ # rules.
37
+ def get_rules(properties)
38
+ # Interface method
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,73 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ ##
14
+ # The Hatemile module contains the interfaces with the acessibility solutions.
15
+ module Hatemile
16
+ ##
17
+ # The Hatemile::Util module contains the utilities of library.
18
+ module Util
19
+ ##
20
+ # The Hatemile::Util::Css module contains the interfaces of CSS handles.
21
+ module Css
22
+ ##
23
+ # The StyleSheetRule interface contains the methods for access the CSS
24
+ # rule.
25
+ #
26
+ # @abstract
27
+ class StyleSheetRule
28
+ private_class_method :new
29
+
30
+ ##
31
+ # Returns that the rule has a declaration with the property.
32
+ #
33
+ # @abstract
34
+ # @param property_name [String] The name of property.
35
+ # @return [Boolean] True if the rule has a declaration with the property
36
+ # or false if the rule not has a declaration with the property.
37
+ def has_property?(property_name)
38
+ # Interface method
39
+ end
40
+
41
+ ##
42
+ # Returns that the rule has declarations.
43
+ #
44
+ # @abstract
45
+ # @return [Boolean] True if the rule has the property or False if the
46
+ # rule not has declarations.
47
+ def has_declarations?
48
+ # Interface method
49
+ end
50
+
51
+ ##
52
+ # Returns the declarations with the property.
53
+ #
54
+ # @abstract
55
+ # @param property_name [String] The property.
56
+ # @return [Hatemile::Util::Css::StyleSheetDeclaration] The declarations
57
+ # with the property.
58
+ def get_declarations(property_name)
59
+ # Interface method
60
+ end
61
+
62
+ ##
63
+ # Returns the selector of rule.
64
+ #
65
+ # @abstract
66
+ # @return [String] The selector of rule.
67
+ def get_selector
68
+ # Interface method
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,234 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ require File.join(File.dirname(__FILE__), 'html_dom_node')
14
+
15
+ ##
16
+ # The Hatemile module contains the interfaces with the acessibility solutions.
17
+ module Hatemile
18
+ ##
19
+ # The Hatemile::Util module contains the utilities of library.
20
+ module Util
21
+ ##
22
+ # The Hatemile::Util::Html module contains the interfaces of HTML handles.
23
+ module Html
24
+ ##
25
+ # The HTMLDOMElement interface contains the methods for access of the HTML
26
+ # element.
27
+ #
28
+ # @abstract
29
+ class HTMLDOMElement < HTMLDOMNode
30
+ private_class_method :new
31
+
32
+ ##
33
+ # Returns the tag name of element.
34
+ #
35
+ # @abstract
36
+ # @return [String] The tag name of element in uppercase letters.
37
+ def get_tag_name
38
+ # Interface method
39
+ end
40
+
41
+ ##
42
+ # Returns the value of a attribute.
43
+ #
44
+ # @abstract
45
+ # @param name [String] The name of attribute.
46
+ # @return [String] The value of the attribute or nil if the element not
47
+ # contains the attribute.
48
+ def get_attribute(name)
49
+ # Interface method
50
+ end
51
+
52
+ ##
53
+ # Create or modify a attribute.
54
+ #
55
+ # @abstract
56
+ # @param name [String] The name of attribute.
57
+ # @param value [String] The value of attribute.
58
+ # @return [void]
59
+ def set_attribute(name, value)
60
+ # Interface method
61
+ end
62
+
63
+ ##
64
+ # Remove a attribute of element.
65
+ #
66
+ # @abstract
67
+ # @param name [String] The name of attribute.
68
+ # @return [void]
69
+ def remove_attribute(name)
70
+ # Interface method
71
+ end
72
+
73
+ ##
74
+ # Check that the element has an attribute.
75
+ #
76
+ # @abstract
77
+ # @param name [String] The name of attribute.
78
+ # @return [Boolean] True if the element has the attribute or false if
79
+ # the element not has the attribute.
80
+ def has_attribute?(name)
81
+ # Interface method
82
+ end
83
+
84
+ ##
85
+ # Check that the element has attributes.
86
+ #
87
+ # @abstract
88
+ # @return [Boolean] True if the element has attributes or false if the
89
+ # element not has attributes.
90
+ def has_attributes?
91
+ # Interface method
92
+ end
93
+
94
+ ##
95
+ # Append a element child.
96
+ #
97
+ # @abstract
98
+ # @param element [Hatemile::Util::Html::HTMLDOMElement] The element that
99
+ # be inserted.
100
+ # @return [Hatemile::Util::Html::HTMLDOMElement] This element.
101
+ def append_element(element)
102
+ # Interface method
103
+ end
104
+
105
+ ##
106
+ # Prepend a element child.
107
+ #
108
+ # @abstract
109
+ # @param element [Hatemile::Util::Html::HTMLDOMElement] The element that
110
+ # be inserted.
111
+ # @return [Hatemile::Util::Html::HTMLDOMElement] This element.
112
+ def prepend_element(element)
113
+ # Interface method
114
+ end
115
+
116
+ ##
117
+ # Returns the elements children of this element.
118
+ #
119
+ # @abstract
120
+ # @return [Array<Hatemile::Util::Html::HTMLDOMElement>] The elements
121
+ # children of this element.
122
+ def get_children_elements
123
+ # Interface method
124
+ end
125
+
126
+ ##
127
+ # Returns the children of this element.
128
+ #
129
+ # @abstract
130
+ # @return [Array<Hatemile::Util::Html::HTMLDOMNode>] The children of
131
+ # this element.
132
+ def get_children
133
+ # Interface method
134
+ end
135
+
136
+ ##
137
+ # Joins adjacent Text nodes.
138
+ #
139
+ # @abstract
140
+ # @return [Hatemile::Util::Html::HTMLDOMElement] This element.
141
+ def normalize
142
+ # Interface method
143
+ end
144
+
145
+ ##
146
+ # Check that the element has elements children.
147
+ #
148
+ # @abstract
149
+ # @return [Boolean] True if the element has elements children or false
150
+ # if the element not has elements children.
151
+ def has_children_elements?
152
+ # Interface method
153
+ end
154
+
155
+ ##
156
+ # Check that the element has children.
157
+ #
158
+ # @abstract
159
+ # @return [Boolean] True if the element has children or false if the
160
+ # element not has children.
161
+ def has_children?
162
+ # Interface method
163
+ end
164
+
165
+ ##
166
+ # Returns the inner HTML code of this element.
167
+ #
168
+ # @abstract
169
+ # @return [String] The inner HTML code of this element.
170
+ def get_inner_html
171
+ # Interface method
172
+ end
173
+
174
+ ##
175
+ # Returns the HTML code of this element.
176
+ #
177
+ # @abstract
178
+ # @return [String] The HTML code of this element.
179
+ def get_outer_html
180
+ # Interface method
181
+ end
182
+
183
+ ##
184
+ # Returns the first element child of this element.
185
+ #
186
+ # @abstract
187
+ # @return [Hatemile::Util::Html::HTMLDOMElement] The first element child
188
+ # of this element.
189
+ def get_first_element_child
190
+ # Interface method
191
+ end
192
+
193
+ ##
194
+ # Returns the last element child of this element.
195
+ #
196
+ # @abstract
197
+ # @return [Hatemile::Util::Html::HTMLDOMElement] The last element child
198
+ # of this element.
199
+ def get_last_element_child
200
+ # Interface method
201
+ end
202
+
203
+ ##
204
+ # Returns the first node child of this element.
205
+ #
206
+ # @abstract
207
+ # @return [Hatemile::Util::Html::HTMLDOMNode] The first node child of
208
+ # this element.
209
+ def get_first_node_child
210
+ # Interface method
211
+ end
212
+
213
+ ##
214
+ # Returns the last node child of this element.
215
+ #
216
+ # @abstract
217
+ # @return [Hatemile::Util::Html::HTMLDOMNode] The last node child of
218
+ # this element.
219
+ def get_last_node_child
220
+ # Interface method
221
+ end
222
+
223
+ ##
224
+ # Clone this element.
225
+ #
226
+ # @abstract
227
+ # @return [Hatemile::Util::Html::HTMLDOMElement] The clone.
228
+ def clone_element
229
+ # Interface method
230
+ end
231
+ end
232
+ end
233
+ end
234
+ end
@@ -0,0 +1,131 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ ##
14
+ # The Hatemile module contains the interfaces with the acessibility solutions.
15
+ module Hatemile
16
+ ##
17
+ # The Hatemile::Util module contains the utilities of library.
18
+ module Util
19
+ ##
20
+ # The Hatemile::Util::Html module contains the interfaces of HTML handles.
21
+ module Html
22
+ ##
23
+ # The HTMLDOMNode interface contains the methods for access the Node.
24
+ #
25
+ # @abstract
26
+ class HTMLDOMNode
27
+ private_class_method :new
28
+
29
+ ##
30
+ # Returns the text content of node.
31
+ #
32
+ # @abstract
33
+ # @return [String] The text content of node.
34
+ def get_text_content
35
+ # Interface method
36
+ end
37
+
38
+ ##
39
+ # Insert a node before this node.
40
+ #
41
+ # @abstract
42
+ # @param new_node [Hatemile::Util::Html::HTMLDOMNode] The node that be
43
+ # inserted.
44
+ # @return [Hatemile::Util::Html::HTMLDOMNode] This node.
45
+ def insert_before(new_node)
46
+ # Interface method
47
+ end
48
+
49
+ ##
50
+ # Insert a node after this node.
51
+ #
52
+ # @abstract
53
+ # @param new_node [Hatemile::Util::Html::HTMLDOMNode] The node that be
54
+ # inserted.
55
+ # @return [Hatemile::Util::Html::HTMLDOMNode] This node.
56
+ def insert_after(new_node)
57
+ # Interface method
58
+ end
59
+
60
+ ##
61
+ # Remove this node of the parser.
62
+ #
63
+ # @abstract
64
+ # @return [Hatemile::Util::Html::HTMLDOMNode] This node.
65
+ def remove_node
66
+ # Interface method
67
+ end
68
+
69
+ ##
70
+ # Replace this node for other node.
71
+ #
72
+ # @abstract
73
+ # @param new_node [Hatemile::Util::Html::HTMLDOMNode] The node that
74
+ # replace this node.
75
+ # @return [Hatemile::Util::Html::HTMLDOMNode] This node.
76
+ def replace_node(new_node)
77
+ # Interface method
78
+ end
79
+
80
+ ##
81
+ # Append a text content in node.
82
+ #
83
+ # @abstract
84
+ # @param text [String] The text content.
85
+ # @return [Hatemile::Util::Html::HTMLDOMNode] This node.
86
+ def append_text(text)
87
+ # Interface method
88
+ end
89
+
90
+ ##
91
+ # Prepend a text content in node.
92
+ #
93
+ # @abstract
94
+ # @param text [String] The text content.
95
+ # @return [Hatemile::Util::Html::HTMLDOMNode] This node.
96
+ def prepend_text(text)
97
+ # Interface method
98
+ end
99
+
100
+ ##
101
+ # Returns the parent element of this node.
102
+ #
103
+ # @abstract
104
+ # @return [Hatemile::Util::Html::HTMLDOMElement] The parent element of
105
+ # this node.
106
+ def get_parent_element
107
+ # Interface method
108
+ end
109
+
110
+ ##
111
+ # Returns the native object of this node.
112
+ #
113
+ # @abstract
114
+ # @return [Object] The native object of this node.
115
+ def get_data
116
+ # Interface method
117
+ end
118
+
119
+ ##
120
+ # Modify the native object of this node.
121
+ #
122
+ # @abstract
123
+ # @param data [Object] The native object of this node.
124
+ # @return [void]
125
+ def set_data(data)
126
+ # Interface method
127
+ end
128
+ end
129
+ end
130
+ end
131
+ end