added as_HTML and dtstart_iso
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 15 Nov 2009 15:01:37 +0000 (16:01 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 15 Nov 2009 15:01:37 +0000 (16:01 +0100)
lib/HTML5TV/hCalendar.pm
t/HTML5TV-hCalendar.t

index f2a2342..cb07177 100644 (file)
@@ -46,4 +46,14 @@ sub AUTOLOAD {
 
 }
 
+sub as_HTML {
+       my $self = shift;
+       $self->{tree}->look_down( class => 'vevent' )->as_HTML('<>&');
+}
+
+sub dtstart_iso {
+       my $self = shift;
+       $self->{tree}->look_down( class => 'vevent' )->look_down( class => 'dtstart' )->attr('title');
+}
+
 1;
index 75c095d..1e4501e 100755 (executable)
@@ -3,7 +3,7 @@
 use warnings;
 use strict;
 
-use Test::More tests => 8;
+use Test::More tests => 10;
 
 use lib 'lib';
 
@@ -15,6 +15,12 @@ my $path = shift @ARGV || 'media/hCalendar.html';
 
 ok( my $hcal = HTML5TV::hCalendar->new( $path ), "new $path" );
 
+ok( my $html = $hcal->as_HTML, 'as_HTML' );
+diag $html;
+
+ok( my $date = $hcal->dtstart_iso, 'dtstart_iso' );
+diag $date;
+
 foreach my $class ( qw/organiser summary url location dtstart description/ ) {
        ok( defined( my $text = $hcal->$class ), $class );
        diag "$class: $text";