CSS-Prepare
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
t/01.parse.t view on Meta::CPAN
use Modern::Perl;
use Test::More tests => 28;
use CSS::Prepare;
use Data::Dumper;
local $Data::Dumper::Terse = 1;
local $Data::Dumper::Indent = 1;
local $Data::Dumper::Useqq = 1;
local $Data::Dumper::Deparse = 1;
local $Data::Dumper::Quotekeys = 0;
local $Data::Dumper::Sortkeys = 1;
my $preparer = CSS::Prepare->new();
my( $css, @structure, @parsed );
# don't explode on an empty stylesheet
{
$css = q();
@structure = ();
@parsed = $preparer->parse_string( $css );
is_deeply( \@structure, \@parsed )
or say "empty stylesheet was:\n" . Dumper \@parsed;
}
# basic declaration block
{
$css = <<CSS;
h1 { color: red; }
CSS
@structure = (
{
original => ' color: red; ',
selectors => [ 'h1' ],
errors => [],
block => {
'color' => 'red',
},
},
);
@parsed = $preparer->parse_string( $css );
is_deeply( \@structure, \@parsed )
or say "basic declaration was:\n" . Dumper \@parsed;
}
# basic declaration block with lots of whitespace
{
$css = <<CSS;
h1 {
color : red;
}
CSS
@structure = (
{
original => q(
color : red;
),
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.526 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )