Make WordPress Core


Ignore:
Timestamp:
11/28/2019 12:27:21 AM (7 years ago)
Author:
SergeyBiryukov
Message:

KSES: Add support for gradient backgrounds.

Props jorgefilipecosta.
Fixes #48376.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/kses.php

    r46586 r46793  
    753753         * Testing the safecss_filter_attr() function.
    754754         *
     755         * @ticket 37248
    755756         * @ticket 42729
     757         * @ticket 48376
    756758         * @dataProvider data_test_safecss_filter_attr
    757759         *
    … …  
    879881                                'expected' => 'columns: 6rem auto;column-count: 4;column-fill: balance;column-gap: 9px;column-rule: thick inset blue;column-span: none;column-width: 120px',
    880882                        ),
     883                        // Gradients introduced in 5.3.
     884                        array(
     885                                'css'      => 'background: linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
     886                                'expected' => 'background: linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
     887                        ),
     888                        array(
     889                                'css'      => 'background: linear-gradient(135deg,rgba(6,147,227,1) ) (0%,rgb(155,81,224) 100%)',
     890                                'expected' => '',
     891                        ),
     892                        array(
     893                                'css'      => 'background-image: linear-gradient(red,yellow);',
     894                                'expected' => 'background-image: linear-gradient(red,yellow)',
     895                        ),
     896                        array(
     897                                'css'      => 'color: linear-gradient(red,yellow);',
     898                                'expected' => '',
     899                        ),
     900                        array(
     901                                'css'      => 'background-image: linear-gradient(red,yellow); background: prop( red,yellow); width: 100px;',
     902                                'expected' => 'background-image: linear-gradient(red,yellow);width: 100px',
     903                        ),
     904                        array(
     905                                'css'      => 'background: unknown-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
     906                                'expected' => '',
     907                        ),
     908                        array(
     909                                'css'      => 'background: repeating-linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
     910                                'expected' => 'background: repeating-linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
     911                        ),
     912                        array(
     913                                'css'      => 'width: 100px; height: 100px; background: linear-gradient(135deg,rgba(0,208,132,1) 0%,rgba(6,147,227,1) 100%);',
     914                                'expected' => 'width: 100px;height: 100px;background: linear-gradient(135deg,rgba(0,208,132,1) 0%,rgba(6,147,227,1) 100%)',
     915                        ),
     916                        array(
     917                                'css'      => 'background: radial-gradient(#ff0, red, yellow, green, rgba(6,147,227,1), rgb(155,81,224) 90%);',
     918                                'expected' => 'background: radial-gradient(#ff0, red, yellow, green, rgba(6,147,227,1), rgb(155,81,224) 90%)',
     919                        ),
     920                        array(
     921                                'css'      => 'background: radial-gradient(#ff0, red, yellow, green, rgba(6,147,227,1), rgb(155,81,224) 90%);',
     922                                'expected' => 'background: radial-gradient(#ff0, red, yellow, green, rgba(6,147,227,1), rgb(155,81,224) 90%)',
     923                        ),
     924                        array(
     925                                'css'      => 'background: conic-gradient(at 0% 30%, red 10%, yellow 30%, #1e90ff 50%)',
     926                                'expected' => 'background: conic-gradient(at 0% 30%, red 10%, yellow 30%, #1e90ff 50%)',
     927                        ),
     928
    881929                );
    882930        }
Note: See TracChangeset for help on using the changeset viewer.