Ticket #30942: 30942_unittests.diff
File 30942_unittests.diff, 3.8 KB (added by , 10 years ago) |
---|
-
tests/qunit/fixtures/quicktags.js
1 var quicktagsCanvas = jQuery( '<div id="quicktags-test-parent"><div id="quicktags-test"></div></div>' ); 2 quicktagsCanvas.css( { position: 'absolute', top: -1000 } ); // remove from view 3 jQuery( document.body ).append( quicktagsCanvas ); 4 5 window.quicktagsL10n = {"closeAllOpenTags":"Close all open tags","closeTags":"close tags","enterURL":"Enter the URL","enterImageURL":"Enter the URL of the image","enterImageDescription":"Enter a description of the image","fullscreen":"fullscreen","toggleFullscreen":"Toggle fullscreen mode","textdirection":"text direction","toggleTextdirection":"Toggle Editor Text Direction","dfw":"Distraction-free writing mode"}; -
tests/qunit/index.html
25 25 <div id="qunit-fixture"> 26 26 <script src="fixtures/customize-header.js"></script> 27 27 <script src="fixtures/customize-settings.js"></script> 28 <script src="fixtures/quicktags.js"></script> 28 29 </div> 29 30 <p><a href="editor">TinyMCE tests</a></p> 30 31 … … 34 35 <script src="../../src/wp-includes/js/customize-models.js"></script> 35 36 <script src="../../src/wp-includes/js/shortcode.js"></script> 36 37 <script src="../../src/wp-admin/js/customize-controls.js"></script> 38 <script src="../../src/wp-includes/js/quicktags.js"></script> 37 39 38 40 <!-- Unit tests --> 39 41 <script src="wp-admin/js/password-strength-meter.js"></script> … … 42 44 <script src="wp-includes/js/shortcode.js"></script> 43 45 <script src="wp-admin/js/customize-controls.js"></script> 44 46 <script src="wp-admin/js/customize-controls-utils.js"></script> 47 <script src="wp-includes/js/quicktags.js"></script> 45 48 </div> 46 49 </body> 47 50 </html> -
tests/qunit/wp-includes/js/quicktags.js
1 /* global wp, jQuery, quicktagsL10n */ 2 jQuery( function() { 3 module( 'quicktags' ); 4 5 test( 'settings.buttons zero', function() { 6 var settings = { 7 id: 'quicktags-test', 8 buttons: '' 9 }; 10 var qinst = quicktags( settings ); 11 var expected = {}; 12 13 QTags._buttonsInit(); // Call manually to make sure theButtons exists (#26183). 14 15 deepEqual( qinst.theButtons, expected, 'buttons not blank on zero-length string' ); 16 }); 17 18 test( 'settings.buttons false', function() { 19 var settings = { 20 id: 'quicktags-test', 21 buttons: false 22 }; 23 var qinst = quicktags( settings ); 24 var expected = {}; 25 26 QTags._buttonsInit(); // Call manually to make sure theButtons exists (#26183). 27 28 deepEqual( qinst.theButtons, expected, 'buttons not blank on false' ); 29 }); 30 31 test( 'settings.buttons one', function() { 32 var settings = { 33 id: 'quicktags-test', 34 buttons: 'em' 35 }; 36 var qinst = quicktags( settings ); 37 var expected = { 'em' : new QTags.TagButton('em','i','<em>','</em>') }; 38 39 QTags._buttonsInit(); // Call manually to make sure theButtons exists (#26183). 40 41 deepEqual( qinst.theButtons, expected, 'buttons not one' ); 42 }); 43 44 test( 'settings.buttons two', function() { 45 var settings = { 46 id: 'quicktags-test', 47 buttons: 'em,ul' 48 }; 49 var qinst = quicktags( settings ); 50 var expected = { 51 'em' : new QTags.TagButton('em','i','<em>','</em>'), 52 'ul' : new QTags.TagButton('ul','ul','<ul>\n','</ul>\n\n') 53 }; 54 55 QTags._buttonsInit(); // Call manually to make sure theButtons exists (#26183). 56 57 deepEqual( qinst.theButtons, expected, 'buttons not two' ); 58 }); 59 });