Ticket #3004: test-link-protocol-other.patch

File test-link-protocol-other.patch, 2.7 KB (added by Garry Yao, 15 years ago)

Functional test-case

  • _source/tests/plugins/link/link.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: link</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[
     10        CKEDITOR.test.addTestCase( ( function()
     11{
     12        // Local references.
     13        var assert = CKEDITOR.test.assert, editor;
     14        return  {
     15            /**
     16                 * Test insert a link element with custom url protocol.
     17                 */
     18            test_createLink : function()
     19            {
     20                    var editor = CKEDITOR.replace( 'editor1' );
     21                    editor
     22                        .on(
     23                            'instanceReady',
     24                            function()
     25                            {
     26                                    this.resume( function()
     27                                    {
     28                                            editor.focus();
     29                                            // async
     30                                            editor.execCommand( 'link' );
     31                                            this
     32                                                .wait(
     33                                                    function()
     34                                                    {
     35                                                            var dialog = editor._.storedDialogs[ 'link' ];
     36                                                            var protocolField = dialog
     37                                                                .getContentElement( 'info',
     38                                                                    'protocol' ), urlField = dialog
     39                                                                .getContentElement( 'info', 'url' );
     40                                                            // Set protocal to '<other>'
     41                                                            protocolField.setValue( '' );
     42                                                            urlField
     43                                                                .setValue( 'https://svn.fckeditor.net' );
     44
     45                                                            dialog.fire( 'ok' );
     46                                                            dialog.hide();
     47
     48                                                            var result = editor.getData();
     49                                                            expected = '<a href="https://svn.fckeditor.net">'
     50                                                                + 'https://svn.fckeditor.net</a>';
     51                                                            if ( CKEDITOR.env.gecko )
     52                                                                    expected += '<br />';
     53                                                            assert.areEqual( expected, result,
     54                                                                    'Created link 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>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy