Ticket #30942: 30942_unittests2.diff
File 30942_unittests2.diff, 4.2 KB (added by , 9 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 <script src="fixtures/customize-header.js"></script> 26 26 <script src="fixtures/customize-settings.js"></script> 27 27 <script src="fixtures/customize-menus.js"></script> 28 <script src="fixtures/quicktags.js"></script> 28 29 </div> 29 30 <p><a href="editor">TinyMCE tests</a></p> 30 31 … … 45 46 <script src="../../src/wp-admin/js/nav-menu.js"></script> 46 47 <script src="../../src/wp-admin/js/customize-nav-menus.js"></script> 47 48 <script src="../../src/wp-admin/js/word-count.js"></script> 49 <script src="../../src/wp-includes/js/quicktags.js"></script> 48 50 49 51 <!-- Unit tests --> 50 52 <script src="wp-admin/js/password-strength-meter.js"></script> … … 55 57 <script src="wp-admin/js/customize-controls-utils.js"></script> 56 58 <script src="wp-admin/js/customize-nav-menus.js"></script> 57 59 <script src="wp-admin/js/word-count.js"></script> 60 <script src="wp-includes/js/quicktags.js"></script> 58 61 59 62 <!-- Customizer templates for sections --> 60 63 <script type="text/html" id="tmpl-customize-section-default"> -
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>', '', '', '', { ariaLabel: quicktagsL10n.em, ariaLabelClose: quicktagsL10n.emClose } ) }; 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>', '', '', '', { ariaLabel: quicktagsL10n.em, ariaLabelClose: quicktagsL10n.emClose } ), 52 'ul' : new QTags.TagButton('ul', 'ul', '<ul>\n', '</ul>\n\n', '', '', '', { ariaLabel: quicktagsL10n.ul, ariaLabelClose: quicktagsL10n.ulClose } ) 53 }; 54 55 QTags._buttonsInit(); // Call manually to make sure theButtons exists (#26183). 56 57 deepEqual( qinst.theButtons, expected, 'buttons not two' ); 58 }); 59 });