r94609 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94608‎ | r94609 | r94610 >
Date:08:04, 16 August 2011
Author:hashar
Status:ok
Tags:
Comment:
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 (modified) (history)
  • /trunk/phase3/tests/qunit/suites/resources/jquery/jquery.highlightText.test.js (added) (history)

Diff [purge]

Index: trunk/phase3/tests/qunit/index.html
@@ -44,6 +44,7 @@
4545 <script src="../../resources/jquery/jquery.byteLimit.js"></script>
4646 <script src="../../resources/jquery/jquery.colorUtil.js"></script>
4747 <script src="../../resources/jquery/jquery.getAttrs.js"></script>
 48+ <script src="../../resources/jquery/jquery.highlightText.js"></script>
4849 <script src="../../resources/jquery/jquery.localize.js"></script>
4950 <script src="../../resources/jquery/jquery.tabIndex.js"></script>
5051 <script src="../../resources/jquery/jquery.tablesorter.js"></script>
@@ -71,6 +72,7 @@
7273 <script src="suites/resources/jquery/jquery.byteLimit.test.js"></script>
7374 <script src="suites/resources/jquery/jquery.colorUtil.test.js"></script>
7475 <script src="suites/resources/jquery/jquery.getAttrs.test.js"></script>
 76+ <script src="suites/resources/jquery/jquery.highlightText.test.js"></script>
7577 <script src="suites/resources/jquery/jquery.localize.test.js"></script>
7678 <script src="suites/resources/jquery/jquery.tabIndex.test.js"></script>
7779 <script src="suites/resources/jquery/jquery.tablesorter.test.js" charset="UTF-8"></script>
Index: trunk/phase3/tests/qunit/suites/resources/jquery/jquery.highlightText.test.js
@@ -0,0 +1,37 @@
 2+module( 'jquery.highlightText' );
 3+
 4+test( '-- Initial check', function() {
 5+ expect(1);
 6+ ok( $.fn.highlightText, 'jQuery.fn.highlightText defined' );
 7+} );
 8+
 9+test( 'Check', function() {
 10+ expect(3);
 11+ var $fixture;
 12+
 13+ $fixture = $( '<p>Blue Öyster Cult</p>' );
 14+ $fixture.highlightText( 'Blue' );
 15+ equal(
 16+ '<span class="highlight">Blue</span> Öyster Cult',
 17+ $fixture.html()
 18+ );
 19+
 20+ $fixture = $( '<p>Österreich</p>' );
 21+ $fixture.highlightText( 'Österreich' );
 22+ equal(
 23+ '<span class="highlight">Österreich</span>',
 24+ $fixture.html()
 25+ );
 26+
 27+ /**
 28+ * Highlighter broken on punctuation mark.
 29+ */
 30+ /**
 31+ $fixture = $( '<p>So good. To be there</p>' );
 32+ $fixture.highlightText( 'good' );
 33+ equal(
 34+ 'So <span class="highlight">good</span>. To be there',
 35+ $fixture.html()
 36+ );
 37+ */
 38+} );
Property changes on: trunk/phase3/tests/qunit/suites/resources/jquery/jquery.highlightText.test.js
___________________________________________________________________
Added: svn:eol-style
139 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r94615correct number of tests fu r94609hashar10:29, 16 August 2011
r94681Followup r94609: fix jquery.highlightText test cases on IE, simplify test cas...brion19:34, 16 August 2011
r94702Fix a regression in search highlighting from r90092...brion22:42, 16 August 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r90092fix for bug29371 . regex wordwrap with UTF8: do not use \b metacharacter. The...wikinaut21:42, 14 June 2011

Status & tagging log