Ticket #2570: 2570.patch

File 2570.patch, 2.1 KB (added by Alfonso Martínez de Lizarrondo, 10 years ago)

Testcase for V3

  • _source/tests/plugins/selection/selection.html

     
    22<html xmlns="http://www.w3.org/1999/xhtml">
    33<head>
    44        <title>Plugin: selection</title>
    5         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     5        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    66        <link rel="stylesheet" type="text/css" href="../../test.css" />
    77        <script type="text/javascript" src="../../../../ckeditor_source.js"></script>
    88        <script type="text/javascript" src="../../test.js"></script>
     
    3636                        assert.areSame( 0, $range.compareEndPoints( 'EndToEnd', $range2 ), 'EndToEnd' );
    3737                },
    3838
     39                test_selection_image : function()
     40                {
     41                        var element = doc.getById( 'testZone' );
     42                        element.setHtml( '<p>A normal image <img src="../../_assets/regular_smile.gif" id="testImage"> inside the text<\/p>' );
     43                        var image = doc.getById('testImage');
     44
     45                        doc.getSelection().selectElement(image);
     46                        var selectedElement = doc.getSelection().getSelectedElement() ;
     47                        // Opera doesn't return any selected element
     48                        assert.isNotNull( selectedElement, 'The image hasn\'t been selected' );
     49                        assert.areSame( image.$, selectedElement.$, 'The image hasn\'t been selected correctly' );
     50                       
     51                        // Webkit has problems with the selection of floated images
     52                        image.setStyle('float', 'left');
     53
     54                        doc.getSelection().selectElement(image);
     55                        selectedElement = doc.getSelection().getSelectedElement() ;
     56                        assert.isNotNull( selectedElement, 'The floated image hasn\'t been selected' );
     57                        assert.areSame( image.$, selectedElement.$, 'The floated image hasn\'t been selected correctly' );
     58                },
     59
    3960                name : document.title
    4061        };
    4162})());
     
    4566<body>
    4667        <p>
    4768                This is some <strong>sample text</strong>. You are using <a href="http://www.fckeditor.net/">CKEditor</a>.</p>
     69                <p>&nbsp;</p>
     70                <p>&nbsp;</p>
     71        <div id="testZone"></div>
    4872</body>
    4973</html>
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy