HTML-OSM

 view release on metacpan or  search on metacpan

t/function.t  view on Meta::CPAN


subtest 'new: CDN URLs overridable' => sub {
	my $m = HTML::OSM->new(css_url => 'https://my.cdn/leaflet.css',
	                        gpx_js_url => 'https://my.cdn/gpx.js');
	is($m->{css_url},    'https://my.cdn/leaflet.css', 'css_url overridden');
	is($m->{gpx_js_url}, 'https://my.cdn/gpx.js',     'gpx_js_url overridden');
};

subtest 'new: clone merges overrides, skips validation, is a distinct object' => sub {
	my $base  = HTML::OSM->new(zoom => 5);
	my $clone = $base->new(zoom => 9, _private_key => 'val');
	isa_ok($clone, 'HTML::OSM', 'clone isa HTML::OSM');
	is($clone->{zoom},        9,                    'clone zoom updated');
	is($clone->{height},      $CFG{DEFAULT_HEIGHT}, 'clone inherits height');
	is($clone->{_private_key}, 'val',               'arbitrary key passes clone (no validation)');
	isnt(refaddr($clone), refaddr($base), 'clone is a distinct reference');
	returns_ok($clone, { type => 'object', isa => 'HTML::OSM' }, 'clone returns HTML::OSM');
};

subtest 'new: cache default is an object with get/set' => sub {
	my $m = HTML::OSM->new();
	can_ok($m->{cache}, 'get');
	can_ok($m->{cache}, 'set');
};



( run in 1.847 second using v1.01-cache-2.11-cpan-8dfa8b56332 )