Ticket #3997: 3997.patch

File 3997.patch, 5.0 KB (added by Artur Formella, 15 years ago)
  • _source/tests/plugins/undo/undo.html

    Property changes on: _source\tests\plugins\undo
    ___________________________________________________________________
    Added: bugtraq:label
       + Ticket
    Added: bugtraq:url
       + http://dev.fckeditor.net/ticket/%BUGID%
    Added: webviewer:pathrevision
       + http://dev.fckeditor.net/browser/%PATH%?rev=%REVISION% 
    Added: webviewer:revision
       + http://dev.fckeditor.net/changeset/%REVISION%
    Added: bugtraq:logregex
       + (?:ticket: *|#)(\d+) *(?:, *(\d+))*
    
    
     
     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: undo</title>
     5        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     6        <link rel="stylesheet" type="text/css" href="../../test.css" />
     7        <script type="text/javascript" src="../../../../ckeditor_source.js"></script>
     8        <script type="text/javascript" src="../../test.js"></script>
     9        <script type="text/javascript">
     10        //<![CDATA[
     11CKEDITOR.plugins.load( [ 'undo' ] );
     12
     13CKEDITOR.test.addTestCase( (function()
     14{
     15        // Local reference to the "assert" object.
     16        var assert = CKEDITOR.test.assert;
     17        return {
     18                test_undo_1 : function()        // basic undo test
     19                {
     20                        var testCase = this;
     21                        var dataBefore = "<p>Test2</p>";
     22                       
     23                        var afterSetData = function()
     24                        {
     25                                testCase.resume( function()
     26                                        {
     27                                                var dataTestBefore = editor.getData();
     28                                                editor.insertHtml( "<p>Test3</p>" );
     29                                                var data1rule = editor.getData();
     30                                                editor.execCommand( "horizontalrule" );
     31                                                var data2rule = editor.getData();
     32                                                editor.execCommand( "horizontalrule" );
     33                                               
     34                                                var dataAfter = editor.getData();
     35
     36                                                editor.execCommand( "undo" );
     37                                                var dataTest2rule = editor.getData();
     38                                                editor.execCommand( "undo" );
     39                                                var dataTest1rule = editor.getData();
     40                                                editor.execCommand( "redo" );
     41                                                var dataTest2arule = editor.getData();
     42                                                editor.execCommand( "redo" );
     43                                                var dataTestAfter = editor.getData();
     44
     45                                                assert.areSame( dataTest1rule, data1rule);
     46                                                assert.areSame( dataTest2rule, data2rule);
     47                                                assert.areSame( dataTest2rule, dataTest2arule);
     48                                                assert.areSame( dataTestAfter, dataAfter );     
     49                                        } );
     50                        };
     51
     52                        var editor = CKEDITOR.replace( 'editor1',
     53                        {
     54                                on :
     55                                {
     56                                        instanceReady : function()
     57                                        {
     58                                                editor.setData( dataBefore );
     59                                                setTimeout( afterSetData, 1000);
     60                                        }
     61                                }
     62                        });
     63
     64                        editor.setData( "<p>It doesn't work</p>" );
     65                        var data = editor.getData();
     66
     67                        this.wait();
     68                },
     69               
     70                test_resetUndo_1 : function()   //resetUndo test
     71                {
     72                        var testCase = this;
     73                        var dataBefore = "<p>Test2</p>";
     74                        var afterSetData = function()
     75                        {
     76                                testCase.resume( function()
     77                                        {
     78                                                editor.execCommand( "horizontalrule" );
     79                                                editor.insertHtml( "<p>Test3</p>" );
     80                                                editor.execCommand( "horizontalrule" );
     81
     82                                                editor.execCommand( "undo" );
     83
     84                                                var data1 = editor.getData();
     85
     86                                                editor.resetUndo();
     87
     88                                                editor.execCommand( "redo" );
     89                                                editor.execCommand( "undo" );
     90                                                editor.execCommand( "undo" );
     91
     92                                                var data2 = editor.getData();
     93
     94                                                editor.execCommand( "horizontalrule" );
     95                                                editor.execCommand( "horizontalrule" );
     96                                                var data3 = editor.getData();
     97                                                editor.execCommand( "undo" );
     98                                                editor.execCommand( "undo" );
     99                                                editor.execCommand( "undo" );
     100                                                var data4 = editor.getData();
     101                                                editor.execCommand( "redo" );
     102                                                editor.execCommand( "redo" );
     103                                                var data5 = editor.getData();
     104
     105                                                assert.areSame( data2, data1, "test A: resetUndo doesn\'t work" );
     106                                                assert.areSame( data2, data4, "test B: resetUndo works wrong" );
     107                                                assert.areSame( data3, data5, "test C: resetUndo works wrong" );
     108
     109                                        } );
     110                        };
     111
     112                        var editor = CKEDITOR.replace( 'editor2',
     113                        {
     114                                on :
     115                                {
     116                                        instanceReady : function()
     117                                        {
     118                                                editor.setData( dataBefore );
     119                                                setTimeout( afterSetData, 1000);
     120                                        }
     121                                }
     122                        });
     123
     124                        editor.setData( "<p>It doesn't work</p>" );
     125                        var data = editor.getData();
     126
     127                        this.wait();
     128                },
     129
     130                name : document.title
     131        };
     132})() );
     133        //]]>
     134        </script>
     135</head>
     136<body>
     137<br><br><br><br><br><br>
     138        <textarea id="editor2" cols="80" rows="10"></textarea>
     139        <textarea id="editor1" cols="80" rows="10"></textarea>
     140
     141</body>
     142</html>
  • _source/tests/testall.html

     
    2626        'core/dom/text',
    2727        'core/dom/window',
    2828        'core/htmlparser/fragment',
     29        'plugins/undo/undo',
    2930        'plugins/htmldataprocessor/htmldataprocessor',
    3031        'plugins/list/list',
    3132        'plugins/styles/styles',
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy