CSS-Prepare

 view release on metacpan or  search on metacpan

t/04.hacks.t  view on Meta::CPAN

                selectors => [ 'div' ],
                block     => {
                    'color'  => 'red', 
                    '_color' => 'blue',
                },
            },
        );

    $output = $preparer_with->output_as_string( @structure );
    ok( $output eq $css )
        or say "underscore hack with hacks was:\n" . $output;
    $output = $preparer_without->output_as_string( @structure );
    ok( $output eq $css )
        or say "underscore hack without hacks was:\n" . $output;
    
    $css = <<CSS;
div {
    color:                  red;
    _color:                 blue;
}
CSS
    $output = $preparer_with_pretty->output_as_string( @structure );
    ok( $output eq $css )
        or say "underscore hack without hacks was:\n" . $output;
}

# 'zoom:1'
{
    $css = <<CSS;
div{zoom:1;}
CSS
    @structure = (
            {
                selectors => [ 'div' ],
                block     => {
                    'zoom'  => '1',
                },
            },
        );

    $output = $preparer_with->output_as_string( @structure );
    ok( $output eq $css )
        or say "zoom:1 with hacks was:\n" . $output;
    $output = $preparer_without->output_as_string( @structure );
    ok( $output eq $css )
        or say "zoom:1 hack without hacks was:\n" . $output;
    
    $css = <<CSS;
div {
    zoom:                   1;
}
CSS
    $output = $preparer_with_pretty->output_as_string( @structure );
    ok( $output eq $css )
        or say "zoom:1 hack without hacks was:\n" . $output;
}

# filters
{
    $css = <<CSS;
div{filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#ff9999aa,endColorstr=#ff333344);}
CSS
@structure = (
        {
            original  => ' filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ff9999aa,endColorstr=#ff333344); ',
            selectors => [ 'div' ],
            errors    => [],
            block     => {
                'filter'  => 'progid:DXImageTransform.Microsoft.gradient(startColorstr=#ff9999aa,endColorstr=#ff333344)',
            },
        },
    );

    $output = $preparer_with->output_as_string( @structure );
    ok( $output eq $css )
        or say "filter with hacks was:\n" . $output;
    $output = $preparer_without->output_as_string( @structure );
    ok( $output eq $css )
        or say "filter without hacks was:\n" . $output;
    
    $css = <<CSS;
div {
    filter:                 progid:DXImageTransform.Microsoft.gradient(startColorstr=#ff9999aa,endColorstr=#ff333344);
}
CSS
    $output = $preparer_with_pretty->output_as_string( @structure );
    ok( $output eq $css )
        or say "filter without hacks was:\n" . $output;
}

# verbatim comments
{
    $css = <<CSS;
/* IE hack */
CSS
    @structure = (
            {
                type => 'verbatim',
                string => "/* IE hack */\n",
            },
        );

    $output = $preparer_with->output_as_string( @structure );
    ok( $output eq $css )
        or say "verbatim with hacks was:\n" . $output;
    $output = $preparer_without->output_as_string( @structure );
    ok( $output eq $css )
        or say "verbatim without hacks was:\n" . $output;
    $output = $preparer_with_pretty->output_as_string( @structure );
    ok( $output eq $css )
        or say "verbatim without hacks was:\n" . $output;
}

# verbatim blocks
{
    $css = <<CSS;
div {
    blah: 0;
}
CSS
    @structure = (
            {
                type => 'verbatim',
                string => "div {\n    blah: 0;\n}\n",
            },
        );
    
    $output = $preparer_with->output_as_string( @structure );
    ok( $output eq $css )
        or say "verbatim block with hacks was:\n" . $output;
    $output = $preparer_without->output_as_string( @structure );
    ok( $output eq $css )
        or say "verbatim block without hacks was:\n" . $output;
    $output = $preparer_with_pretty->output_as_string( @structure );
    ok( $output eq $css )
        or say "verbatim block without hacks was:\n" . $output;
}

# chunking boundaries
{
    $css = <<CSS;
li{color:#000;}
h1{color:#000;}



( run in 0.928 second using v1.01-cache-2.11-cpan-5735350b133 )