chromium/third_party/blink/web_tests/editing/pasteboard/paste_text_with_text_transform.html

<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
// See detail in http://wkb.ug/3429
test(() => {
    assert_not_equals(window.testRunner, undefined,
        'This test requires testRunner to read/write clipboard.');
    assert_selection(
        [
            '<div contenteditable>',
                '<span style="text-transform: capitalize;">^this should not be capitalized|</span>',
                '<span id="target">bar</span>',
            '</div>',
        ].join(''),
        selection => {
            selection.document.execCommand('copy');
            let target = selection.document.getElementById('target');
            selection.collapse(target, 1);
            selection.document.execCommand('pasteAndMatchStyle');
        },
        [
            '<div contenteditable>',
                '<span style="text-transform: capitalize;">this should not be capitalized</span>',
                '<span id="target">barthis should not be capitalized|</span>',
            '</div>',
        ].join(''));
    }, 'text-transform should not affect plain text copy');

test(() => {
    assert_not_equals(window.testRunner, undefined,
        'This test requires testRunner to read/write clipboard.');
    assert_selection(
        [
            '<div contenteditable>',
                '<span style="text-transform: capitalize;">^\u00DF|</span>',
                '<span id="target">Paste here:</span>',
            '</div>',
        ].join(''),
        selection => {
            selection.document.execCommand('copy');
            let target = selection.document.getElementById('target');
            selection.collapse(target, 1);
            selection.document.execCommand('pasteAndMatchStyle');
        },
        [
            '<div contenteditable>',
                '<span style="text-transform: capitalize;">\u00DF</span>',
                '<span id="target">Paste here:\u00DF|</span>',
            '</div>',
        ].join(''));
    }, 'copy where text-transform changes the length of the text');

test(() => {
    assert_not_equals(window.testRunner, undefined,
        'This test requires testRunner to read/write clipboard.');
    assert_selection(
        [
            '<style>',
            'p {',
            '  text-transform: capitalize;',
            '}',
            'p:first-letter {',
            '  font-size: 2em;',
            '  text-transform: uppercase;',
            '}',
            '</style>',
            '<p>^hello world|</p>',
            '<div contenteditable>',
                '<span id="target">Paste here:</span>',
            '</div>',
        ].join(''),
        selection => {
            selection.document.execCommand('copy');
            let target = selection.document.getElementById('target');
            selection.collapse(target, 1);
            selection.document.execCommand('pasteAndMatchStyle');
        },
        [
            '<style>',
            'p {',
            '  text-transform: capitalize;',
            '}',
            'p:first-letter {',
            '  font-size: 2em;',
            '  text-transform: uppercase;',
            '}',
            '</style>',
            '<p>hello world</p>',
            '<div contenteditable>',
                '<span id="target">Paste here:hello world|</span>',
            '</div>',
        ].join(''));
    }, 'copy where text-transform is used with first-letter styling');
</script>