raakt 0.1 → 0.3
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/raakt.rb +84 -70
- data/tests/raakt_test.rb +172 -75
- metadata +2 -2
data/lib/raakt.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
#Ruby Accessibility Analysis Kit
|
1
|
+
# :title: Ruby Accessibility Analysis Kit
|
2
|
+
# =Ruby Accessibility Analysis Kit
|
3
|
+
#
|
4
|
+
# See README for a full explanation of this library.
|
2
5
|
|
3
6
|
module Raakt
|
4
7
|
require 'rubyful_soup'
|
@@ -19,10 +22,10 @@ module Raakt
|
|
19
22
|
"fieldmissinglabel" => "A field (with id/name '%s') is missing a corresponding label element. Make sure a label exists for all visible fields.",
|
20
23
|
"missingframetitle" => "Missing title attribute for frame with url %s",
|
21
24
|
"hasmetarefresh" => "Client side redirect (meta refresh) detected. Use server side redirection instead."
|
22
|
-
}
|
25
|
+
}
|
26
|
+
|
27
|
+
VERSION = "0.3"
|
23
28
|
|
24
|
-
VERSION = "0.1"
|
25
|
-
|
26
29
|
class ErrorMessage
|
27
30
|
|
28
31
|
attr_reader :eid, :text, :note
|
@@ -43,20 +46,34 @@ module Raakt
|
|
43
46
|
end
|
44
47
|
|
45
48
|
|
49
|
+
|
50
|
+
|
51
|
+
|
46
52
|
class Test
|
47
53
|
|
54
|
+
attr_accessor :soup, :html
|
48
55
|
|
49
|
-
def initialize()
|
56
|
+
def initialize(html=nil)
|
57
|
+
@html = html
|
58
|
+
@soup = BeautifulSoup.new(@html) if html
|
50
59
|
end
|
51
60
|
|
61
|
+
def feed(html)
|
62
|
+
@html = html || ""
|
63
|
+
if @html.length > 0
|
64
|
+
@soup = BeautifulSoup.new(@html)
|
65
|
+
else
|
66
|
+
raise "You called feed with no data. There is nothing to check."
|
67
|
+
end
|
68
|
+
end
|
52
69
|
|
53
|
-
def all
|
70
|
+
def all
|
54
71
|
#Do all checks
|
55
72
|
messages = []
|
56
73
|
|
57
74
|
self.methods.each do |method|
|
58
75
|
if method[0..5] == "check_"
|
59
|
-
messages += self.send(method
|
76
|
+
messages += self.send(method)
|
60
77
|
end
|
61
78
|
end
|
62
79
|
|
@@ -64,9 +81,9 @@ module Raakt
|
|
64
81
|
end
|
65
82
|
|
66
83
|
|
67
|
-
def check_images
|
68
|
-
soup = BeautifulSoup.new(html)
|
69
|
-
images = soup.find_all("img")
|
84
|
+
def check_images
|
85
|
+
#soup = BeautifulSoup.new(html)
|
86
|
+
images = @soup.find_all("img")
|
70
87
|
messages = []
|
71
88
|
|
72
89
|
for image in images:
|
@@ -80,9 +97,8 @@ module Raakt
|
|
80
97
|
end
|
81
98
|
|
82
99
|
|
83
|
-
def check_title
|
84
|
-
|
85
|
-
title = soup.find("title")
|
100
|
+
def check_title
|
101
|
+
title = @soup.find("title")
|
86
102
|
messages = []
|
87
103
|
|
88
104
|
if title
|
@@ -98,11 +114,10 @@ module Raakt
|
|
98
114
|
end
|
99
115
|
|
100
116
|
|
101
|
-
def check_has_heading
|
102
|
-
soup = BeautifulSoup.new(html)
|
117
|
+
def check_has_heading
|
103
118
|
messages = []
|
104
119
|
|
105
|
-
if soup.find_all("h1").length == 0
|
120
|
+
if @soup.find_all("h1").length == 0
|
106
121
|
messages << ErrorMessage.new("missingheading")
|
107
122
|
end
|
108
123
|
|
@@ -110,15 +125,14 @@ module Raakt
|
|
110
125
|
end
|
111
126
|
|
112
127
|
|
113
|
-
def headings
|
114
|
-
soup = BeautifulSoup.new(html)
|
128
|
+
def headings
|
115
129
|
headings = []
|
116
|
-
headings.push(soup.find_all("h1")) if soup.find_all("h1").length > 0
|
117
|
-
headings.push(soup.find_all("h2")) if soup.find_all("h2").length > 0
|
118
|
-
headings.push(soup.find_all("h3")) if soup.find_all("h3").length > 0
|
119
|
-
headings.push(soup.find_all("h4")) if soup.find_all("h4").length > 0
|
120
|
-
headings.push(soup.find_all("h5")) if soup.find_all("h5").length > 0
|
121
|
-
headings.push(soup.find_all("h6")) if soup.find_all("h6").length > 0
|
130
|
+
headings.push(@soup.find_all("h1")) if @soup.find_all("h1").length > 0
|
131
|
+
headings.push(@soup.find_all("h2")) if @soup.find_all("h2").length > 0
|
132
|
+
headings.push(@soup.find_all("h3")) if @soup.find_all("h3").length > 0
|
133
|
+
headings.push(@soup.find_all("h4")) if @soup.find_all("h4").length > 0
|
134
|
+
headings.push(@soup.find_all("h5")) if @soup.find_all("h5").length > 0
|
135
|
+
headings.push(@soup.find_all("h6")) if @soup.find_all("h6").length > 0
|
122
136
|
|
123
137
|
return headings.flatten
|
124
138
|
end
|
@@ -129,10 +143,10 @@ module Raakt
|
|
129
143
|
end
|
130
144
|
|
131
145
|
|
132
|
-
def check_document_structure
|
146
|
+
def check_document_structure
|
133
147
|
messages = []
|
134
148
|
currentitem = 0
|
135
|
-
docheadings = headings
|
149
|
+
docheadings = headings
|
136
150
|
|
137
151
|
for heading in docheadings
|
138
152
|
if currentitem == 0
|
@@ -154,10 +168,10 @@ module Raakt
|
|
154
168
|
end
|
155
169
|
|
156
170
|
|
157
|
-
def check_for_nested_tables
|
158
|
-
|
171
|
+
def check_for_nested_tables
|
172
|
+
|
159
173
|
messages = []
|
160
|
-
tables = soup.find_all("table")
|
174
|
+
tables = @soup.find_all("table")
|
161
175
|
|
162
176
|
for table in tables
|
163
177
|
if table.find_all("table").length > 0
|
@@ -170,10 +184,10 @@ module Raakt
|
|
170
184
|
end
|
171
185
|
|
172
186
|
|
173
|
-
def check_tables
|
174
|
-
|
187
|
+
def check_tables
|
188
|
+
|
175
189
|
messages = []
|
176
|
-
tables = soup.find_all("table")
|
190
|
+
tables = @soup.find_all("table")
|
177
191
|
hasth = false
|
178
192
|
currenttable = 1
|
179
193
|
|
@@ -203,11 +217,11 @@ module Raakt
|
|
203
217
|
end
|
204
218
|
|
205
219
|
|
206
|
-
def check_for_formatting_elements
|
207
|
-
|
220
|
+
def check_for_formatting_elements
|
221
|
+
|
208
222
|
messages = []
|
209
|
-
formatting_items = soup.find_all(["font", "b", "i"])
|
210
|
-
flicker_items = soup.find_all(["blink", "marquee"])
|
223
|
+
formatting_items = @soup.find_all(["font", "b", "i"])
|
224
|
+
flicker_items = @soup.find_all(["blink", "marquee"])
|
211
225
|
|
212
226
|
if formatting_items.length > 0
|
213
227
|
messages << ErrorMessage.new("missingsemantics")
|
@@ -221,13 +235,14 @@ module Raakt
|
|
221
235
|
end
|
222
236
|
|
223
237
|
|
224
|
-
def check_for_language_info
|
225
|
-
soup = BeautifulSoup.new(html)
|
238
|
+
def check_for_language_info
|
226
239
|
messages = []
|
227
240
|
|
228
|
-
|
241
|
+
htmlelement = @soup.find("html")
|
242
|
+
|
243
|
+
lang = langinfo(htmlelement) || ""
|
229
244
|
|
230
|
-
|
245
|
+
unless lang.length > 1
|
231
246
|
messages << ErrorMessage.new("missinglanginfo")
|
232
247
|
end
|
233
248
|
|
@@ -235,9 +250,9 @@ module Raakt
|
|
235
250
|
end
|
236
251
|
|
237
252
|
|
238
|
-
def check_link_text
|
253
|
+
def check_link_text
|
239
254
|
messages = []
|
240
|
-
links = get_links
|
255
|
+
links = get_links
|
241
256
|
linktexts = links.collect { |el| el[3] }
|
242
257
|
|
243
258
|
for link_a in links
|
@@ -258,10 +273,10 @@ module Raakt
|
|
258
273
|
end
|
259
274
|
|
260
275
|
|
261
|
-
def check_form
|
276
|
+
def check_form
|
262
277
|
messages = []
|
263
|
-
labels = get_labels
|
264
|
-
fields = get_editable_fields
|
278
|
+
labels = get_labels
|
279
|
+
fields = get_editable_fields
|
265
280
|
|
266
281
|
#make sure all fields have associated labels
|
267
282
|
|
@@ -286,12 +301,12 @@ module Raakt
|
|
286
301
|
end
|
287
302
|
|
288
303
|
|
289
|
-
def check_frames
|
304
|
+
def check_frames
|
290
305
|
#Verify frame titles
|
291
|
-
|
306
|
+
|
292
307
|
messages = []
|
293
|
-
if is_frameset
|
294
|
-
frames = soup.find_all("frame")
|
308
|
+
if is_frameset
|
309
|
+
frames = @soup.find_all("frame")
|
295
310
|
frame_title = ""
|
296
311
|
|
297
312
|
for frame in frames
|
@@ -306,10 +321,10 @@ module Raakt
|
|
306
321
|
end
|
307
322
|
|
308
323
|
|
309
|
-
def check_refresh
|
310
|
-
|
324
|
+
def check_refresh
|
325
|
+
|
311
326
|
messages = []
|
312
|
-
meta_elements = soup.find_all("meta")
|
327
|
+
meta_elements = @soup.find_all("meta")
|
313
328
|
|
314
329
|
for element in meta_elements
|
315
330
|
if element["http-equiv"] == "refresh"
|
@@ -349,17 +364,14 @@ module Raakt
|
|
349
364
|
end
|
350
365
|
|
351
366
|
|
352
|
-
def get_links
|
353
|
-
|
354
|
-
messages = []
|
355
|
-
|
356
|
-
linkelements = soup.find_all("a")
|
367
|
+
def get_links
|
368
|
+
linkelements = @soup.find_all("a")
|
357
369
|
links = []
|
358
370
|
currentlink = 0
|
359
371
|
|
360
372
|
for element in linkelements
|
361
|
-
title = (element['title'] || "").strip
|
362
|
-
linktext = (elements_to_text(element) || "").strip
|
373
|
+
title = normalize_text((element['title'] || "").strip)
|
374
|
+
linktext = normalize_text((elements_to_text(element) || "").strip)
|
363
375
|
url = element['href']
|
364
376
|
links << [currentlink, url, title, linktext]
|
365
377
|
currentlink += 1
|
@@ -371,8 +383,13 @@ module Raakt
|
|
371
383
|
|
372
384
|
def langinfo(element)
|
373
385
|
langval = ""
|
374
|
-
|
375
|
-
|
386
|
+
|
387
|
+
if element.class.to_s == 'Tag'
|
388
|
+
if element['lang']
|
389
|
+
langval = element['lang']
|
390
|
+
end
|
391
|
+
else
|
392
|
+
return nil
|
376
393
|
end
|
377
394
|
|
378
395
|
return langval
|
@@ -420,15 +437,13 @@ module Raakt
|
|
420
437
|
end
|
421
438
|
|
422
439
|
|
423
|
-
def get_labels
|
424
|
-
soup
|
425
|
-
return soup.find_all("label")
|
440
|
+
def get_labels
|
441
|
+
return @soup.find_all("label")
|
426
442
|
end
|
427
443
|
|
428
444
|
|
429
|
-
def get_editable_fields
|
430
|
-
|
431
|
-
allfields = soup.find_all(["textarea", "select", "input"])
|
445
|
+
def get_editable_fields
|
446
|
+
allfields = @soup.find_all(["textarea", "select", "input"])
|
432
447
|
fields = []
|
433
448
|
field_type = ""
|
434
449
|
|
@@ -444,9 +459,8 @@ module Raakt
|
|
444
459
|
end
|
445
460
|
|
446
461
|
|
447
|
-
def is_frameset
|
448
|
-
soup
|
449
|
-
return (soup.find("frameset") != nil)
|
462
|
+
def is_frameset
|
463
|
+
return (@soup.find("frameset") != nil)
|
450
464
|
end
|
451
465
|
|
452
466
|
end
|
data/tests/raakt_test.rb
CHANGED
@@ -9,41 +9,57 @@ class RaaktTest < Test::Unit::TestCase
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def test_all
|
12
|
-
|
12
|
+
@raakt.feed(data_full_google)
|
13
|
+
assert_equal 7, @raakt.all.length
|
13
14
|
end
|
14
15
|
|
15
16
|
def test_check_images
|
16
|
-
|
17
|
-
assert_equal
|
17
|
+
@raakt.feed(data_imagedoc1)
|
18
|
+
assert_equal 1, @raakt.check_images.length
|
19
|
+
assert_equal "missingalt", @raakt.check_images[0].eid
|
18
20
|
|
19
|
-
|
21
|
+
@raakt.feed(data_imagedoc2)
|
22
|
+
assert_equal 0, @raakt.check_images.length
|
20
23
|
|
21
|
-
|
24
|
+
@raakt.feed(data_imagedoc3)
|
25
|
+
assert_equal 3, @raakt.check_images.length
|
22
26
|
|
23
|
-
|
27
|
+
@raakt.feed(data_imagedoc4)
|
28
|
+
assert_equal 1, @raakt.check_images.length
|
24
29
|
end
|
25
30
|
|
26
31
|
def test_check_images_in_blank_doc
|
27
|
-
|
32
|
+
@raakt.feed(data_empty)
|
33
|
+
assert_equal 0, @raakt.check_images.length
|
28
34
|
end
|
29
35
|
|
30
36
|
|
31
37
|
def test_check_title
|
32
|
-
|
33
|
-
assert_equal
|
34
|
-
assert_equal "missingtitle", @raakt.check_title(data_empty)[0].eid
|
38
|
+
@raakt.feed(data_xhtmldoc1)
|
39
|
+
assert_equal 0, @raakt.check_title.length
|
35
40
|
|
36
|
-
|
37
|
-
assert_equal
|
41
|
+
@raakt.feed(data_empty)
|
42
|
+
assert_equal 1, @raakt.check_title.length
|
43
|
+
assert_equal "missingtitle", @raakt.check_title[0].eid
|
38
44
|
|
39
|
-
|
40
|
-
assert_equal
|
45
|
+
@raakt.feed(data_emptytitledoc)
|
46
|
+
assert_equal 1, @raakt.check_title.length
|
47
|
+
assert_equal "emptytitle", @raakt.check_title[0].eid
|
48
|
+
|
49
|
+
@raakt.feed(data_invalidhtmldoc1)
|
50
|
+
assert_equal 0, @raakt.check_title.length
|
51
|
+
|
52
|
+
@raakt.feed(data_invalidhtmldoc2)
|
53
|
+
assert_equal 0, @raakt.check_title.length
|
41
54
|
end
|
42
55
|
|
43
56
|
|
44
57
|
def test_headings
|
45
|
-
|
46
|
-
assert_equal
|
58
|
+
@raakt.feed(data_headingsdoc1)
|
59
|
+
assert_equal 3, @raakt.headings.length
|
60
|
+
|
61
|
+
@raakt.feed(data_invalidhtmldoc2)
|
62
|
+
assert_equal 0, @raakt.headings.length
|
47
63
|
end
|
48
64
|
|
49
65
|
def test_level
|
@@ -53,70 +69,118 @@ class RaaktTest < Test::Unit::TestCase
|
|
53
69
|
end
|
54
70
|
|
55
71
|
def test_check_has_heading
|
56
|
-
|
57
|
-
assert_equal
|
58
|
-
assert_equal
|
59
|
-
|
72
|
+
@raakt.feed(data_empty)
|
73
|
+
assert_equal 1, @raakt.check_has_heading.length
|
74
|
+
assert_equal "missingheading", @raakt.check_has_heading[0].eid
|
75
|
+
|
76
|
+
@raakt.feed(data_headingsdoc1)
|
77
|
+
assert_equal 0, @raakt.check_has_heading.length
|
78
|
+
|
79
|
+
@raakt.feed(data_headingsdoc9)
|
80
|
+
assert_equal 0, @raakt.check_has_heading.length
|
60
81
|
|
61
|
-
|
62
|
-
assert_equal
|
82
|
+
@raakt.feed(data_invalidhtmldoc2)
|
83
|
+
assert_equal 1, @raakt.check_has_heading.length
|
84
|
+
assert_equal "missingheading", @raakt.check_has_heading[0].eid
|
63
85
|
end
|
64
86
|
|
65
87
|
def test_check_document_structure
|
66
|
-
|
67
|
-
|
68
|
-
assert_equal
|
69
|
-
|
70
|
-
|
71
|
-
assert_equal
|
72
|
-
assert_equal
|
73
|
-
|
88
|
+
|
89
|
+
@raakt.feed(data_headingsdoc1)
|
90
|
+
assert_equal 0, @raakt.check_document_structure.length
|
91
|
+
|
92
|
+
@raakt.feed(data_headingsdoc3)
|
93
|
+
assert_equal 1, @raakt.check_document_structure.length
|
94
|
+
assert_equal "firsthnoth1", @raakt.check_document_structure[0].eid
|
95
|
+
|
96
|
+
@raakt.feed(data_headingsdoc4)
|
97
|
+
assert_equal "wronghstructure", @raakt.check_document_structure[0].eid
|
98
|
+
|
99
|
+
@raakt.feed(data_headingsdoc5)
|
100
|
+
assert_equal "firsthnoth1", @raakt.check_document_structure[0].eid
|
101
|
+
assert_equal "wronghstructure", @raakt.check_document_structure[1].eid
|
102
|
+
|
103
|
+
@raakt.feed(data_headingsdoc6)
|
104
|
+
assert_equal 0, @raakt.check_document_structure.length
|
105
|
+
|
106
|
+
@raakt.feed(data_empty)
|
107
|
+
assert_equal 0, @raakt.check_document_structure.length
|
74
108
|
end
|
75
109
|
|
76
110
|
|
77
111
|
def test_check_for_nested_tables
|
78
|
-
|
79
|
-
assert_equal 0, @raakt.check_for_nested_tables
|
80
|
-
|
81
|
-
|
82
|
-
assert_equal
|
83
|
-
|
112
|
+
@raakt.feed(data_tabledoc1)
|
113
|
+
assert_equal 0, @raakt.check_for_nested_tables.length
|
114
|
+
|
115
|
+
@raakt.feed(data_tabledoc2)
|
116
|
+
assert_equal 0, @raakt.check_for_nested_tables.length
|
117
|
+
|
118
|
+
@raakt.feed(data_tabledoc3)
|
119
|
+
assert_equal 1, @raakt.check_for_nested_tables.length
|
120
|
+
assert_equal "hasnestedtables", @raakt.check_for_nested_tables[0].eid
|
121
|
+
|
122
|
+
@raakt.feed(data_tabledoc4)
|
123
|
+
assert_equal 0, @raakt.check_for_nested_tables.length
|
124
|
+
|
125
|
+
@raakt.feed(data_tabledoc5)
|
126
|
+
assert_equal 1, @raakt.check_for_nested_tables.length
|
84
127
|
end
|
85
128
|
|
86
129
|
def test_check_tables
|
87
|
-
|
88
|
-
assert_equal 0, @raakt.check_tables
|
89
|
-
|
90
|
-
|
130
|
+
@raakt.feed(data_tabledoc4)
|
131
|
+
assert_equal 0, @raakt.check_tables.length
|
132
|
+
|
133
|
+
@raakt.feed(data_tabledoc1)
|
134
|
+
assert_equal 0, @raakt.check_tables.length
|
135
|
+
|
136
|
+
@raakt.feed(data_tabledoc2)
|
137
|
+
assert_equal 2, @raakt.check_tables.length
|
91
138
|
end
|
92
139
|
|
93
140
|
|
94
141
|
def test_check_for_formatting_elements
|
95
|
-
|
96
|
-
assert_equal
|
142
|
+
@raakt.feed(data_invalidelements1)
|
143
|
+
assert_equal 1, @raakt.check_for_formatting_elements.length
|
144
|
+
assert_equal "boldused", @raakt.check_for_formatting_elements[0].eid
|
97
145
|
end
|
98
146
|
|
99
147
|
|
100
148
|
def test_check_for_language_info
|
101
|
-
|
102
|
-
assert_equal
|
103
|
-
|
149
|
+
@raakt.feed(data_xhtmldoc1)
|
150
|
+
assert_equal 0, @raakt.check_for_language_info.length
|
151
|
+
|
152
|
+
@raakt.feed(data_tabledoc2)
|
153
|
+
assert_equal 1, @raakt.check_for_language_info.length
|
154
|
+
|
155
|
+
@raakt.feed(data_tablelayoutdoc)
|
156
|
+
assert_equal 1, @raakt.check_for_language_info.length
|
157
|
+
|
104
158
|
end
|
105
159
|
|
106
160
|
|
107
161
|
def test_check_link_text
|
108
|
-
|
109
|
-
assert_equal
|
110
|
-
assert_equal
|
111
|
-
|
112
|
-
|
162
|
+
@raakt.feed(data_linkdoc1)
|
163
|
+
assert_equal 1, @raakt.check_link_text.length
|
164
|
+
assert_equal "ambiguouslinktext", @raakt.check_link_text[0].eid
|
165
|
+
|
166
|
+
@raakt.feed(data_linkdoc3)
|
167
|
+
assert_equal 0, @raakt.check_link_text.length
|
168
|
+
|
169
|
+
@raakt.feed(data_linkdoc2)
|
170
|
+
assert_equal 0, @raakt.check_link_text.length
|
171
|
+
|
172
|
+
@raakt.feed(data_linkdoc4)
|
173
|
+
assert_equal 1, @raakt.check_link_text.length
|
113
174
|
end
|
114
175
|
|
115
176
|
|
116
177
|
def test_get_links
|
117
|
-
|
118
|
-
assert_equal
|
119
|
-
|
178
|
+
@raakt.feed(data_linkdoc1)
|
179
|
+
assert_equal 8, @raakt.get_links.length
|
180
|
+
|
181
|
+
@raakt.feed(data_linkdoc4)
|
182
|
+
assert_equal 2, @raakt.get_links.length
|
183
|
+
assert_equal "Read more", @raakt.get_links[0][3]
|
120
184
|
end
|
121
185
|
|
122
186
|
def test_img_to_text
|
@@ -170,55 +234,88 @@ class RaaktTest < Test::Unit::TestCase
|
|
170
234
|
|
171
235
|
|
172
236
|
def test_get_labels
|
173
|
-
|
174
|
-
assert_equal 1, @raakt.get_labels
|
175
|
-
|
237
|
+
@raakt.feed(data_fielddoc1)
|
238
|
+
assert_equal 1, @raakt.get_labels.length
|
239
|
+
|
240
|
+
@raakt.feed(data_fielddoc2)
|
241
|
+
assert_equal 1, @raakt.get_labels.length
|
242
|
+
|
243
|
+
@raakt.feed(data_fielddoc3)
|
244
|
+
assert_equal 2, @raakt.get_labels.length
|
176
245
|
end
|
177
246
|
|
178
247
|
|
179
248
|
def test_get_editable_fields
|
180
|
-
|
181
|
-
assert_equal
|
182
|
-
|
249
|
+
@raakt.feed(data_fielddoc1)
|
250
|
+
assert_equal 1, @raakt.get_editable_fields.length
|
251
|
+
|
252
|
+
@raakt.feed(data_fielddoc2)
|
253
|
+
assert_equal 2, @raakt.get_editable_fields.length
|
254
|
+
|
255
|
+
@raakt.feed(data_fielddoc3)
|
256
|
+
assert_equal 3, @raakt.get_editable_fields.length
|
183
257
|
end
|
184
258
|
|
185
259
|
|
186
260
|
def test_check_form
|
187
|
-
|
188
|
-
assert_equal
|
189
|
-
|
190
|
-
|
191
|
-
assert_equal
|
261
|
+
@raakt.feed(data_fielddoc1)
|
262
|
+
assert_equal 0, @raakt.check_form.length
|
263
|
+
|
264
|
+
@raakt.feed(data_fielddoc2)
|
265
|
+
assert_equal 1, @raakt.check_form.length
|
266
|
+
assert_equal "fieldmissinglabel", @raakt.check_form[0].eid
|
267
|
+
|
268
|
+
@raakt.feed(data_fielddoc3)
|
269
|
+
assert_equal 1, @raakt.check_form.length
|
270
|
+
assert_equal "fieldmissinglabel", @raakt.check_form[0].eid
|
192
271
|
end
|
193
272
|
|
194
273
|
|
195
274
|
def test_is_frameset
|
196
|
-
|
197
|
-
assert @raakt.is_frameset
|
198
|
-
|
275
|
+
@raakt.feed(data_framedoc1)
|
276
|
+
assert @raakt.is_frameset
|
277
|
+
|
278
|
+
@raakt.feed(data_framedoc2)
|
279
|
+
assert @raakt.is_frameset
|
280
|
+
|
281
|
+
@raakt.feed(data_xhtmldoc1)
|
282
|
+
assert !@raakt.is_frameset
|
199
283
|
end
|
200
284
|
|
201
285
|
|
202
286
|
def test_check_frames
|
203
|
-
|
204
|
-
assert_equal
|
287
|
+
@raakt.feed(data_framedoc1)
|
288
|
+
assert_equal 3, @raakt.check_frames.length
|
289
|
+
|
290
|
+
@raakt.feed(data_framedoc2)
|
291
|
+
assert_equal 0, @raakt.check_frames.length
|
205
292
|
end
|
206
293
|
|
207
294
|
|
208
295
|
def test_check_for_formatting_elements
|
209
|
-
|
296
|
+
@raakt.feed(data_invalidelements1)
|
297
|
+
invaliderrs = @raakt.check_for_formatting_elements
|
210
298
|
assert_equal 2, invaliderrs.length
|
211
299
|
assert_equal "missingsemantics", invaliderrs[0].eid
|
212
300
|
assert_equal "hasflicker", invaliderrs[1].eid
|
213
|
-
|
301
|
+
|
302
|
+
@raakt.feed(data_xhtmldoc1)
|
303
|
+
assert_equal 0, @raakt.check_for_formatting_elements.length
|
214
304
|
end
|
215
305
|
|
216
306
|
|
217
307
|
def test_refresh
|
218
|
-
|
219
|
-
assert_equal 1, @raakt.check_refresh
|
220
|
-
|
221
|
-
|
308
|
+
@raakt.feed(data_metarefreshdoc1)
|
309
|
+
assert_equal 1, @raakt.check_refresh.length
|
310
|
+
|
311
|
+
@raakt.feed(data_metarefreshdoc2)
|
312
|
+
assert_equal 1, @raakt.check_refresh.length
|
313
|
+
|
314
|
+
@raakt.feed(data_metarefreshdoc3)
|
315
|
+
assert_equal 1, @raakt.check_refresh.length
|
316
|
+
|
317
|
+
@raakt.feed(data_xhtmldoc1)
|
318
|
+
assert_equal 0, @raakt.check_refresh.length
|
222
319
|
end
|
223
320
|
|
224
321
|
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: raakt
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: "0.
|
7
|
-
date: 2006-07-
|
6
|
+
version: "0.3"
|
7
|
+
date: 2006-07-13 00:00:00 +02:00
|
8
8
|
summary: A toolkit to find accessibility issues in HTML documents.
|
9
9
|
require_paths:
|
10
10
|
- lib
|