w3c_validators 1.2 → 1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -0
  3. data/.travis.yml +7 -0
  4. data/CHANGELOG +14 -2
  5. data/Gemfile +3 -0
  6. data/Gemfile.lock +43 -0
  7. data/{README.rdoc → README.md} +41 -29
  8. data/Rakefile +64 -0
  9. data/lib/w3c_validators.rb +2 -1
  10. data/lib/w3c_validators/css_validator.rb +23 -16
  11. data/lib/w3c_validators/feed_validator.rb +4 -4
  12. data/lib/w3c_validators/markup_validator.rb +29 -29
  13. data/lib/w3c_validators/message.rb +6 -2
  14. data/lib/w3c_validators/nu_validator.rb +2 -2
  15. data/lib/w3c_validators/validator.rb +48 -43
  16. data/lib/w3c_validators/version.rb +3 -0
  17. data/test/fixtures/bootstrap.min.css +6 -0
  18. data/test/fixtures/invalid_css.css +2 -0
  19. data/test/fixtures/invalid_encoding.html +10 -0
  20. data/test/fixtures/invalid_feed.xml +19 -0
  21. data/test/fixtures/invalid_html5.html +16 -0
  22. data/test/fixtures/invalid_markup.html +11 -0
  23. data/test/fixtures/valid_css.css +2 -0
  24. data/test/fixtures/valid_feed.xml +20 -0
  25. data/test/fixtures/valid_html5.html +16 -0
  26. data/test/fixtures/valid_markup.html +11 -0
  27. data/test/http_recording/css_context.yml +72 -0
  28. data/test/http_recording/css_overriding_css_profile.yml +66 -0
  29. data/test/http_recording/css_skippedstring.yml +72 -0
  30. data/test/http_recording/css_validating_big_file.yml +1423 -0
  31. data/test/http_recording/css_validating_file.yml +72 -0
  32. data/test/http_recording/css_validating_text.yml +66 -0
  33. data/test/http_recording/css_validating_text_via_file.yml +72 -0
  34. data/test/http_recording/css_validating_uri.yml +65 -0
  35. data/test/http_recording/css_vendor_extensions_as_errors.yml +65 -0
  36. data/test/http_recording/css_vendor_extensions_as_warnings.yml +62 -0
  37. data/test/http_recording/css_vendor_extensions_default.yml +62 -0
  38. data/test/http_recording/feed_validating_file.yml +49 -0
  39. data/test/http_recording/feed_validating_text.yml +46 -0
  40. data/test/http_recording/feed_validating_text_via_file.yml +49 -0
  41. data/test/http_recording/feed_validating_uri_with_soap.yml +50 -0
  42. data/test/http_recording/html5_getting_request_data.yml +51 -0
  43. data/test/http_recording/html5_validating_uri.yml +74 -0
  44. data/test/http_recording/markup_debugging_uri.yml +83 -0
  45. data/test/http_recording/markup_overriding_charset.yml +125 -0
  46. data/test/http_recording/markup_overriding_charset_for_fallback_only.yml +76 -0
  47. data/test/http_recording/markup_overriding_doctype.yml +208 -0
  48. data/test/http_recording/markup_overriding_doctype_for_fallback_only.yml +84 -0
  49. data/test/http_recording/markup_validating_file.yml +93 -0
  50. data/test/http_recording/markup_validating_text.yml +67 -0
  51. data/test/http_recording/markup_validating_text_via_file.yml +93 -0
  52. data/test/http_recording/markup_validating_uri_with_head_request.yml +38 -0
  53. data/test/http_recording/markup_validating_uri_with_soap.yml +76 -0
  54. data/test/http_recording/markup_validator_abort.yml +50 -0
  55. data/test/http_recording/markup_validator_contains_details_of_error_conditions.yml +76 -0
  56. data/test/test_css_validator.rb +78 -17
  57. data/test/test_exceptions.rb +11 -8
  58. data/test/test_feed_validator.rb +42 -39
  59. data/test/test_helper.rb +7 -2
  60. data/test/test_html5_validator.rb +42 -34
  61. data/test/test_markup_validator.rb +75 -52
  62. data/test/test_proxy.rb +5 -2
  63. data/w3c_validators.gemspec +24 -0
  64. metadata +154 -68
