raakt 0.1 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/raakt.rb +84 -70
  2. data/tests/raakt_test.rb +172 -75
  3. 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(html)
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, html)
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(html)
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(html)
84
- soup = BeautifulSoup.new(html)
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(html)
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(html)
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(html)
146
+ def check_document_structure
133
147
  messages = []
134
148
  currentitem = 0
135
- docheadings = headings(html)
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(html)
158
- soup = BeautifulSoup.new(html)
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(html)
174
- soup = BeautifulSoup.new(html)
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(html)
207
- soup = BeautifulSoup.new(html)
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(html)
225
- soup = BeautifulSoup.new(html)
238
+ def check_for_language_info
226
239
  messages = []
227
240
 
228
- langelements = soup.find_all(Proc.new { |element| langinfo(element).length > 1 })
241
+ htmlelement = @soup.find("html")
242
+
243
+ lang = langinfo(htmlelement) || ""
229
244
 
230
- if langelements.length == 0
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(html)
253
+ def check_link_text
239
254
  messages = []
240
- links = get_links(html)
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(html)
276
+ def check_form
262
277
  messages = []
263
- labels = get_labels(html)
264
- fields = get_editable_fields(html)
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(html)
304
+ def check_frames
290
305
  #Verify frame titles
291
- soup = BeautifulSoup.new(html)
306
+
292
307
  messages = []
293
- if is_frameset(html)
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(html)
310
- soup = BeautifulSoup.new(html)
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(html)
353
- soup = BeautifulSoup.new(normalize_text(html))
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
- if element['lang']
375
- langval = element['lang']
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(html)
424
- soup = BeautifulSoup.new(html)
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(html)
430
- soup = BeautifulSoup.new(html)
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(html)
448
- soup = BeautifulSoup.new(html)
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
- puts @raakt.all(data_full_google)
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
- assert_equal 1, @raakt.check_images(data_imagedoc1).length
17
- assert_equal "missingalt", @raakt.check_images(data_imagedoc1)[0].eid
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
- assert_equal 0, @raakt.check_images(data_imagedoc2).length
21
+ @raakt.feed(data_imagedoc2)
22
+ assert_equal 0, @raakt.check_images.length
20
23
 
21
- assert_equal 3, @raakt.check_images(data_imagedoc3).length
24
+ @raakt.feed(data_imagedoc3)
25
+ assert_equal 3, @raakt.check_images.length
22
26
 
