2007-01-20 01:40:56 +00:00
|
|
|
<?php
|
|
|
|
|
2007-02-14 20:38:51 +00:00
|
|
|
class HTMLPurifier_AttrDef_CSS_BackgroundPositionTest extends HTMLPurifier_AttrDefHarness
|
2007-01-20 01:40:56 +00:00
|
|
|
{
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function test()
|
|
|
|
{
|
2007-02-14 20:38:51 +00:00
|
|
|
$this->def = new HTMLPurifier_AttrDef_CSS_BackgroundPosition();
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-01-20 01:40:56 +00:00
|
|
|
// explicitly cited in spec
|
|
|
|
$this->assertDef('0% 0%');
|
|
|
|
$this->assertDef('100% 100%');
|
|
|
|
$this->assertDef('14% 84%');
|
|
|
|
$this->assertDef('2cm 1cm');
|
|
|
|
$this->assertDef('top');
|
|
|
|
$this->assertDef('left');
|
|
|
|
$this->assertDef('center');
|
|
|
|
$this->assertDef('right');
|
|
|
|
$this->assertDef('bottom');
|
|
|
|
$this->assertDef('left top');
|
|
|
|
$this->assertDef('center top');
|
|
|
|
$this->assertDef('right top');
|
|
|
|
$this->assertDef('left center');
|
|
|
|
$this->assertDef('right center');
|
|
|
|
$this->assertDef('left bottom');
|
|
|
|
$this->assertDef('center bottom');
|
|
|
|
$this->assertDef('right bottom');
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-01-20 01:40:56 +00:00
|
|
|
// reordered due to internal impl details
|
|
|
|
$this->assertDef('top left', 'left top');
|
2010-05-05 19:08:57 +00:00
|
|
|
$this->assertDef('top center', 'top');
|
2007-01-20 01:40:56 +00:00
|
|
|
$this->assertDef('top right', 'right top');
|
2010-05-05 19:08:57 +00:00
|
|
|
$this->assertDef('center left', 'left');
|
|
|
|
$this->assertDef('center center', 'center');
|
|
|
|
$this->assertDef('center right', 'right');
|
2007-01-20 01:40:56 +00:00
|
|
|
$this->assertDef('bottom left', 'left bottom');
|
2010-05-05 19:08:57 +00:00
|
|
|
$this->assertDef('bottom center', 'bottom');
|
2007-01-20 01:40:56 +00:00
|
|
|
$this->assertDef('bottom right', 'right bottom');
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-01-20 01:40:56 +00:00
|
|
|
// more cases from the defined syntax
|
|
|
|
$this->assertDef('1.32in 4ex');
|
|
|
|
$this->assertDef('-14% -84.65%');
|
|
|
|
$this->assertDef('-1in -4ex');
|
|
|
|
$this->assertDef('-1pc 2.3%');
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-01-20 01:40:56 +00:00
|
|
|
// keyword mixing
|
|
|
|
$this->assertDef('3em top');
|
|
|
|
$this->assertDef('left 50%');
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-01-20 01:40:56 +00:00
|
|
|
// fixable keyword mixing
|
|
|
|
$this->assertDef('top 3em', '3em top');
|
|
|
|
$this->assertDef('50% left', 'left 50%');
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-01-20 01:40:56 +00:00
|
|
|
// whitespace collapsing
|
|
|
|
$this->assertDef('3em top', '3em top');
|
|
|
|
$this->assertDef("left\n \t foo ", 'left');
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-01-20 01:40:56 +00:00
|
|
|
// invalid uses (we're going to be strict on these)
|
|
|
|
$this->assertDef('foo bar', false);
|
|
|
|
$this->assertDef('left left', 'left');
|
|
|
|
$this->assertDef('left right top bottom center left', 'left bottom');
|
|
|
|
$this->assertDef('0fr 9%', '9%');
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-01-20 01:40:56 +00:00
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-01-20 01:40:56 +00:00
|
|
|
}
|
|
|
|
|
2008-12-06 09:24:59 +00:00
|
|
|
// vim: et sw=4 sts=4
|