Ticket #26620: 26620.3.diff
| File 26620.3.diff, 2.5 KB (added by , 12 years ago) |
|---|
-
src/wp-admin/js/word-count.js
27 27 28 28 setTimeout( function() { 29 29 if ( tx ) { 30 // pad our string to prevent errors where string ends with a letter in text mode 31 tx += ' '; 30 32 tx = tx.replace( t.settings.strip, ' ' ).replace( / | /gi, ' ' ); 31 33 tx = tx.replace( t.settings.clean, '' ); 32 34 tx.replace( t.settings[type], function(){tc++;} ); -
tests/qunit/index.html
14 14 15 15 <!-- Tested files --> 16 16 <script src="../../src/wp-admin/js/password-strength-meter.js"></script> 17 <script src="../../src/wp-admin/js/word-count.js"></script> 17 18 <script src="../../src/wp-includes/js/shortcode.js"></script> 18 19 19 20 <!-- Unit tests --> 20 21 <script src="wp-admin/js/password-strength-meter.js"></script> 22 <script src="wp-admin/js/word-count.js"></script> 21 23 <script src="wp-includes/js/shortcode.js"></script> 22 24 23 25 </head> … … 27 29 <h2 id="qunit-banner"></h2> 28 30 <h2 id="qunit-userAgent"></h2> 29 31 <ol id="qunit-tests"></ol> 30 <div id="qunit-fixture"></div> 32 <div id="qunit-fixture"> 33 <span class='word-count'></span> 34 </div> 31 35 </div> 32 36 </body> 33 37 </html> -
tests/qunit/wp-admin/js/word-count.js
1 /* global wpWordCount, jQuery */ 2 var wordCountL10n; 3 jQuery( function() { 4 module( 'word-count' ); 5 6 // This is an async test since it involves testing dom manipulation 7 asyncTest('wpWordCount should set .word-count with the correct number of words for english language words', function(){ 8 wordCountL10n = 'w'; 9 wpWordCount.wc('This is some content. It should be ten words long.'); 10 setTimeout(function(){ 11 // http://core.trac.wordpress.org/ticket/6991 12 equal(10, parseInt( jQuery('.word-count').html(), 10 ), 13 'the string "This is some content. It should be ten words long." shows 10'); 14 start(); 15 }, 100); 16 17 }); 18 19 });