File: 02dt.t

package info (click to toggle)
libhtml-html5-builder-perl 0.004-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 320 kB
  • sloc: perl: 3,427; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 714 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use HTML::HTML5::Builder;
use Test::More;

plan skip_all => 'Tests need DateTime'
	unless eval 'use DateTime; 1;';
plan tests => 3;

my $b  = HTML::HTML5::Builder->new;
my $dt = DateTime->now(time_zone=>'floating');

is(
	$b->time($dt)->toString,
	qq{<time xmlns="http://www.w3.org/1999/xhtml" datetime="$dt">$dt</time>},
	'time() with single DateTime argument'
	);

is(
	$b->time($dt, 'now')->toString,
	qq{<time xmlns="http://www.w3.org/1999/xhtml" datetime="$dt">now</time>},
	'time() with DateTime argument and label'
	);

is(
	$b->time($dt, $b->span('now'))->toString,
	qq{<time xmlns="http://www.w3.org/1999/xhtml" datetime="$dt"><span>now</span></time>},
	'time() with DateTime argument and nested HTML'
	);