Changeset 42880
- Timestamp:
- 03/27/2018 12:53:20 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/kses.php
r42860 r42880 1965 1965 * @since 4.4.0 Added support for `min-height`, `max-height`, `min-width`, and `max-width`. 1966 1966 * @since 4.6.0 Added support for `list-style-type`. 1967 * @since 5.0.0 Added support for `text-transform`. 1967 1968 * 1968 1969 * @param array $attr List of allowed CSS attributes. … … 2007 2008 'letter-spacing', 2008 2009 'line-height', 2010 'text-align', 2009 2011 'text-decoration', 2010 2012 'text-indent', 2011 'text- align',2013 'text-transform', 2012 2014 2013 2015 'height', -
trunk/tests/phpunit/tests/kses.php
r42860 r42880 733 733 $this->assertEquals( "<{$element}>", wp_kses_attr( $element, $attribute, array( 'foo' => false ), array() ) ); 734 734 } 735 736 /** 737 * Testing the safecss_filter_attr() function. 738 * 739 * @ticket 42729 740 * @dataProvider data_test_safecss_filter_attr 741 * 742 * @param string $css A string of CSS rules. 743 * @param string $expected Expected string of CSS rules. 744 */ 745 public function test_safecss_filter_attr( $css, $expected ) { 746 $this->assertSame( $expected, safecss_filter_attr( $css ) ); 747 } 748 749 /** 750 * Data Provider for test_safecss_filter_attr(). 751 * 752 * @return array { 753 * @type array { 754 * @string string $css A string of CSS rules. 755 * @string string $expected Expected string of CSS rules. 756 * } 757 * } 758 */ 759 public function data_test_safecss_filter_attr() { 760 return array( 761 // Empty input, empty output. 762 array( 763 'css' => '', 764 'expected' => '', 765 ), 766 // An arbitrary attribute name isn't allowed. 767 array( 768 'css' => 'foo:bar', 769 'expected' => '', 770 ), 771 // A single attribute name, with a single value. 772 array( 773 'css' => 'margin-top: 2px', 774 'expected' => 'margin-top: 2px', 775 ), 776 // Backslash \ isn't supported. 777 array( 778 'css' => 'margin-top: \2px', 779 'expected' => '', 780 ), 781 // Curly bracket } isn't supported. 782 array( 783 'css' => 'margin-bottom: 2px}', 784 'expected' => '', 785 ), 786 // A single attribute name, with a single text value. 787 array( 788 'css' => 'text-transform: uppercase', 789 'expected' => 'text-transform: uppercase', 790 ), 791 // Only lowercase attribute names are supported. 792 array( 793 'css' => 'Text-transform: capitalize', 794 'expected' => '', 795 ), 796 // Uppercase attribute values goes through. 797 array( 798 'css' => 'text-transform: None', 799 'expected' => 'text-transform: None', 800 ), 801 // A single attribute, with multiple values. 802 array( 803 'css' => 'font: bold 15px arial, sans-serif', 804 'expected' => 'font: bold 15px arial, sans-serif', 805 ), 806 // Multiple attributes, with single values. 807 array( 808 'css' => 'font-weight: bold;font-size: 15px', 809 'expected' => 'font-weight: bold;font-size: 15px', 810 ), 811 // Multiple attributes, separated by a space. 812 array( 813 'css' => 'font-weight: bold; font-size: 15px', 814 'expected' => 'font-weight: bold;font-size: 15px', 815 ), 816 // Multiple attributes, with multiple values. 817 array( 818 'css' => 'margin: 10px 20px;padding: 5px 10px', 819 'expected' => 'margin: 10px 20px;padding: 5px 10px', 820 ), 821 // Parenthesis ( isn't supported. 822 array( 823 'css' => 'background: green url("foo.jpg") no-repeat fixed center', 824 'expected' => '', 825 ), 826 ); 827 } 735 828 }
Note: See TracChangeset
for help on using the changeset viewer.