| | 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>Core : editor</title> |
| | 5 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| | 6 | <link rel="stylesheet" type="text/css" href="../test.css" /> |
| | 7 | <script type="text/javascript" src="../../../ckeditor_source.js"></script> |
| | 8 | <script type="text/javascript" src="../test.js"></script> |
| | 9 | <script type="text/javascript"> |
| | 10 | //<![CDATA[ |
| | 11 | |
| | 12 | function prepareEditor( elementId, mode, config, callback, context ) |
| | 13 | { |
| | 14 | CKEDITOR.on( 'instanceReady', |
| | 15 | function( evt ) |
| | 16 | { |
| | 17 | var isMe = mode == CKEDITOR.ELEMENT_MODE_REPLACE ? |
| | 18 | evt.editor.name == elementId |
| | 19 | : evt.editor.element.$ == |
| | 20 | document.getElementById( elementId ); |
| | 21 | if ( isMe ) |
| | 22 | { |
| | 23 | callback.call( context, evt.editor ); |
| | 24 | } |
| | 25 | }, this ); |
| | 26 | |
| | 27 | mode = mode || CKEDITOR.ELEMENT_MODE_REPLACE; |
| | 28 | switch( mode ) |
| | 29 | { |
| | 30 | case CKEDITOR.ELEMENT_MODE_REPLACE : |
| | 31 | CKEDITOR.replace( elementId, config ); |
| | 32 | break; |
| | 33 | case CKEDITOR.ELEMENT_MODE_APPENDTO : |
| | 34 | CKEDITOR.appendTo( elementId, config ); |
| | 35 | break; |
| | 36 | } |
| | 37 | } |
| | 38 | |
| | 39 | CKEDITOR.test.addTestCase( ( function() |
| | 40 | { |
| | 41 | |
| | 42 | // Local references. |
| | 43 | var assert = CKEDITOR.test.assert; |
| | 44 | |
| | 45 | return { |
| | 46 | |
| | 47 | /** |
| | 48 | * Test getSelection with empty document with initial focus in document. |
| | 49 | */ |
| | 50 | test_getSelection : function() |
| | 51 | { |
| | 52 | prepareEditor( 'editor1', null, null, function( editor ) |
| | 53 | { |
| | 54 | this.resume( function() |
| | 55 | { |
| | 56 | editor.focus(); |
| | 57 | var sel = editor.getSelection(); |
| | 58 | // The selection object shouldn't be null. |
| | 59 | assert.isNotNull( sel , 'Selection object should not be null.'); |
| | 60 | assert.areSame( CKEDITOR.SELECTION_TEXT, sel.getType(), |
| | 61 | 'Selection type should be "text".' ); |
| | 62 | } ); |
| | 63 | }, this ); |
| | 64 | this.wait(); |
| | 65 | }, |
| | 66 | |
| | 67 | name : document.title |
| | 68 | }; |
| | 69 | })() ); |
| | 70 | |
| | 71 | //]]> |
| | 72 | </script> |
| | 73 | </head> |
| | 74 | <body> |
| | 75 | <textarea id="editor1"></textarea> |
| | 76 | </body> |
| | 77 | </html> |
| | 78 | No newline at end of file |