23
- assert_equal 1, @raakt.check_images(data_imagedoc4).length
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
- assert_equal 0, @raakt.check_images(data_empty).length
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
- assert_equal 0, @raakt.check_title(data_xhtmldoc1).length
33
- assert_equal 1, @raakt.check_title(data_empty).length
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
- assert_equal 1, @raakt.check_title(data_emptytitledoc).length
37
- assert_equal "emptytitle", @raakt.check_title(data_emptytitledoc)[0].eid
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
- assert_equal 0, @raakt.check_title(data_invalidhtmldoc1).length
40
- assert_equal 0, @raakt.check_title(data_invalidhtmldoc2).length
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
- assert_equal 3, @raakt.headings(data_headingsdoc1).length
46
- assert_equal 0, @raakt.headings(data_invalidhtmldoc2).length
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
- assert_equal 1, @raakt.check_has_heading(data_empty).length
57
- assert_equal "missingheading", @raakt.check_has_heading(data_empty)[0].eid
58
- assert_equal 0, @raakt.check_has_heading(data_headingsdoc1).length
59
- assert_equal 0, @raakt.check_has_heading(data_headingsdoc9).length
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
- assert_equal 1, @raakt.check_has_heading(data_invalidhtmldoc2).length
62
- assert_equal "missingheading", @raakt.check_has_heading(data_invalidhtmldoc2)[0].eid
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
- assert_equal 0, @raakt.check_document_structure(data_headingsdoc1).length
67
- assert_equal 1, @raakt.check_document_structure(data_headingsdoc3).length
68
- assert_equal "firsthnoth1", @raakt.check_document_structure(data_headingsdoc3)[0].eid
69
- assert_equal "wronghstructure", @raakt.check_document_structure(data_headingsdoc4)[0].eid
70
- assert_equal "firsthnoth1", @raakt.check_document_structure(data_headingsdoc5)[0].eid
71
- assert_equal "wronghstructure", @raakt.check_document_structure(data_headingsdoc5)[1].eid
72
- assert_equal 0, @raakt.check_document_structure(data_headingsdoc6).length
73
- assert_equal 0, @raakt.check_document_structure("").length
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
- assert_equal 0, @raakt.check_for_nested_tables(data_tabledoc1).length
79
- assert_equal 0, @raakt.check_for_nested_tables(data_tabledoc2).length
80
- assert_equal 1, @raakt.check_for_nested_tables(data_tabledoc3).length
81
- assert_equal 0, @raakt.check_for_nested_tables(data_tabledoc4).length
82
- assert_equal 1, @raakt.check_for_nested_tables(data_tabledoc5).length
83
- assert_equal "hasnestedtables", @raakt.check_for_nested_tables(data_tabledoc3)[0].eid
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
- puts @raakt.check_tables(data_tabledoc4).to_s
88
- assert_equal 0, @raakt.check_tables(data_tabledoc4).length
89
- assert_equal 0, @raakt.check_tables(data_tabledoc1).length
90
- assert_equal 2, @raakt.check_tables(data_tabledoc2).length
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
- assert_equal 1, @raakt.check_for_formatting_elements(data_invalidelements1).length
96
- assert_equal "boldused", @raakt.check_for_formatting_elements(data_invalidelements1)[0].eid
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
- assert_equal 0, @raakt.check_for_language_info(data_xhtmldoc1).length
102
- assert_equal 1, @raakt.check_for_language_info(data_tabledoc2).length
103
- assert_equal 1, @raakt.check_for_language_info(data_tablelayoutdoc).length
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
- assert_equal 1, @raakt.check_link_text(data_linkdoc1).length
109
- assert_equal "ambiguouslinktext", @raakt.check_link_text(data_linkdoc1)[0].eid
110
- assert_equal 0, @raakt.check_link_text(data_linkdoc3).length
111
- assert_equal 0, @raakt.check_link_text(data_linkdoc2).length
112
- assert_equal 1, @raakt.check_link_text(data_linkdoc4).length
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
- assert_equal 8, @raakt.get_links(data_linkdoc1).length
118
- assert_equal 2, @raakt.get_links(data_linkdoc4).length
119
- assert_equal "Read more", @raakt.get_links(data_linkdoc4)[0][3]
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
- assert_equal 1, @raakt.get_labels(data_fielddoc1).length
174
- assert_equal 1, @raakt.get_labels(data_fielddoc2).length
175
- assert_equal 2, @raakt.get_labels(data_fielddoc3).length
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
- assert_equal 1, @raakt.get_editable_fields(data_fielddoc1).length
181
- assert_equal 2, @raakt.get_editable_fields(data_fielddoc2).length
182
- assert_equal 3, @raakt.get_editable_fields(data_fielddoc3).length
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
- assert_equal 0, @raakt.check_form(data_fielddoc1).length
188
- assert_equal 1, @raakt.check_form(data_fielddoc2).length
189
- assert_equal "fieldmissinglabel", @raakt.check_form(data_fielddoc2)[0].eid
190
- assert_equal 1, @raakt.check_form(data_fielddoc3).length
191
- assert_equal "fieldmissinglabel", @raakt.check_form(data_fielddoc3)[0].eid
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
- assert @raakt.is_frameset(data_framedoc1)
197
- assert @raakt.is_frameset(data_framedoc2)
198
- assert !@raakt.is_frameset(data_xhtmldoc1)
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
- assert_equal 3, @raakt.check_frames(data_framedoc1).length
204
- assert_equal 0, @raakt.check_frames(data_framedoc2).length
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
- invaliderrs = @raakt.check_for_formatting_elements(data_invalidelements1)
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
- assert_equal 0, @raakt.check_for_formatting_elements(data_xhtmldoc1).length
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
- assert_equal 1, @raakt.check_refresh(data_metarefreshdoc1).length
219
- assert_equal 1, @raakt.check_refresh(data_metarefreshdoc2).length
220
- assert_equal 1, @raakt.check_refresh(data_metarefreshdoc3).length
221
- assert_equal 0, @raakt.check_refresh(data_xhtmldoc1).length
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.1"
7
- date: 2006-07-11 00:00:00 +02:00
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