code_terminator 0.4.14 → 0.4.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f508da0ae33e2fa4e4a74b374cfa421313208871
4
- data.tar.gz: e4a1eeff9512e6982789e9d8c22d68684abeba01
3
+ metadata.gz: 8a74c3589fc1cce252bdc6c1f1cfbbc8c39610cf
4
+ data.tar.gz: f500e2e20044cba091c042b3788108b36d6a022f
5
5
  SHA512:
6
- metadata.gz: f7bead4a3f71a5574cc59dc9c66368cf1af0cfdfbf5e76fdfee950a8c1afd06f0172b659c19b32b94939ad2e85d1b96845e20c43a766323823abe9242015859f
7
- data.tar.gz: 8c4ce312b6e515f98ecff34d5e290cc32c1c681adf9606ecbcec7026c4e45064a4f9f30544dd6e78feefa93cddcabe9b636c43718c51b491037a94ebea611b17
6
+ metadata.gz: 5aeedd345f4b1976d3d4c31c74734ab3f677df087e54c925da3db2b5c9c21ab9976b155a82d2901e04d0b1cd8d7c89adcec4c55d8316bce25b43c3f4dce0cd61
7
+ data.tar.gz: 58701c448eda38a40ef722c6bc22ea276ee57e5f0bddad29f4c069c1b2de36d73a332f70cf1e0648f3069c0bbbff853ac416ba1a6c1b14e22e09d23a0e434157
@@ -0,0 +1 @@
1
+ <html><head></head><body><!-- This is a comment --></body></html>
@@ -295,32 +295,38 @@ class CodeTerminator::Html
295
295
 
296
296
  # Check the text
297
297
  if !e[:content].nil?
298
+
298
299
  if code.css(e[:parent]).count < 2
299
- #new code
300
300
  if code.css(e[:parent]).class == Nokogiri::XML::NodeSet
301
301
  text_found = false
302
302
  error330 = nil
303
303
  if code.css(e[:parent]).children.any?
304
- code.css(e[:parent]).children.each do |node_child|
305
-
306
- if node_child.class != Nokogiri::XML::Element
307
- #embebed code
308
- #if code.css(e[:parent]).text != e[:content]
309
- if node_child.text.strip != e[:content].strip
310
- if item == "comment"
304
+ code.css(e[:parent]).children.each do |node_child|
305
+ if node_child.class != Nokogiri::XML::Element
306
+ #embebed code
307
+ #if code.css(e[:parent]).text != e[:content]
308
+
309
+ if node_child.text.strip != e[:content].strip
310
+ if item == "comment"
311
+ # if comment isn't present in the code, mark add tag
312
+ if e[:content].strip != ""
311
313
  error330 = new_error(element: e, type: 330, description: "The text inside the comment should be #{e[:content]}")
312
314
  else
313
- error330 = new_error(element: e, type: 330, description: "The text inside `<#{e[:parent]}>` should be #{e[:content]}")
315
+ # html_errors << new_error(element: e, type: 404, description: "Remember to add the `<#{e[:tag]}>` tag")
314
316
  end
315
317
  else
316
- text_found = true
318
+ error330 = new_error(element: e, type: 330, description: "The text inside `<#{e[:parent]}>` should be #{e[:content]}")
317
319
  end
318
- #end embebed code
320
+ else
321
+ text_found = true
319
322
  end
323
+ #end embebed code
320
324
  end
325
+ end
326
+ #end each
321
327
  else
322
328
  if code.css(e[:parent]).text.strip != e[:content].strip
323
- p "text of node: " + code.css(e[:parent]).text
329
+ # p "text of node: " + code.css(e[:parent]).text
324
330
  if item == "comment"
325
331
  error330 = new_error(element: e, type: 330, description: "The text inside the comment should be #{e[:content]}")
326
332
  else
@@ -330,14 +336,14 @@ class CodeTerminator::Html
330
336
  text_found = true
331
337
  end
332
338
  end
339
+ #end if parent has children
333
340
 
334
341
  if !text_found && !error330.nil?
335
342
  html_errors << error330
336
343
  error330 = nil
337
344
  end
338
345
  end
339
- #new code
340
-
346
+ #end if parent is nodeset
341
347
  else
342
348
  exist = false
343
349
  code.css(e[:parent]).each do |code_css|
@@ -352,9 +358,13 @@ class CodeTerminator::Html
352
358
  html_errors << new_error(element: e, type: 330, description: "The text inside `<#{e[:parent]}>` should be #{e[:content]}")
353
359
  end
354
360
  end
355
- end
361
+ #end if parent < 2
362
+
363
+ end
364
+ #end if content is null
356
365
 
357
366
  else
367
+ #item class is different to text or comment
358
368
 
359
369
  if code.css(e[:tag]).length > 0
360
370
 
@@ -367,7 +377,11 @@ class CodeTerminator::Html
367
377
  else
368
378
  if tag.attribute(e[:attribute]).value != e[:value]
369
379
  exist_in_body << false
370
- error333 = new_error(element: e, type: 333, description: "Make sure that the attribute #{e[:attribute]} in `<#{e[:tag]}>` has the value #{e[:value]}")
380
+ # p "type " + e[:tag] + " with attribute " + e[:attribute] + " value " + e[:value]
381
+ # Check if the img have attribute src and value is null, the user can write whatever image he wants
382
+ if !(e[:tag] == "img" && e[:attribute] == "src" && e[:value] == "")
383
+ error333 = new_error(element: e, type: 333, description: "Make sure that the attribute #{e[:attribute]} in `<#{e[:tag]}>` has the value #{e[:value]}")
384
+ end
371
385
  else
372
386
  exist_in_body << true
373
387
  end
@@ -1,3 +1,3 @@
1
1
  module CodeTerminator
2
- VERSION = "0.4.14"
2
+ VERSION = "0.4.15"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code_terminator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.14
4
+ version: 0.4.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evelin Ponce
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-20 00:00:00.000000000 Z
11
+ date: 2017-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -160,6 +160,7 @@ files:
160
160
  - exercises/issue13.html
161
161
  - exercises/issue14.html
162
162
  - exercises/issue15.html
163
+ - exercises/issue16.html
163
164
  - exercises/new.html
164
165
  - exercises/new2.html
165
166
  - exercises/test.css