Ticket #3013: 3013.patch

File 3013.patch, 30.1 KB (added by Garry Yao, 16 years ago)
  • _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                         * Test insert a button element with all supported attributes.
     18                         */
     19                test_createbutton : 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( 'button' );
     30                                                this.wait(
     31                                                        function()
     32                                                        {
     33                                                                var dialog = editor._.storedDialogs[ 'button' ];
     34                                                                var name = dialog       .getContentElement( 'info', 'txtName' ),
     35                                                                                                value = dialog.getContentElement( 'info', 'txtValue' ),
     36                                                                                                type = dialog.getContentElement( 'info', 'txtType' );
     37                                                                                               
     38                                                                // Set button fields values
     39                                                                name.setValue( 'button-name' );
     40                                                                value.setValue('button-value');
     41                                                                type.setValue('submit');                                                                                       
     42                                                                                       
     43                                                                dialog.fire( 'ok' );
     44                                                                dialog.hide();
     45
     46                                                                var result = editor.getData(),
     47                                                                                        expected = '<input name="button-name" type="submit" value="button-value" />';
     48                                                                                       
     49                                                                    //compensate lastline
     50                                                                if ( CKEDITOR.env.gecko )
     51                                                                        expected += '<br />\n';
     52                                                                assert.areEqual( expected, result,
     53                                                                        'Created button element doesn\'t match.' );
     54
     55                                                        }, 1000 );
     56                                        } );
     57                                }, this );
     58
     59                        this.wait();
     60                },
     61
     62                name :document.title
     63            };
     64    } )() );
     65        //]]>
     66        </script>
     67</head>
     68<body>
     69        <textarea id="editor1" name="editor1"></textarea>
     70</body>
     71</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                         * Test insert a imagebutton element with all supported attributes.
     18                         */
     19                test_createImagebutton : 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( 'imagebutton' );
     30                                                this.wait(
     31                                                        function()
     32                                                        {
     33                                                                var dialog = editor._.storedDialogs[ 'imagebutton' ];
     34                                                                var url = dialog        .getContentElement( 'info', 'txtUrl' ),
     35                                                                                                alt = dialog.getContentElement( 'info', 'txtAlt' ),
     36                                                                                                width = dialog.getContentElement( 'info', 'txtWidth' ),
     37                                                                                                height = dialog.getContentElement( 'info', 'txtHeight' ),
     38                                                                                                border = dialog.getContentElement( 'info', 'txtBorder' ),
     39                                                                                                hspace = dialog.getContentElement( 'info', 'txtHSpace' ),
     40                                                                                                vspace = dialog.getContentElement( 'info', 'txtVSpace' ),
     41                                                                                                align = dialog.getContentElement( 'info', 'cmbAlign' ),
     42                                                                                                //advanced
     43                                                                                                imgId = dialog.getContentElement( 'advanced', 'linkId' ),
     44                                                                                                langDir = dialog.getContentElement( 'advanced', 'cmbLangDir' ),
     45                                                                                                langCode = dialog.getContentElement( 'advanced', 'txtLangCode' ),
     46                                                                                                despUrl = dialog.getContentElement( 'advanced', 'txtGenLongDescr' ),
     47                                                                                                cls = dialog.getContentElement( 'advanced', 'txtGenClass' ),
     48                                                                                                advTitle = dialog.getContentElement( 'advanced', 'txtGenTitle' ),
     49                                                                                                style = dialog.getContentElement( 'advanced', 'txtdlgGenStyle' );
     50                                                                                       
     51                                                                                               
     52                                                                // Set imagebutton fields values
     53                                                                url.setValue( 'http://dev.fckeditor.net/chrome/site/logos.gif' );
     54                                                                alt.setValue('fckeditor logo');
     55                                                                width.setValue(207);
     56                                                                height.setValue(43);
     57                                                                                        border.setValue(1);
     58                                                                                        hspace.setValue(2);
     59                                                                                        vspace.setValue(2);
     60                                                                                        align.setValue('top');
     61                                                                                        imgId.setValue('id1');
     62                                                                                        langDir.setValue('rtl');
     63                                                                                        langCode.setValue('en');
     64                                                                                        despUrl.setValue('http://www.fckeditor.net');
     65                                                                                        langCode.setValue('en');
     66                                                                                        cls.setValue('cls');
     67                                                                                        advTitle.setValue('title');
     68                                                                                        style.setValue('float:right');
     69                                                                                       
     70                                                                dialog.fire( 'ok' );
     71//                                                              dialog.hide();
     72
     73                                                                var result = editor.getData(),
     74                                                                                        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" />';
     75                                                                                       
     76                                                                    //compensate lastline
     77                                                                if ( CKEDITOR.env.gecko )
     78                                                                        expected += '<br />\n';
     79                                                                assert.areEqual( expected, result,
     80                                                                        'Created imagebutton element doesn\'t match.' );
     81
     82                                                        }, 1000 );
     83                                        } );
     84                                }, this );
     85
     86                        this.wait();
     87                },
     88
     89                name :document.title
     90            };
     91    } )() );
     92        //]]>
     93        </script>
     94</head>
     95<body>
     96        <textarea id="editor1" name="editor1"></textarea>
     97</body>
     98</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                         * Test insert a select element with all supported attributes.
     18                         */
     19                test_createselect : 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( 'select' );
     30                                                this.wait(
     31                                                        function()
     32                                                        {
     33                                                                var dialog = editor._.storedDialogs[ 'select' ];
     34                                                                var name = dialog       .getContentElement( 'info', 'txtName' ),
     35                                                                                                value = dialog.getContentElement( 'info', 'txtValue' ),
     36                                                                                                size = dialog.getContentElement( 'info', 'txtSize' ),
     37                                                                                                multiplicity = dialog.getContentElement( 'info', 'chkMulti' ),
     38                                                                                                //options
     39                                                                                                optText = dialog.getContentElement( 'info', 'txtOptName' ),
     40                                                                                                optValue = dialog.getContentElement( 'info', 'txtOptValue' );
     41                                                                                       
     42                                                                                        //TODO: Use selector to find 'add' and 'set as selected vaue' buttons.
     43                                                                                               
     44                                                                // Set select fields values
     45                                                                name.setValue( 'select-name' );
     46                                                                size.setValue(5);
     47                                                                                        multiplicity.setValue(true);
     48                                                                                       
     49                                                                                       
     50                                                                dialog.fire( 'ok' );
     51                                                                dialog.hide();
     52
     53                                                                var result = editor.getData(),
     54                                                                                        expected = '<select multiple="true" name="select-name" size="5"></select>';
     55                                                                                       
     56                                                                    //compensate lastline
     57                                                                if ( CKEDITOR.env.gecko )
     58                                                                        expected += '<br />\n';
     59                                                                assert.areEqual( expected, result,
     60                                                                        'Created select element doesn\'t match.' );
     61
     62                                                        }, 1000 );
     63                                        } );
     64                                }, this );
     65
     66                        this.wait();
     67                },
     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>
  • _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           
     13            // Local references.
     14            var assert = CKEDITOR.test.assert;
     15            return      {
     16                /**
     17                         * Test insert a textarea element with all supported attributes.
     18                         */
     19                test_createtextarea : 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( 'textarea' );
     30                                                this.wait(
     31                                                        function()
     32                                                        {
     33                                                                var dialog = editor._.storedDialogs[ 'textarea' ];
     34                                                                var name = dialog       .getContentElement( 'info', 'txtName' ),
     35                                                                                                cols = dialog.getContentElement( 'info', 'txtColumns' ),
     36                                                                                                rows = dialog.getContentElement( 'info', 'txtRows' );
     37
     38                                                                // Set textarea fields values
     39                                                                name.setValue( 'textarea-name' );
     40                                                                cols.setValue( 20 );
     41                                                               rows.setValue( 20 );
     42
     43                                                                dialog.fire( 'ok' );
     44                                                                dialog.hide();
     45
     46                                                                var result = editor.getData(),
     47                                                                                        expected = '<textarea cols="20" name="textarea-name" rows="20"></textarea>';
     48                                                                                       
     49                                                                    //compensate lastline
     50                                                                if ( CKEDITOR.env.gecko )
     51                                                                        expected += '<br />\n';
     52                                                                assert.areEqual( expected, result,
     53                                                                        'Created textarea element doesn\'t match.' );
     54
     55                                                        }, 1000 );
     56                                        } );
     57                                }, this );
     58
     59                        this.wait();
     60                },
     61
     62                name :document.title
     63            };
     64    } )() );
     65        //]]>
     66        </script>
     67</head>
     68<body>
     69        <textarea id="editor1" name="editor1"></textarea>
     70</body>
     71</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                         * Test insert a textfield element with all supported attributes.
     18                         */
     19                test_createtextfield : 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( 'textfield' );
     30                                                this.wait(
     31                                                        function()
     32                                                        {
     33                                                                var dialog = editor._.storedDialogs[ 'textfield' ];
     34                                                                var name = dialog       .getContentElement( 'info', 'txtName' ),
     35                                                                                                value = dialog.getContentElement( 'info', 'txtValue' ),
     36                                                                                                cWidth = dialog.getContentElement( 'info', 'txtTextCharWidth' ),
     37                                                                                                maxChars = dialog.getContentElement( 'info', 'txtMaxChars' ),
     38                                                                                                type = dialog.getContentElement( 'info', 'cmbType' );
     39
     40                                                                // Set textfield fields values
     41                                                                name.setValue( 'textfield-name' );
     42                                                                value.setValue( 'textfield-value' );
     43                                                               cWidth.setValue( 20 );
     44                                                                                   maxChars.setValue( 40 );
     45                                                                                   type.setValue( 'pass' );
     46
     47                                                                dialog.fire( 'ok' );
     48                                                                dialog.hide();
     49
     50                                                                var result = editor.getData(),
     51                                                                                        expected = '<input maxlength="40" name="textfield-name" size="20" type="pass" value="textfield-value" />';
     52                                                                                       
     53                                                                    //compensate lastline
     54                                                                if ( CKEDITOR.env.gecko )
     55                                                                        expected += '<br />\n';
     56                                                                assert.areEqual( expected, result,
     57                                                                        'Created textfield 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>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy