Core.EscapeNonASCIICharacters now always works, even if target is UTF-8.
[htmlpurifier.git] / tests / HTMLPurifier / AttrTransform / EnumToCSSTest.php
blobf0381fe889d848c0b7af5e63fc15c1b427d458ba
1 <?php
3 class HTMLPurifier_AttrTransform_EnumToCSSTest extends HTMLPurifier_AttrTransformHarness
6 function setUp() {
7 parent::setUp();
8 $this->obj = new HTMLPurifier_AttrTransform_EnumToCSS('align', array(
9 'left' => 'text-align:left;',
10 'right' => 'text-align:right;'
11 ));
14 function testEmptyInput() {
15 $this->assertResult( array() );
18 function testPreserveArraysWithoutInterestingAttributes() {
19 $this->assertResult( array('style' => 'font-weight:bold;') );
22 function testConvertAlignLeft() {
23 $this->assertResult(
24 array('align' => 'left'),
25 array('style' => 'text-align:left;')
29 function testConvertAlignRight() {
30 $this->assertResult(
31 array('align' => 'right'),
32 array('style' => 'text-align:right;')
36 function testRemoveInvalidAlign() {
37 $this->assertResult(
38 array('align' => 'invalid'),
39 array()
43 function testPrependNewCSS() {
44 $this->assertResult(
45 array('align' => 'left', 'style' => 'font-weight:bold;'),
46 array('style' => 'text-align:left;font-weight:bold;')
51 function testCaseInsensitive() {
52 $this->obj = new HTMLPurifier_AttrTransform_EnumToCSS('align', array(
53 'right' => 'text-align:right;'
54 ));
55 $this->assertResult(
56 array('align' => 'RIGHT'),
57 array('style' => 'text-align:right;')
61 function testCaseSensitive() {
62 $this->obj = new HTMLPurifier_AttrTransform_EnumToCSS('align', array(
63 'right' => 'text-align:right;'
64 ), true);
65 $this->assertResult(
66 array('align' => 'RIGHT'),
67 array()
73 // vim: et sw=4 sts=4