@@ -0,0 +1,67 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://validator.w3.org/check
6
+ body:
7
+ encoding: UTF-8
8
+ string: "--349832898984244898448024464570528145\r\nContent-Disposition: form-data;
9
+ name=\"fragment\"\r\n\r\n <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML
10
+ 4.01 Transitional//EN\">\n <title>Test</title>\n <body>\n <div
11
+ class=\"example\">This is a test</div>\n </body>\n\r\n--349832898984244898448024464570528145\r\nContent-Disposition:
12
+ form-data; name=\"output\"\r\n\r\nsoap12\r\n--349832898984244898448024464570528145--\r\n"
13
+ headers:
14
+ Content-Type:
15
+ - multipart/form-data; boundary=349832898984244898448024464570528145
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ Accept:
19
+ - "*/*"
20
+ User-Agent:
21
+ - Ruby
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ Date:
28
+ - Sun, 30 Oct 2016 16:47:17 GMT
29
+ Server:
30
+ - Apache/2.4.10 (Debian)
31
+ X-W3c-Validator-Recursion:
32
+ - '1'
33
+ X-W3c-Validator-Status:
34
+ - Valid
35
+ X-W3c-Validator-Errors:
36
+ - '0'
37
+ X-W3c-Validator-Warnings:
38
+ - '2'
39
+ Transfer-Encoding:
40
+ - chunked
41
+ Content-Type:
42
+ - application/soap+xml; charset=UTF-8
43
+ Strict-Transport-Security:
44
+ - max-age=15552015; preload
45
+ Public-Key-Pins:
46
+ - pin-sha256="cN0QSpPIkuwpT6iP2YjEo1bEwGpH/yiUn6yhdy+HNto="; pin-sha256="WGJkyYjx1QMdMe0UqlyOKXtydPDVrk7sl2fV+nNm1r4=";
47
+ pin-sha256="LrKdTxZLRTvyHM4/atX2nquX9BeHRZMCxg3cf4rhc2I="; max-age=864000
48
+ X-Frame-Options:
49
+ - deny
50
+ X-Xss-Protection:
51
+ - 1; mode=block
52
+ body:
53
+ encoding: UTF-8
54
+ string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<env:Envelope xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\">\n<env:Body>\n<m:markupvalidationresponse
55
+ env:encodingStyle=\"http://www.w3.org/2003/05/soap-encoding\" xmlns:m=\"http://www.w3.org/2005/10/markup-validator\">\n
56
+ \ \n <m:uri>upload://Form Submission</m:uri>\n <m:checkedby>http://validator.w3.org/</m:checkedby>\n
57
+ \ <m:doctype>-//W3C//DTD HTML 4.01 Transitional//EN</m:doctype>\n <m:charset>utf-8</m:charset>\n
58
+ \ <m:validity>true</m:validity>\n <m:warnings>\n <m:warningcount>2</m:warningcount>\n
59
+ \ <m:warninglist>\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
60
+ \ <m:warning><m:messageid>W27</m:messageid><m:message>No Character encoding
61
+ declared at document level</m:message></m:warning>\n\n\n <m:warning><m:messageid>W28</m:messageid><m:message>Using
62
+ Direct Input mode: UTF-8 character encoding assumed</m:message></m:warning>\n\n\n\n\n\n\n
63
+ \ </m:warninglist>\n </m:warnings>\n <m:errors>\n <m:errorcount>0</m:errorcount>\n
64
+ \ <m:errorlist>\n\n </m:errorlist>\n </m:errors>\n</m:markupvalidationresponse>\n</env:Body>\n</env:Envelope>\n"
65
+ http_version:
66
+ recorded_at: Sun, 30 Oct 2016 16:47:17 GMT
67
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,93 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://validator.w3.org/check
6
+ body:
7
+ encoding: UTF-8
8
+ string: "--349832898984244898448024464570528145\r\nContent-Disposition: form-data;
9
+ name=\"output\"\r\n\r\nsoap12\r\n--349832898984244898448024464570528145\r\nContent-Disposition:
10
+ form-data; name=\"uploaded_file\"; filename=\"#<File:0x00000003d72f00>\"\r\nContent-Type:
11
+ text/html\r\n\r\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
12
+ \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\"
13
+ xml:lang=\"en-ca\" lang=\"en-ca\">\n<head>\n\t<meta http-equiv=\"Content-type\"
14
+ content=\"text/html; charset=utf-8\" />\n\t<title>W3C Validators -- Invalid
15
+ Test Page </title>\n</head>\n<body>\n<p unknown=\"true\">Invalid!</p>\n<!--
16
+ 1 error; 0 warnings -->\n</body>\n</html>\n\r\n--349832898984244898448024464570528145--\r\n"
17
+ headers:
18
+ Content-Type:
19
+ - multipart/form-data; boundary=349832898984244898448024464570528145
20
+ Accept-Encoding:
21
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
22
+ Accept:
23
+ - "*/*"
24
+ User-Agent:
25
+ - Ruby
26
+ response:
27
+ status:
28
+ code: 200
29
+ message: OK
30
+ headers:
31
+ Date:
32
+ - Sun, 30 Oct 2016 16:51:16 GMT
33
+ Server:
34
+ - Apache/2.4.10 (Debian)
35
+ X-W3c-Validator-Recursion:
36
+ - '1'
37
+ X-W3c-Validator-Status:
38
+ - Invalid
39
+ X-W3c-Validator-Errors:
40
+ - '1'
41
+ X-W3c-Validator-Warnings:
42
+ - '0'
43
+ Transfer-Encoding:
44
+ - chunked
45
+ Content-Type:
46
+ - application/soap+xml; charset=UTF-8
47
+ Strict-Transport-Security:
48
+ - max-age=15552015; preload
49
+ Public-Key-Pins:
50
+ - pin-sha256="cN0QSpPIkuwpT6iP2YjEo1bEwGpH/yiUn6yhdy+HNto="; pin-sha256="WGJkyYjx1QMdMe0UqlyOKXtydPDVrk7sl2fV+nNm1r4=";
51
+ pin-sha256="LrKdTxZLRTvyHM4/atX2nquX9BeHRZMCxg3cf4rhc2I="; max-age=864000
52
+ X-Frame-Options:
53
+ - deny
54
+ X-Xss-Protection:
55
+ - 1; mode=block
56
+ body:
57
+ encoding: UTF-8
58
+ string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<env:Envelope xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\">\n<env:Body>\n<m:markupvalidationresponse
59
+ env:encodingStyle=\"http://www.w3.org/2003/05/soap-encoding\" xmlns:m=\"http://www.w3.org/2005/10/markup-validator\">\n
60
+ \ \n <m:uri>#&lt;File:0x00000003d72f00&gt;</m:uri>\n <m:checkedby>http://validator.w3.org/</m:checkedby>\n
61
+ \ <m:doctype>-//W3C//DTD XHTML 1.0 Transitional//EN</m:doctype>\n <m:charset>utf-8</m:charset>\n
62
+ \ <m:validity>false</m:validity>\n <m:warnings>\n <m:warningcount>0</m:warningcount>\n
63
+ \ <m:warninglist>\n \n </m:warninglist>\n </m:warnings>\n
64
+ \ <m:errors>\n <m:errorcount>1</m:errorcount>\n <m:errorlist>\n\n
65
+ \ <m:error>\n <m:line>8</m:line>\n <m:col>12</m:col>\n
66
+ \ <m:message>there is no attribute &quot;unknown&quot;</m:message>\n
67
+ \ <m:messageid>108</m:messageid>\n <m:explanation>
68
+ \ <![CDATA[\n <p class=\"helpwanted\">\n <a\n href=\"feedback.html?uri=;errmsg_id=108#errormsg\"\n\ttitle=\"Suggest
69
+ improvements on this error message through our feedback channels\" \n >&#x2709;</a>\n
70
+ \ </p>\n\n <div class=\"ve mid-108\">\n <p>\n You have used the
71
+ attribute named above in your document, but the\n document type you are
72
+ using does not support that attribute for this\n element. This error
73
+ is often caused by incorrect use of the \"Strict\"\n document type with
74
+ a document that uses frames (e.g. you must use\n the \"Transitional\"
75
+ document type to get the \"target\" attribute), or\n by using vendor
76
+ proprietary extensions such as \"marginheight\" (this\n is usually fixed
77
+ by using CSS to achieve the desired effect instead).\n </p>\n <p>\n
78
+ \ This error may also result if the element itself is not supported in\n
79
+ \ the document type you are using, as an undefined element will have no\n
80
+ \ supported attributes; in this case, see the element-undefined error\n
81
+ \ message for further information.\n </p>\n <p>\n How to fix:
82
+ check the spelling and case of the element and attribute, \n (Remember
83
+ XHTML is all lower-case) and/or \n check that they are both allowed in
84
+ the chosen document type, and/or\n use CSS instead of this attribute.
85
+ If you received this error when using the \n &lt;embed&gt; element to
86
+ incorporate flash media in a Web page, see the \n <a href=\"docs/help.html#faq-flash\">FAQ
87
+ item on valid flash</a>.\n </p>\n </div>\n\n ]]>\n </m:explanation>\n
88
+ \ <m:source><![CDATA[&#60;p unknown=<strong title=\"Position
89
+ where error was detected.\">&#34;</strong>true&#34;&#62;Invalid!&#60;/p&#62;]]></m:source>\n
90
+ \ </m:error>\n \n </m:errorlist>\n </m:errors>\n</m:markupvalidationresponse>\n</env:Body>\n</env:Envelope>\n"
91
+ http_version:
92
+ recorded_at: Sun, 30 Oct 2016 16:51:17 GMT
93
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: head
5
+ uri: https://validator.w3.org/check?output=soap12&uri=https://doc75.github.io/w3c_validators_tests/invalid_markup_4.html
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - "*/*"
12
+ User-Agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Date:
20
+ - Sun, 30 Oct 2016 17:10:37 GMT
21
+ Server:
22
+ - Apache
23
+ X-W3c-Validator-Recursion:
24
+ - '1'
25
+ X-W3c-Validator-Status:
26
+ - Invalid
27
+ X-W3c-Validator-Errors:
28
+ - '1'
29
+ X-W3c-Validator-Warnings:
30
+ - '0'
31
+ Content-Type:
32
+ - application/soap+xml; charset=UTF-8
33
+ body:
34
+ encoding: UTF-8
35
+ string: ''
36
+ http_version:
37
+ recorded_at: Sun, 30 Oct 2016 17:10:38 GMT
38
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,76 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://validator.w3.org/check?output=soap12&uri=https://doc75.github.io/w3c_validators_tests/invalid_markup_5.html
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Sun, 30 Oct 2016 17:10:39 GMT
23
+ Server:
24
+ - Apache
25
+ X-W3c-Validator-Recursion:
26
+ - '1'
27
+ X-W3c-Validator-Status:
28
+ - Invalid
29
+ X-W3c-Validator-Errors:
30
+ - '1'
31
+ X-W3c-Validator-Warnings:
32
+ - '0'
33
+ Transfer-Encoding:
34
+ - chunked
35
+ Content-Type:
36
+ - application/soap+xml; charset=UTF-8
37
+ body:
38
+ encoding: UTF-8
39
+ string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<env:Envelope xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\">\n<env:Body>\n<m:markupvalidationresponse
40
+ env:encodingStyle=\"http://www.w3.org/2003/05/soap-encoding\" xmlns:m=\"http://www.w3.org/2005/10/markup-validator\">\n
41
+ \ \n <m:uri>https://doc75.github.io/w3c_validators_tests/invalid_markup_5.html</m:uri>\n
42
+ \ <m:checkedby>https://validator.w3.org/</m:checkedby>\n
43
+ \ <m:doctype>-//W3C//DTD XHTML 1.0 Transitional//EN</m:doctype>\n <m:charset>utf-8</m:charset>\n
44
+ \ <m:validity>false</m:validity>\n <m:errors>\n <m:errorcount>1</m:errorcount>\n
45
+ \ <m:errorlist>\n \n <m:error>\n <m:line>8</m:line>\n
46
+ \ <m:col>13</m:col>\n <m:message>there is no
47
+ attribute &quot;unknown5&quot;</m:message>\n <m:messageid>108</m:messageid>\n
48
+ \ <m:explanation> <![CDATA[\n <p class=\"helpwanted\">\n
49
+ \ <a\n href=\"feedback.html?uri=https%3A%2F%2Fdoc75.github.io%2Fw3c_validators_tests%2Finvalid_markup_5.html;errmsg_id=108#errormsg\"\n\ttitle=\"Suggest
50
+ improvements on this error message through our feedback channels\" \n >&#x2709;</a>\n
51
+ \ </p>\n\n <div class=\"ve mid-108\">\n <p>\n You have used the
52
+ attribute named above in your document, but the\n document type you are
53
+ using does not support that attribute for this\n element. This error
54
+ is often caused by incorrect use of the \"Strict\"\n document type with
55
+ a document that uses frames (e.g. you must use\n the \"Transitional\"
56
+ document type to get the \"target\" attribute), or\n by using vendor
57
+ proprietary extensions such as \"marginheight\" (this\n is usually fixed
58
+ by using CSS to achieve the desired effect instead).\n </p>\n <p>\n
59
+ \ This error may also result if the element itself is not supported in\n
60
+ \ the document type you are using, as an undefined element will have no\n
61
+ \ supported attributes; in this case, see the element-undefined error\n
62
+ \ message for further information.\n </p>\n <p>\n How to fix:
63
+ check the spelling and case of the element and attribute, \n (Remember
64
+ XHTML is all lower-case) and/or \n check that they are both allowed in
65
+ the chosen document type, and/or\n use CSS instead of this attribute.
66
+ If you received this error when using the \n &lt;embed&gt; element to
67
+ incorporate flash media in a Web page, see the \n <a href=\"docs/help.html#faq-flash\">FAQ
68
+ item on valid flash</a>.\n </p>\n </div>\n\n ]]>\n </m:explanation>\n
69
+ \ <m:source><![CDATA[&#60;p unknown5=<strong title=\"Position
70
+ where error was detected.\">&#34;</strong>true&#34;&#62;Invalid!&#60;/p&#62;]]></m:source>\n
71
+ \ </m:error>\n \n </m:errorlist>\n </m:errors>\n
72
+ \ <m:warnings>\n <m:warningcount>0</m:warningcount>\n <m:warninglist>\n
73
+ \ \n \n </m:warninglist>\n </m:warnings>\n</m:markupvalidationresponse>\n</env:Body>\n</env:Envelope>\n"
74
+ http_version:
75
+ recorded_at: Sun, 30 Oct 2016 17:10:40 GMT
76
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,50 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://validator.w3.org/check?debug=1&output=soap12&uri=https://doc75.github.io/w3c_validators_tests/invalid_encoding.html
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Sun, 30 Oct 2016 17:10:41 GMT
23
+ Server:
24
+ - Apache
25
+ X-W3c-Validator-Recursion:
26
+ - '1'
27
+ X-W3c-Validator-Status:
28
+ - Abort
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Content-Type:
32
+ - application/soap+xml; charset=UTF-8
33
+ body:
34
+ encoding: UTF-8
35
+ string: "<?xml version='1.0' encoding=\"utf-8\"?>\n<env:Envelope xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\"\n
36
+ \ xmlns:m='http://www.w3.org/2005/10/markup-validator'>\n <env:Body>\n
37
+ \ <env:Fault>\n <env:Code>\n <env:Value>env:Sender</env:Value>\n
38
+ \ <env:Subcode>\n <env:Value>m:Exception</env:Value>\n </env:Subcode>\n
39
+ \ </env:Code>\n\n\n\n\n\n\n <env:Reason>\n\t<env:Text xml:lang=\"en-US\">Incorrect
40
+ Bytes detected</env:Text>\n </env:Reason>\n <env:Detail>\n <m:messageid>fatal_byte_error</m:messageid>\n
41
+ \ <m:errordetail xml:lang=\"en-US\">\n Sorry, I am unable to validate
42
+ this document because on line\n 8.\n it contained one or more
43
+ bytes that I cannot interpret as\n utf-8\n (in other words,
44
+ the bytes found are not valid values in the specified\n Character Encoding).
45
+ Please check both the content of the file and the\n character encoding
46
+ indication.\n\t</m:errordetail>\n </env:Detail>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
47
+ \ </env:Fault>\n </env:Body>\n</env:Envelope>\n"
48
+ http_version:
49
+ recorded_at: Sun, 30 Oct 2016 17:10:42 GMT
50
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,76 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://validator.w3.org/check?output=soap12&uri=https://doc75.github.io/w3c_validators_tests/invalid_markup_7.html
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Sun, 30 Oct 2016 17:10:43 GMT
23
+ Server:
24
+ - Apache
25
+ X-W3c-Validator-Recursion:
26
+ - '1'
27
+ X-W3c-Validator-Status:
28
+ - Invalid
29
+ X-W3c-Validator-Errors:
30
+ - '1'
31
+ X-W3c-Validator-Warnings:
32
+ - '0'
33
+ Transfer-Encoding:
34
+ - chunked
35
+ Content-Type:
36
+ - application/soap+xml; charset=UTF-8
37
+ body:
38
+ encoding: UTF-8
39
+ string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<env:Envelope xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\">\n<env:Body>\n<m:markupvalidationresponse
40
+ env:encodingStyle=\"http://www.w3.org/2003/05/soap-encoding\" xmlns:m=\"http://www.w3.org/2005/10/markup-validator\">\n
41
+ \ \n <m:uri>https://doc75.github.io/w3c_validators_tests/invalid_markup_7.html</m:uri>\n
42
+ \ <m:checkedby>https://validator.w3.org/</m:checkedby>\n
43
+ \ <m:doctype>-//W3C//DTD XHTML 1.0 Transitional//EN</m:doctype>\n <m:charset>utf-8</m:charset>\n
44
+ \ <m:validity>false</m:validity>\n <m:errors>\n <m:errorcount>1</m:errorcount>\n
45
+ \ <m:errorlist>\n \n <m:error>\n <m:line>8</m:line>\n
46
+ \ <m:col>13</m:col>\n <m:message>there is no
47
+ attribute &quot;unknown7&quot;</m:message>\n <m:messageid>108</m:messageid>\n
48
+ \ <m:explanation> <![CDATA[\n <p class=\"helpwanted\">\n
49
+ \ <a\n href=\"feedback.html?uri=https%3A%2F%2Fdoc75.github.io%2Fw3c_validators_tests%2Finvalid_markup_7.html;errmsg_id=108#errormsg\"\n\ttitle=\"Suggest
50
+ improvements on this error message through our feedback channels\" \n >&#x2709;</a>\n
51
+ \ </p>\n\n <div class=\"ve mid-108\">\n <p>\n You have used the
52
+ attribute named above in your document, but the\n document type you are
53
+ using does not support that attribute for this\n element. This error
54
+ is often caused by incorrect use of the \"Strict\"\n document type with
55
+ a document that uses frames (e.g. you must use\n the \"Transitional\"
56
+ document type to get the \"target\" attribute), or\n by using vendor
57
+ proprietary extensions such as \"marginheight\" (this\n is usually fixed
58
+ by using CSS to achieve the desired effect instead).\n </p>\n <p>\n
59
+ \ This error may also result if the element itself is not supported in\n
60
+ \ the document type you are using, as an undefined element will have no\n
61
+ \ supported attributes; in this case, see the element-undefined error\n
62
+ \ message for further information.\n </p>\n <p>\n How to fix:
63
+ check the spelling and case of the element and attribute, \n (Remember
64
+ XHTML is all lower-case) and/or \n check that they are both allowed in
65
+ the chosen document type, and/or\n use CSS instead of this attribute.
66
+ If you received this error when using the \n &lt;embed&gt; element to
67
+ incorporate flash media in a Web page, see the \n <a href=\"docs/help.html#faq-flash\">FAQ
68
+ item on valid flash</a>.\n </p>\n </div>\n\n ]]>\n </m:explanation>\n
69
+ \ <m:source><![CDATA[&#60;p unknown7=<strong title=\"Position
70
+ where error was detected.\">&#34;</strong>true&#34;&#62;Invalid!&#60;/p&#62;]]></m:source>\n
71
+ \ </m:error>\n \n </m:errorlist>\n </m:errors>\n
72
+ \ <m:warnings>\n <m:warningcount>0</m:warningcount>\n <m:warninglist>\n
73
+ \ \n \n </m:warninglist>\n </m:warnings>\n</m:markupvalidationresponse>\n</env:Body>\n</env:Envelope>\n"
74
+ http_version:
75
+ recorded_at: Sun, 30 Oct 2016 17:10:44 GMT
76
+ recorded_with: VCR 3.0.3
@@ -16,36 +16,97 @@ class CSSValidatorTests < Test::Unit::TestCase
16
16
  end
17
17
 
18
18
  def test_overriding_css_profile
19
- @v.set_profile!(:svgbasic)
20
- r = @v.validate_text(@invalid_fragment)
21
- assert_equal 'svgbasic', r.css_level
19
+ VCR.use_cassette('css_overriding_css_profile') do
20
+ @v.set_profile!(:css21)
21
+ r = @v.validate_text(@invalid_fragment)
22
+ assert_equal 'css21', r.css_level
23
+ end
22
24
  end
23
25
 
24
26
  def test_validating_file
25
- file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/invalid_css.css')
26
- r = @v.validate_file(file_path)
27
- assert_errors r, 1
27
+ VCR.use_cassette('css_validating_file') do
28
+ file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/invalid_css.css')
29
+ r = @v.validate_file(file_path)
30
+ assert_errors r, 1
31
+ end
28
32
  end
29
33
 
30
34
  def test_validating_uri
31
- @v.set_profile!(:svgbasic)
32
- r = @v.validate_text(@invalid_fragment)
33
- assert_errors r, 1
35
+ VCR.use_cassette('css_validating_uri') do
36
+ @v.set_profile!(:svgbasic)
37
+ r = @v.validate_text(@invalid_fragment)
38
+ assert_errors r, 1
39
+ end
34
40
  end
35
-
41
+
36
42
  def test_validating_text
37
- r = @v.validate_text(@invalid_fragment)
38
- assert_errors r, 1
43
+ VCR.use_cassette('css_validating_text') do
44
+ r = @v.validate_text(@invalid_fragment)
45
+ assert_errors r, 1
46
+ end
39
47
  end
40
48
 
41
49
  def test_validating_text_via_file
42
- file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/invalid_css.css')
43
- fh = File.new(file_path, 'r+')
44
- r = @v.validate_file(fh)
45
- fh.close
46
- assert_errors r, 1
50
+ VCR.use_cassette('css_validating_text_via_file') do
51
+ file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/invalid_css.css')
52
+ fh = File.new(file_path, 'r+')
53
+ r = @v.validate_file(fh)
54
+ fh.close
55
+ assert_errors r, 1
56
+ end
57
+ end
58
+
59
+ def test_validating_big_file
60
+ VCR.use_cassette('css_validating_big_file') do
61
+ file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/bootstrap.min.css')
62
+ fh = File.new(file_path, 'r+')
63
+ r = @v.validate_file(fh)
64
+ fh.close
65
+ assert_errors r
66
+ end
47
67
  end
48
68
 
69
+ def test_context
70
+ VCR.use_cassette('css_context') do
71
+ file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/invalid_css.css')
72
+ results = @v.validate_file(file_path)
73
+ assert results.errors.first.context == "body"
74
+ end
75
+ end
49
76
 
77
+ def test_skippedstring
78
+ VCR.use_cassette('css_skippedstring') do
79
+ file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/invalid_css.css')
80
+ results = @v.validate_file(file_path)
81
+ assert results.errors.first.skippedstring == "blue"
82
+ end
83
+ end
50
84
 
85
+ def test_vendor_extensions_default
86
+ VCR.use_cassette('css_vendor_extensions_default') do
87
+ @v.set_vendor_extension_warning!
88
+ r = @v.validate_text("p { -moz-border-radius: 5px; }")
89
+ assert_errors r, 0
90
+ assert_warnings r, 1
91
+ end
92
+ end
93
+
94
+ def test_vendor_extensions_as_errors
95
+ VCR.use_cassette('css_vendor_extensions_as_errors') do
96
+ @v.set_vendor_extension_warning!('Errors')
97
+ r = @v.validate_text('some-class { -moz-border-radius: 3px; }')
98
+ assert_errors r, 1
99
+ assert_no_warnings r
100
+ end
101
+ end
102
+
103
+ def test_vendor_extensions_as_warnings
104
+ VCR.use_cassette('css_vendor_extensions_as_warnings') do
105
+ @v.set_vendor_extension_warning!('Warnings')
106
+ r = @v.validate_text('some-class { -moz-border-radius: 3px; }')
107
+ assert_no_errors r
108
+ assert_warnings r, 1
109
+ end
110
+ end
111
+
51
112
  end