4 function canFind(target
, specimen
)
6 getSelection().empty();
7 document
.body
.innerHTML
= specimen
;
8 document
.execCommand("FindString", false, target
);
9 var result
= getSelection().rangeCount
!= 0;
10 getSelection().empty();
16 if (window
.testRunner
)
17 testRunner
.dumpAsText();
19 var smallSharpS
= String
.fromCharCode(0xDF);
23 var message
= "FAILURE:";
25 if (!canFind("Stra" + smallSharpS
+ "e", "Stra" + smallSharpS
+ "e")) {
27 message
+= " Cannot find small sharp s when searching for small sharp s.";
30 // Added an "x" to the start of the target string to work around an ICU bug.
31 // See <http://bugs.icu-project.org/trac/ticket/6671> for details.
32 if (!canFind("Strasse", "xStra" + smallSharpS
+ "e")) {
34 message
+= " Cannot find small sharp s when searching for ss.";
37 if (!canFind("Stra" + smallSharpS
+ "e", "Strasse")) {
39 message
+= " Cannot find ss when searching for small sharp s.";
42 if (!canFind("Strasse", "Strasse")) {
44 message
+= " Cannot find ss when searching for ss. ";
48 message
= "SUCCESS: Found all the variants of Strasse.";
50 document
.body
.innerHTML
= message
;
54 <body onload=
"runTests()"></body>