http://www.mediawiki.org/wiki/Special:Code/MediaWiki/94609
Revision: 94609 Author: hashar Date: 2011-08-16 08:04:34 +0000 (Tue, 16 Aug 2011) Log Message: ----------- tests for jquery.highlightText In r90092, wikinaut requested tests for our highlightText jQuery plugin. Here is a basic framework than almost anyone can enhance :-) Modified Paths: -------------- trunk/phase3/tests/qunit/index.html Added Paths: ----------- trunk/phase3/tests/qunit/suites/resources/jquery/jquery.highlightText.test.js Modified: trunk/phase3/tests/qunit/index.html =================================================================== --- trunk/phase3/tests/qunit/index.html 2011-08-16 07:13:52 UTC (rev 94608) +++ trunk/phase3/tests/qunit/index.html 2011-08-16 08:04:34 UTC (rev 94609) @@ -44,6 +44,7 @@ <script src="../../resources/jquery/jquery.byteLimit.js"></script> <script src="../../resources/jquery/jquery.colorUtil.js"></script> <script src="../../resources/jquery/jquery.getAttrs.js"></script> + <script src="../../resources/jquery/jquery.highlightText.js"></script> <script src="../../resources/jquery/jquery.localize.js"></script> <script src="../../resources/jquery/jquery.tabIndex.js"></script> <script src="../../resources/jquery/jquery.tablesorter.js"></script> @@ -71,6 +72,7 @@ <script src="suites/resources/jquery/jquery.byteLimit.test.js"></script> <script src="suites/resources/jquery/jquery.colorUtil.test.js"></script> <script src="suites/resources/jquery/jquery.getAttrs.test.js"></script> + <script src="suites/resources/jquery/jquery.highlightText.test.js"></script> <script src="suites/resources/jquery/jquery.localize.test.js"></script> <script src="suites/resources/jquery/jquery.tabIndex.test.js"></script> <script src="suites/resources/jquery/jquery.tablesorter.test.js" charset="UTF-8"></script> Added: trunk/phase3/tests/qunit/suites/resources/jquery/jquery.highlightText.test.js =================================================================== --- trunk/phase3/tests/qunit/suites/resources/jquery/jquery.highlightText.test.js (rev 0) +++ trunk/phase3/tests/qunit/suites/resources/jquery/jquery.highlightText.test.js 2011-08-16 08:04:34 UTC (rev 94609) @@ -0,0 +1,37 @@ +module( 'jquery.highlightText' ); + +test( '-- Initial check', function() { + expect(1); + ok( $.fn.highlightText, 'jQuery.fn.highlightText defined' ); +} ); + +test( 'Check', function() { + expect(3); + var $fixture; + + $fixture = $( '<p>Blue Öyster Cult</p>' ); + $fixture.highlightText( 'Blue' ); + equal( + '<span class="highlight">Blue</span> Öyster Cult', + $fixture.html() + ); + + $fixture = $( '<p>Österreich</p>' ); + $fixture.highlightText( 'Österreich' ); + equal( + '<span class="highlight">Österreich</span>', + $fixture.html() + ); + + /** + * Highlighter broken on punctuation mark. + */ + /** + $fixture = $( '<p>So good. To be there</p>' ); + $fixture.highlightText( 'good' ); + equal( + 'So <span class="highlight">good</span>. To be there', + $fixture.html() + ); + */ +} ); Property changes on: trunk/phase3/tests/qunit/suites/resources/jquery/jquery.highlightText.test.js ___________________________________________________________________ Added: svn:eol-style + native _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs