| | 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[ |
| | 10 | CKEDITOR.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> |