Ticket #3013: 3013_2.patch

File 3013_2.patch, 30.8 KB (added by Garry Yao, 15 years ago)

Minor fixes.

  • _source/tests/plugins/form/button.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: button</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[
     10CKEDITOR.test.addTestCase( ( function()
     11{
     12
     13        // Local references.
     14        var assert = CKEDITOR.test.assert;
     15        return
     16        {
     17            /**
     18             * Test insert a button element with all supported attributes.
     19             */
     20            test_createbutton : function()
     21            {
     22                    var editor = CKEDITOR.replace( 'editor1' );
     23                    editor.on( 'instanceReady', function()
     24                            {
     25                                    this.resume( function()
     26                                    {
     27                                            editor.focus();
     28                                            // async
     29                                            editor.execCommand( 'button' );
     30                                            this.wait( function()
     31                                                    {
     32                                                            var dialog = editor._.storedDialogs[ 'button' ];
     33                                                            var name = dialog.getContentElement(
     34                                                                'info', 'txtName' ), value = dialog
     35                                                                .getContentElement( 'info',
     36                                                                    'txtValue' ), type = dialog
     37                                                                .getContentElement( 'info',
     38                                                                    'txtType' );
     39
     40                                                            // Set button fields values
     41                                                            name.setValue( 'button-name' );
     42                                                            value.setValue( 'button-value' );
     43                                                            type.setValue( 'submit' );
     44
     45                                                            dialog.fire( 'ok' );
     46                                                            dialog.hide();
     47
     48                                                            var result = editor.getData(), expected = '<input name="button-name" type="submit" value="button-value" />';
     49
     50                                                            //compensate lastline
     51                                                            if ( CKEDITOR.env.gecko )
     52                                                                    expected += '<br />\n';
     53                                                            assert.areEqual( expected, result,
     54                                                                    'Created button element doesn\'t match.' );
     55
     56                                                    }, 1000 );
     57                                    } );
     58                            }, this );
     59
     60                    this.wait();
     61            },
     62
     63            name :document.title
     64        };
     65} )() );
     66        //]]>
     67        </script>
     68</head>
     69<body>
     70        <textarea id="editor1" name="editor1"></textarea>
     71</body>
     72</html>
  • _source/tests/plugins/form/checkbox.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: checkbox</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[
     10CKEDITOR.test.addTestCase( ( function()
     11    {
     12           
     13            // Local references.
     14            var assert = CKEDITOR.test.assert;
     15            return      {
     16                /**
     17                         * Test insert a checkbox element with all supported attributes.
     18                         */
     19                test_createCheckbox : function()
     20                {
     21                        var editor = CKEDITOR.replace( 'editor1' );
     22                        editor.on( 'instanceReady',
     23                                function()
     24                                {
     25                                        this.resume( function()
     26                                        {
     27                                                editor.focus();
     28                                                // async
     29                                                editor.execCommand( 'checkbox' );
     30                                                this.wait(
     31                                                        function()
     32                                                        {
     33                                                                var dialog = editor._.storedDialogs[ 'checkbox' ];
     34                                                                var name = dialog
     35                                                                    .getContentElement( 'info',
     36                                                                        'txtName' ), value = dialog
     37                                                                    .getContentElement( 'info',
     38                                                                        'txtValue' ), selected = dialog
     39                                                                    .getContentElement( 'info',
     40                                                                        'cmbSelected' );
     41
     42                                                                // Set checkbox fields values
     43                                                                name.setValue( 'checkbox-name' );
     44                                                                value.setValue( 'checked-value' );
     45                                                                selected.setValue( true );
     46
     47                                                                dialog.fire( 'ok' );
     48                                                                dialog.hide();
     49
     50                                                                var result = editor.getData(),
     51                                                                                        expected = '<input checked="true" name="checkbox-name" type="checkbox" value="checked-value" />';
     52
     53                                                                    //compensate lastline
     54                                                                if ( CKEDITOR.env.gecko )
     55                                                                        expected += '<br />\n';
     56                                                                assert.areEqual( expected, result,
     57                                                                        'Created checkbox element doesn\'t match.' );
     58
     59                                                        }, 1000 );
     60                                        } );
     61                                }, this );
     62
     63                        this.wait();
     64                },
     65
     66                name :document.title
     67            };
     68    } )() );
     69        //]]>
     70        </script>
     71</head>
     72<body>
     73        <textarea id="editor1" name="editor1"></textarea>
     74</body>
     75</html>
  • _source/tests/plugins/form/form.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: form</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[
     10CKEDITOR.test.addTestCase( ( function()
     11    {
     12            /**
     13                 * IE always returning CRLF for linefeed, so remove it when retrieve
     14                 * pre-formated text from text area.
     15                 * @param {Object} id
     16                 */
     17            function getTextAreaValue( id )
     18            {
     19                    return CKEDITOR.document.getById( id ).getValue().replace( /\r/gi, '' );
     20            }
     21            // Local references.
     22            var assert = CKEDITOR.test.assert, doc = CKEDITOR.document;
     23            return      {
     24                /**
     25                         * Test insert a form element with all supported attributes.
     26                         */
     27                test_createForm : function()
     28                {
     29                        var editor = CKEDITOR.replace( 'editor1' );
     30                        editor.on( 'instanceReady',
     31                                function()
     32                                {
     33                                        this.resume( function()
     34                                        {
     35                                                editor.focus();
     36                                                // async
     37                                                editor.execCommand( 'form' );
     38                                                this.wait(
     39                                                        function()
     40                                                        {
     41                                                                var dialog = editor._.storedDialogs[ 'form' ];
     42                                                                var name = dialog
     43                                                                    .getContentElement( 'info',
     44                                                                        'txtName' ), action = dialog
     45                                                                    .getContentElement( 'info',
     46                                                                        'txtAction' ), formId = dialog
     47                                                                    .getContentElement( 'info',
     48                                                                        'txtId' ), encoding = dialog
     49                                                                    .getContentElement( 'info',
     50                                                                        'cmbEncoding' ), target = dialog
     51                                                                    .getContentElement( 'info',
     52                                                                        'cmbTarget' ), method = dialog
     53                                                                    .getContentElement( 'info',
     54                                                                        'cmbMethod' );
     55
     56                                                                // Set form fields values
     57                                                                name.setValue( 'form-name' );
     58                                                                action.setValue( 'http://dev.fckeditor.net/newticket?' );
     59                                                                formId.setValue( 'form-id1' );
     60                                                                encoding.setValue( 'application/x-www-form-urlencoded' );
     61                                                                target.setValue( '_blank' );
     62                                                                method.setValue( 'post' );
     63
     64                                                                dialog.fire( 'ok' );
     65                                                                dialog.hide();
     66
     67                                                                var result = editor.getData(), expected;
     68                                                                if ( CKEDITOR.env.gecko )
     69                                                                        expected = getTextAreaValue( 'formResultGecko' )
     70                                                                else
     71                                                                        expected = getTextAreaValue( 'formResultIE' )
     72
     73                                                                        //compensate lastline
     74                                                                if ( CKEDITOR.env.gecko )
     75                                                                        expected += '<br />\n';
     76                                                                assert.areEqual( expected, result,
     77                                                                        'Created form element doesn\'t match.' );
     78
     79                                                        }, 1000 );
     80                                        } );
     81                                }, this );
     82
     83                        this.wait();
     84                },
     85
     86                name :document.title
     87            };
     88    } )() );
     89        //]]>
     90        </script>
     91</head>
     92<body>
     93        <textarea id="editor1" name="editor1"></textarea>
     94        <textarea id="formResultGecko"><form action="http://dev.fckeditor.net/newticket?" encoding="application/x-www-form-urlencoded" id="form-id1" method="post" name="form-name" target="_blank">
     95                <br />
     96</form></textarea>
     97        <textarea id="formResultIE"><form action="http://dev.fckeditor.net/newticket?" encoding="application/x-www-form-urlencoded" id="form-id1" method="post" name="form-name" target="_blank">
     98</form>
     99</textarea>
     100</body>
     101</html>
  • _source/tests/plugins/form/hiddenfield.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: hiddenfield</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[
     10CKEDITOR.test.addTestCase( ( function()
     11    {
     12           
     13            // Local references.
     14            var assert = CKEDITOR.test.assert;
     15            return      {
     16                /**
     17                         * Test insert a hiddenfield element with all supported attributes.
     18                         */
     19                test_createhiddenfield : function()
     20                {
     21                        var editor = CKEDITOR.replace( 'editor1' );
     22                        editor.on( 'instanceReady',
     23                                function()
     24                                {
     25                                        this.resume( function()
     26                                        {
     27                                                editor.focus();
     28                                                // async
     29                                                editor.execCommand( 'hiddenfield' );
     30                                                this.wait(
     31                                                        function()
     32                                                        {
     33                                                                var dialog = editor._.storedDialogs[ 'hiddenfield' ];
     34                                                                var name = dialog       .getContentElement( 'info', 'txtName' ),
     35                                                                                                value = dialog.getContentElement( 'info', 'txtValue' );
     36
     37                                                                // Set hiddenfield fields values
     38                                                                name.setValue( 'hiddenfield-name' );
     39                                                                value.setValue('hiddenfield-value');
     40                                                                                       
     41                                                                dialog.fire( 'ok' );
     42                                                                dialog.hide();
     43
     44                                                                var result = editor.getData(),
     45                                                                                        expected = '<input name="hiddenfield-name" type="hidden" value="hiddenfield-value" />';
     46                                                                                       
     47                                                                    //compensate lastline
     48                                                                if ( CKEDITOR.env.gecko )
     49                                                                        expected += '<br />\n';
     50                                                                assert.areEqual( expected, result,
     51                                                                        'Created hiddenfield element doesn\'t match.' );
     52
     53                                                        }, 1000 );
     54                                        } );
     55                                }, this );
     56
     57                        this.wait();
     58                },
     59
     60                name :document.title
     61            };
     62    } )() );
     63        //]]>
     64        </script>
     65</head>
     66<body>
     67        <textarea id="editor1" name="editor1"></textarea>
     68</body>
     69</html>
  • _source/tests/plugins/form/imagebutton.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: imagebutton</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[
     10CKEDITOR.test.addTestCase( ( function()
     11{
     12
     13        // Local references.
     14        var assert = CKEDITOR.test.assert;
     15        return
     16        {
     17            /**
     18             * Test insert a imagebutton element with all supported attributes.
     19             */
     20            test_createImagebutton : function()
     21            {
     22                    var editor = CKEDITOR.replace( 'editor1' );
     23                    editor.on( 'instanceReady',
     24                            function()
     25                            {
     26                                    this.resume( function()
     27                                    {
     28                                            editor.focus();
     29                                            // async
     30                                            editor.execCommand( 'imagebutton' );
     31                                            this.wait(
     32                                                    function()
     33                                                    {
     34                                                            var dialog = editor._.storedDialogs[ 'imagebutton' ];
     35                                                            var url = dialog.getContentElement(
     36                                                                'info', 'txtUrl' ), alt = dialog
     37                                                                .getContentElement( 'info',
     38                                                                    'txtAlt' ), width = dialog
     39                                                                .getContentElement( 'info',
     40                                                                    'txtWidth' ), height = dialog
     41                                                                .getContentElement( 'info',
     42                                                                    'txtHeight' ), border = dialog
     43                                                                .getContentElement( 'info',
     44                                                                    'txtBorder' ), hspace = dialog
     45                                                                .getContentElement( 'info',
     46                                                                    'txtHSpace' ), vspace = dialog
     47                                                                .getContentElement( 'info',
     48                                                                    'txtVSpace' ), align = dialog
     49                                                                .getContentElement( 'info',
     50                                                                    'cmbAlign' ),
     51                                                            // advanced
     52                                                            imgId = dialog.getContentElement(
     53                                                                'advanced', 'linkId' ), langDir = dialog
     54                                                                .getContentElement( 'advanced',
     55                                                                    'cmbLangDir' ), langCode = dialog
     56                                                                .getContentElement( 'advanced',
     57                                                                    'txtLangCode' ), despUrl = dialog
     58                                                                .getContentElement( 'advanced',
     59                                                                    'txtGenLongDescr' ), cls = dialog
     60                                                                .getContentElement( 'advanced',
     61                                                                    'txtGenClass' ), advTitle = dialog
     62                                                                .getContentElement( 'advanced',
     63                                                                    'txtGenTitle' ), style = dialog
     64                                                                .getContentElement( 'advanced',
     65                                                                    'txtdlgGenStyle' );
     66
     67                                                            // Set imagebutton fields values
     68                                                            url.setValue( 'http://dev.fckeditor.net/chrome/site/logos.gif' );
     69                                                            alt.setValue( 'fckeditor logo' );
     70                                                            width.setValue( 207 );
     71                                                            height.setValue( 43 );
     72                                                            border.setValue( 1 );
     73                                                            hspace.setValue( 2 );
     74                                                            vspace.setValue( 2 );
     75                                                            align.setValue( 'top' );
     76                                                            imgId.setValue( 'id1' );
     77                                                            langDir.setValue( 'rtl' );
     78                                                            langCode.setValue( 'en' );
     79                                                            despUrl.setValue( 'http://www.fckeditor.net' );
     80                                                            langCode.setValue( 'en' );
     81                                                            cls.setValue( 'cls' );
     82                                                            advTitle.setValue( 'title' );
     83                                                            style.setValue( 'float:right' );
     84
     85                                                            dialog.fire( 'ok' );
     86
     87                                                            var result = editor.getData(), expected = '<input align="top" alt="fckeditor logo" border="1" class="cls" dir="rtl" height="43" hspace="2" id="id1" lang="en" longdesc="http://www.fckeditor.net" src="http://dev.fckeditor.net/chrome/site/logos.gif" style="float: right;" title="title" type="image" vspace="2" width="207" />';
     88
     89                                                            //compensate lastline
     90                                                            if ( CKEDITOR.env.gecko )
     91                                                                    expected += '<br />\n';
     92                                                            assert.areEqual( expected, result,
     93                                                                    'Created imagebutton element doesn\'t match.' );
     94
     95                                                    }, 1000 );
     96                                    } );
     97                            }, this );
     98
     99                    this.wait();
     100            },
     101
     102            name :document.title
     103        };
     104} )() );
     105        //]]>
     106        </script>
     107</head>
     108<body>
     109        <textarea id="editor1" name="editor1"></textarea>
     110</body>
     111</html>
  • _source/tests/plugins/form/radio.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: radio</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[
     10CKEDITOR.test.addTestCase( ( function()
     11    {
     12           
     13            // Local references.
     14            var assert = CKEDITOR.test.assert;
     15            return      {
     16                /**
     17                         * Test insert a radio element with all supported attributes.
     18                         */
     19                test_createradio : function()
     20                {
     21                        var editor = CKEDITOR.replace( 'editor1' );
     22                        editor.on( 'instanceReady',
     23                                function()
     24                                {
     25                                        this.resume( function()
     26                                        {
     27                                                editor.focus();
     28                                                // async
     29                                                editor.execCommand( 'radio' );
     30                                                this.wait(
     31                                                        function()
     32                                                        {
     33                                                                var dialog = editor._.storedDialogs[ 'radio' ];
     34                                                                var name = dialog
     35                                                                    .getContentElement( 'info',
     36                                                                        'txtName' ), value = dialog
     37                                                                    .getContentElement( 'info',
     38                                                                        'txtValue' ), selected = dialog
     39                                                                    .getContentElement( 'info',
     40                                                                        'cmbSelected' );
     41
     42                                                                // Set radio fields values
     43                                                                name.setValue( 'radio-name' );
     44                                                                value.setValue( 'checked-value' );
     45                                                                selected.setValue( true );
     46
     47                                                                dialog.fire( 'ok' );
     48                                                                dialog.hide();
     49
     50                                                                var result = editor.getData(),
     51                                                                                        expected = '<input checked="true" name="radio-name" type="radio" value="checked-value" />';
     52
     53                                                                    //compensate lastline
     54                                                                if ( CKEDITOR.env.gecko )
     55                                                                        expected += '<br />\n';
     56                                                                assert.areEqual( expected, result,
     57                                                                        'Created radio element doesn\'t match.' );
     58
     59                                                        }, 1000 );
     60                                        } );
     61                                }, this );
     62
     63                        this.wait();
     64                },
     65
     66                name :document.title
     67            };
     68    } )() );
     69        //]]>
     70        </script>
     71</head>
     72<body>
     73        <textarea id="editor1" name="editor1"></textarea>
     74</body>
     75</html>
  • _source/tests/plugins/form/select.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: select</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[
     10CKEDITOR.test.addTestCase( ( function()
     11{
     12
     13        // Local references.
     14        var assert = CKEDITOR.test.assert;
     15        return
     16        {
     17            /**
     18                 * Test insert a select element with all supported attributes.
     19                 */
     20            test_createselect : function()
     21            {
     22                    var editor = CKEDITOR.replace( 'editor1' );
     23                    editor.on( 'instanceReady',
     24                            function()
     25                            {
     26                                    this.resume( function()
     27                                    {
     28                                            editor.focus();
     29                                            // async
     30                                            editor.execCommand( 'select' );
     31                                            this.wait( function()
     32                                                    {
     33                                                            var dialog = editor._.storedDialogs[ 'select' ];
     34                                                            var name = dialog.getContentElement(
     35                                                                'info', 'txtName' ), value = dialog
     36                                                                .getContentElement( 'info',
     37                                                                    'txtValue' ), size = dialog
     38                                                                .getContentElement( 'info',
     39                                                                    'txtSize' ), multiplicity = dialog
     40                                                                .getContentElement( 'info',
     41                                                                    'chkMulti' ),
     42                                                            // options
     43                                                            optText = dialog.getContentElement(
     44                                                                'info', 'txtOptName' ), optValue = dialog
     45                                                                .getContentElement( 'info',
     46                                                                    'txtOptValue' );
     47
     48                                                            // TODO: Use selector to find 'add' and
     49                                                                                // 'set as selected vaue' buttons.
     50
     51                                                            // Set select fields values
     52                                                            name.setValue( 'select-name' );
     53                                                            size.setValue( 5 );
     54                                                            multiplicity.setValue( true );
     55
     56                                                            dialog.fire( 'ok' );
     57                                                            dialog.hide();
     58
     59                                                            var result = editor.getData(), expected = '<select multiple="true" name="select-name" size="5"></select>';
     60
     61                                                            // compensate lastline
     62                                                            if ( CKEDITOR.env.gecko )
     63                                                                    expected += '<br />\n';
     64                                                            assert.areEqual( expected, result,
     65                                                                    'Created select element doesn\'t match.' );
     66
     67                                                    }, 1000 );
     68                                    } );
     69                            }, this );
     70
     71                    this.wait();
     72            },
     73
     74            name :document.title
     75        };
     76} )() );
     77        //]]>
     78        </script>
     79</head>
     80<body>
     81        <textarea id="editor1" name="editor1"></textarea>
     82</body>
     83</html>
  • _source/tests/plugins/form/textarea.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: textarea</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[
     10CKEDITOR.test.addTestCase( ( function()
     11    {
     12            // Local references.
     13            var assert = CKEDITOR.test.assert;
     14            return      {
     15                /**
     16                         * Test insert a textarea element with all supported attributes.
     17                         */
     18                test_createtextarea : function()
     19                {
     20                        var editor = CKEDITOR.replace( 'editor1' );
     21                        editor.on( 'instanceReady',
     22                                function()
     23                                {
     24                                        this.resume( function()
     25                                        {
     26                                                editor.focus();
     27                                                // async
     28                                                editor.execCommand( 'textarea' );
     29                                                this.wait(
     30                                                        function()
     31                                                        {
     32                                                                var dialog = editor._.storedDialogs[ 'textarea' ];
     33                                                                var name = dialog       .getContentElement( 'info', 'txtName' ),
     34                                                                                                cols = dialog.getContentElement( 'info', 'txtColumns' ),
     35                                                                                                rows = dialog.getContentElement( 'info', 'txtRows' );
     36
     37                                                                // Set textarea fields values
     38                                                                name.setValue( 'textarea-name' );
     39                                                                cols.setValue( 20 );
     40                                                                rows.setValue( 20 );
     41
     42                                                                dialog.fire( 'ok' );
     43                                                                dialog.hide();
     44
     45                                                                var result = editor.getData(),
     46                                                                                        expected = '<textarea cols="20" name="textarea-name" rows="20"></textarea>';
     47                                                                                       
     48                                                                    //compensate lastline
     49                                                                if ( CKEDITOR.env.gecko )
     50                                                                        expected += '<br />\n';
     51                                                                assert.areEqual( expected, result,
     52                                                                        'Created textarea element doesn\'t match.' );
     53
     54                                                        }, 1000 );
     55                                        } );
     56                                }, this );
     57
     58                        this.wait();
     59                },
     60
     61                name :document.title
     62            };
     63    } )() );
     64        //]]>
     65        </script>
     66</head>
     67<body>
     68        <textarea id="editor1" name="editor1"></textarea>
     69</body>
     70</html>
  • _source/tests/plugins/form/textfield.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: textfield</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[
     10CKEDITOR.test.addTestCase( ( function()
     11{
     12
     13        // Local references.
     14        var assert = CKEDITOR.test.assert;
     15        return
     16        {
     17            /**
     18                 * Test insert a textfield element with all supported attributes.
     19                 */
     20            test_createtextfield : function()
     21            {
     22                    var editor = CKEDITOR.replace( 'editor1' );
     23                    editor.on( 'instanceReady',
     24                            function()
     25                            {
     26                                    this.resume( function()
     27                                    {
     28                                            editor.focus();
     29                                            // async
     30                                            editor.execCommand( 'textfield' );
     31                                            this.wait( function()
     32                                                    {
     33                                                            var dialog = editor._.storedDialogs[ 'textfield' ];
     34                                                            var name = dialog.getContentElement(
     35                                                                'info', 'txtName' ), value = dialog
     36                                                                .getContentElement( 'info',
     37                                                                    'txtValue' ), cWidth = dialog
     38                                                                .getContentElement( 'info',
     39                                                                    'txtTextCharWidth' ), maxChars = dialog
     40                                                                .getContentElement( 'info',
     41                                                                    'txtMaxChars' ), type = dialog
     42                                                                .getContentElement( 'info',
     43                                                                    'cmbType' );
     44
     45                                                            // Set textfield fields values
     46                                                            name.setValue( 'textfield-name' );
     47                                                            value.setValue( 'textfield-value' );
     48                                                            cWidth.setValue( 20 );
     49                                                            maxChars.setValue( 40 );
     50                                                            type.setValue( 'pass' );
     51
     52                                                            dialog.fire( 'ok' );
     53                                                            dialog.hide();
     54
     55                                                            var result = editor.getData(), expected = '<input maxlength="40" name="textfield-name" size="20" type="pass" value="textfield-value" />';
     56
     57                                                            // compensate lastline
     58                                                            if ( CKEDITOR.env.gecko )
     59                                                                    expected += '<br />\n';
     60                                                            assert.areEqual( expected, result,
     61                                                                    'Created textfield element doesn\'t match.' );
     62
     63                                                    }, 1000 );
     64                                    } );
     65                            }, this );
     66
     67                    this.wait();
     68            },
     69            name :document.title
     70        };
     71} )() );
     72        //]]>
     73        </script>
     74</head>
     75<body>
     76        <textarea id="editor1" name="editor1"></textarea>
     77</body>
     78</html>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy