CSS-DOM

 view release on metacpan or  search on metacpan

t/property-parser.t  view on Meta::CPAN

 $s->cursor($_);
 is $s->cursor, $_, "cursor value: \L$_"
}

use tests 2; # direction
for(qw/ ltr rtl /) {
 $s->direction($_);
 is $s->direction, $_, "direction value: \L$_"
}

use tests 16; # display
for(qw/ inline block list-item run-in inline-block table inline-table
        table-row-group table-header-group table-footer-group table-row
        table-column-group table-column table-cell table-caption none /) {
 $s->display($_);
 is $s->display, $_, "display value: \L$_"
}

use tests 6; # elevation
for(qw/ 70deg below level above higher lower /) {
 $s->elevation($_);
 is $s->elevation, $_, "elevation value: \L$_"
}

use tests 2; # empty-cells
for(qw/ show hide /) {
 $s->emptyCells($_);
 is $s->emptyCells, $_, "empty-cells value: \L$_"
}

use tests 3; # float
for(qw/ left right none /) {
 $s->float($_);
 is $s->float, $_, "float value: \L$_"
}

use tests 10; # font-family
for(qw/ serif sans-serif cursive fantasy monospace "Times" Times /,
    'Lucida Grande',
    'serif, sans-serif, Lucida Grande',
    'Lucida Grande, Times, fantasy',
) {
 $s->fontFamily($_);
 is $s->fontFamily, $_, "font-family value: \L$_"
}

use tests 11; # font-size
for(qw/ xx-small x-small small medium large x-large xx-large larger smaller
        5px 5% /) {
 $s->fontSize($_);
 is $s->fontSize, $_, "font-size value: \L$_"
}

use tests 2; # font-variant
for(qw/ normal small-caps /) {
 $s->fontVariant($_);
 is $s->fontVariant, $_, "font-variant value: \L$_"
}

use tests 13; # font-weight
for(qw/ normal bold bolder lighter 100 200 300 400 500 600 700 800 900 /) {
 $s->fontWeight($_);
 is $s->fontWeight, $_, "font-weight value: \L$_"
}

use tests 25; # font
{
 my $props = sub {
  return join ",", map $s->getPropertyValue($_),
   qw(
    font-style font-variant font-weight font-size line-height font-family
   )
 };
 $s->font('13px my font');
 is $s->font, '13px my font', "font: size typeface";
 is &$props, 'normal,normal,normal,13px,normal,my font',
  "other sub-properties after setting font to size/typeface";
 $s->font('italic medium medium');
 is $s->font, 'italic medium medium', "font: style size typeface";
 is &$props, 'italic,normal,normal,medium,normal,medium',
  "other sub-properties after setting font to style/size/typeface";
 $s->font('small-caps medium "quoted  font"');
 is $s->font, 'small-caps medium "quoted  font"',
  "font: variant size typeface";
 is &$props, 'normal,small-caps,normal,medium,normal,"quoted  font"',
  "other sub-properties after setting font to variant/size/typeface";
 $s->font('100 medium foo');
 is $s->font, '100 medium foo',
  "font: weight size typeface";
 is &$props, 'normal,normal,100,medium,normal,foo',
  "other sub-properties after setting font to weight/size/typeface";
 $s->font('medium/13px foo');
 is $s->font, 'medium/13px foo',
  "font: size/leading typeface";
 is &$props, 'normal,normal,normal,medium,13px,foo',
  "other sub-properties after setting font to size/leading/typeface";
 $s->font('normal bold italic 0 foo');
 is $s->font, 'italic bold 0 foo',
  "font with first three sub-props out of order and normal variant";
 is &$props, 'italic,normal,bold,0,normal,foo',
  "result of setting font with normal variant & props out of order";
 $s->font('small-caps normal 0 foo');
 is $s->font, 'small-caps 0 foo',
  "font with first 2/3 sub-props & explicit variant (normal applies to 2)";
 is &$props, 'normal,small-caps,normal,0,normal,foo',
  "result of setting font with small-caps normal";
 $s->font('bold italic small-caps 0/5px Times, serif');
 is $s->font, 'italic small-caps bold 0/5px Times, serif',
  "font with all sub props and comma in typeface";
 is &$props, 'italic,small-caps,bold,0,5px,Times, serif',
  "result of setting font with all sub-props";

 $s->font('caption');
 is &$props,
  'normal,normal,normal,13px,normal,Lucida Grande, sans-serif',
  "sub-props after setting font to caption";
 $s->font('');$s->font('icon');
 is &$props,
  'normal,normal,normal,13px,normal,Lucida Grande, sans-serif',
  "sub-props after setting font to icon";
 $s->font('');$s->font('menu');
 is &$props,
  'normal,normal,normal,13px,normal,Lucida Grande, sans-serif',
  "sub-props after setting font to menu";
 $s->font('');$s->font('message-box');
 is &$props,
  'normal,normal,normal,13px,normal,Lucida Grande, sans-serif',
  "sub-props after setting font to message-box";
 $s->font('');$s->font('small-caption');
 is &$props,
  'normal,normal,normal,11px,normal,Lucida Grande, sans-serif',
  "sub-props after setting font to small-caption";
 $s->font('');$s->font('status-bar');
 is &$props,
  'normal,normal,normal,10px,normal,Lucida Grande, sans-serif',
  "sub-props after setting font to status-bar";

 $s->lineHeight('');
 is $s->font, '', 'font is blank when not all sub-props are specified';

 $s->font('');
 is $s->font, '', "setting font to nothing ...";
 is &$props, ',,,,,', " ... resets all its sub-properties";
}

use tests 3; # height
for(qw( 5em 5% auto )) {
 $s->height($_);
 is $s->height, $_, "height value: \L$_"
}

use tests 3; # left
for(qw( 5em 5% auto )) {
 $s->left($_);
 is $s->left, $_, "left value: \L$_"
}

use tests 2; # letter-spacing
for(qw( 5em normal )) {
 $s->letterSpacing($_);
 is $s->letterSpacing, $_, "letter-spacing value: \L$_"
}

use tests 4; # line-height
for(qw( 5em 5% 5 normal )) {
 $s->lineHeight($_);
 is $s->lineHeight, $_, "line-height value: \L$_"
}

use tests 2; # list-style-image



( run in 0.588 second using v1.01-cache-2.11-cpan-39bf76dae61 )