Ticket #3341: test_element_getOuterHtml.patch

File test_element_getOuterHtml.patch, 1.8 KB (added by Garry Yao, 15 years ago)

Unit Test Case

  • _source/tests/core/dom/element_getOuterHtml.html

     
     1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     2<html xmlns="http://www.w3.org/1999/xhtml">
     3<head>
     4        <title>CKEDITOR.dom.element</title>
     5        <link rel="stylesheet" type="text/css" href="../../test.css" />
     6        <script type="text/javascript" src="../../../../ckeditor_source.js"></script> <!-- %REMOVE_LINE%
     7        <script type="text/javascript" src="../../../ckeditor.js"></script>
     8        %REMOVE_LINE% -->
     9        <script type="text/javascript" src="../../test.js"></script>
     10        <script type="text/javascript">
     11        //<![CDATA[
     12CKEDITOR.plugins.load( 'htmldataprocessor' );
     13
     14CKEDITOR.test.addTestCase( (function()
     15{
     16        // Local reference to the "assert" object.
     17        var assert = CKEDITOR.test.assert,
     18                doc = CKEDITOR.document;
     19
     20        // In these tests, we may "reset" the writer rules to avoid it formatting
     21        // the output, making the assertion easier to the done. We don't need to
     22        // test formatting features here, so this is ok.
     23        var getDataProcessor = function()
     24        {
     25                var dataProcessor = new CKEDITOR.htmlDataProcessor();
     26                dataProcessor.writer._.rules = [];
     27                return dataProcessor;
     28        };
     29
     30        return {
     31
     32                /**
     33                 *  Retrieving custom element outer html.
     34                 */
     35                test_getOuterHtml: function()
     36                {
     37                        var target =
     38                                CKEDITOR.dom.element.createFromHtml( '<cke:custom>text</cke:custom>');
     39                        assert.areSame( '<cke:custom>text</cke:custom>',
     40                                getDataProcessor().toDataFormat( target.getOuterHtml() ) );
     41                }
     42
     43        }
     44})() );
     45
     46        //]]>
     47        </script>
     48</head>
     49<body>
     50</body>
     51</html>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy