Ticket #3407: 3407_TC.patch

File 3407_TC.patch, 2.7 KB (added by Garry Yao, 15 years ago)
  • _source/tests/plugins/htmldataprocessor/htmldataprocessor.html

     
    2121{
    2222        // Local references.
    2323        var assert = CKEDITOR.test.assert;
     24        var doc = new CKEDITOR.dom.document( document );
    2425
    2526        // In these tests, we may "reset" the writer rules to avoid it formatting
    2627        // the output, making the assertion easier to the done. We don't need to
     
    3233                return dataProcessor;
    3334        };
    3435
     36        /**
     37         * IE always returning CRLF for linefeed, so remove it when retrieve pre-formated text from text area.
     38         * @param {Object} id
     39         */
     40        function getTextAreaValue( id )
     41        {
     42                return CKEDITOR.document.getById( id ).getValue().replace(/\r/gi,'');
     43        }
     44
    3545        // These tests go far beyond the strict htmlDataProcessor code testing. We
    3646        // are actually testing the entire parsing system here. The combination of
    3747        // htmlParser and htmlWriter inside htmlDataProcessor is useful in this
     
    217227                        assert.areSame( expected, dataProcessor.toHtml( '<p>Some text<br></p>' ));
    218228                },
    219229
     230                test_ticket_3407 : function()
     231                {
     232                        var editor = CKEDITOR.instances.editor1,
     233                                dataProcessor = editor.dataProcessor,
     234                                config = editor.config;
     235
     236                        config.protectedSource.push( /<\?[\s\S]*?\?>/g );   // PHP Code
     237                        config.protectedSource.push( /<%[\s\S]*?%>/g );   // ASP Code
     238                        config.protectedSource.push( /(<asp:[^\>]+>[\s|\S]*?<\/asp:[^\>]+>)|(<asp:[^\>]+\/>)/gi );   // ASP.Net Code
     239                        dataProcessor.writer = new CKEDITOR.htmlParser.basicWriter();
     240                        var html = getTextAreaValue( '_TEXTAREA1' );
     241                        var protectedHtml = dataProcessor.toHtml( html );
     242                        assert.areSame( html , dataProcessor.toDataFormat( protectedHtml ) );
     243                },
     244
    220245                name : document.title
    221246        };
    222247})() );
    223248
    224 //window.onload = function()
    225 //{
    226 //      testCase.test_toDataFormat_ticket_3036();
    227 //}
    228 
     249//window.onload = testCase.test_ticket_3407;
    229250        //]]>
    230251        </script>
    231252</head>
    232253<body>
    233254        <textarea id="editor1" class="ckeditor" cols="80" rows="10"></textarea>
     255        <textarea id="_TEXTAREA1"><script type="text/javascript">alert('>');</script><table><tbody><tr><!--- IE doesn't handle this comment ---><!--[if gte IE 6 ]>
     256        <![if lt IE 8 ]>
     257        gIE conditional comments
     258<![endif]>
     259<![endif]--><td><%Response.Write(now())%></td><td><asp:control_name id="some_id" runat="server"/></td><td><?php
     260include ("head.html"); ?></td></tr></tbody></table><noscript>Your browser doesn't support JavaScript</noscript></textarea>
    234261</body>
    235262</html>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy