From: Antoine Musso Date: Tue, 16 Aug 2011 08:04:34 +0000 (+0000) Subject: tests for jquery.highlightText X-Git-Tag: 1.31.0-rc.0~28240 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=357c050b77e6bade00c7381c3b879ebf5a83a7de;p=lhc%2Fweb%2Fwiklou.git tests for jquery.highlightText In r90092, wikinaut requested tests for our highlightText jQuery plugin. Here is a basic framework than almost anyone can enhance :-) --- diff --git a/tests/qunit/index.html b/tests/qunit/index.html index e8bb99a7d6..abd4104666 100644 --- a/tests/qunit/index.html +++ b/tests/qunit/index.html @@ -44,6 +44,7 @@ + @@ -71,6 +72,7 @@ + diff --git a/tests/qunit/suites/resources/jquery/jquery.highlightText.test.js b/tests/qunit/suites/resources/jquery/jquery.highlightText.test.js new file mode 100644 index 0000000000..c416a208ef --- /dev/null +++ b/tests/qunit/suites/resources/jquery/jquery.highlightText.test.js @@ -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 = $( '

Blue Öyster Cult

' ); + $fixture.highlightText( 'Blue' ); + equal( + 'Blue Öyster Cult', + $fixture.html() + ); + + $fixture = $( '

Österreich

' ); + $fixture.highlightText( 'Österreich' ); + equal( + 'Österreich', + $fixture.html() + ); + + /** + * Highlighter broken on punctuation mark. + */ + /** + $fixture = $( '

So good. To be there

' ); + $fixture.highlightText( 'good' ); + equal( + 'So good. To be there', + $fixture.html() + ); + */ +} );