t/tags.t: Test that Document Type Declaration (DTD or doctype) works
Jakub Narebski [Tue, 15 Dec 2009 13:47:36 +0000 (14:47 +0100)]
HTML documents are required to start with a Document Type Declaration
(informally, a 'doctype'). In browsers, the function of the doctype is
to indicate the rendering mode - particularly to avoid the quirks
mode.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>

t/tags.t

index 587bf63..dc67654 100644 (file)
--- a/t/tags.t
+++ b/t/tags.t
@@ -43,6 +43,11 @@ use Test::More qw(no_plan);
     <?xml version="1.0" encoding="UTF-8"?>;
   }
 
+  sub DTD {
+    use HTML::Tags;
+    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+  }
+
   sub globbery {
     <t/globbery/*>;
   }
@@ -87,6 +92,12 @@ is(
 );
 
 is(
+  join('', HTML::Tags::to_html_string Foo::DTD),
+  '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
+  'DTD ok'
+);
+
+is(
   join(', ', Foo::globbery),
   't/globbery/one, t/globbery/two',
   'real glob re-installed ok'