Ticket #3032: test-editor-instanceReady.patch

File test-editor-instanceReady.patch, 2.1 KB (added by Garry Yao, 15 years ago)

Functional test case.

  • _source/tests/plugins/editingblock/editingblock.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>Plugin: editingblock</title>
     5        <link rel="stylesheet" type="text/css" href="../../test.css" />
     6        <script type="text/javascript" src="../../../../ckeditor_source.js"></script>
     7        <script type="text/javascript" src="../../test.js"></script>
     8        <script type="text/javascript">
     9        //<![CDATA[
     10var testCase;
     11
     12CKEDITOR.test.addTestCase( testCase = ( function()
     13{
     14        // Local references.
     15        var assert = YAHOO.util.Assert;
     16
     17        return {
     18               
     19                /**
     20                 * Test create with append mode
     21                 */
     22                test_instanceReadyEvent4 : function()
     23            {
     24                        var editor, count = 0;
     25                        CKEDITOR.on( 'instanceReady', function(evt)
     26                    {
     27                                if( editor.element.$ == document.getElementById( 'editor4' ) )
     28                                {
     29                                        this.resume( function()
     30                                    {
     31                                                count++;
     32                                                assert.areEqual( 1, count, 'Mode "wysiwyg" doesn\'t fully interacted ready.' );
     33                                        } );
     34                                }
     35                    }, this );
     36                        editor  = CKEDITOR.appendTo( 'editor4' );
     37                    this.wait();
     38            },
     39               
     40            /**
     41                 * Test check dirty flag
     42                 */
     43            test_instanceReadyEvent5 : function()
     44            {
     45                        CKEDITOR.on( 'instanceReady', function( evt )
     46                    {
     47                                var editor = evt.editor;
     48                                if( editor.name == 'editor5' )
     49                        {
     50                                        this.resume( function()
     51                                    {
     52                                                assert.isFalse( editor.checkDirty() , 'Content should not be dirty.' );
     53                                    } );
     54                                }
     55                    }, this );
     56                       
     57                        CKEDITOR.replace( 'editor5' );
     58                    this.wait();
     59            },
     60               
     61            name :document.title
     62        };
     63} )() );
     64        //]]>
     65        </script>
     66</head>
     67<body>
     68        <div id="editor4" >text</div>
     69        <textarea id="editor5" name="editor5"></textarea>
     70</body>
     71</html>\ No newline at end of file
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy