@@ -271,5 +271,130 @@ describe("pdf_find_controller", function () {
271
271
pageMatches : [ [ 19 , 48 , 66 ] ] ,
272
272
pageMatchesLength : [ [ 8 , 8 , 8 ] ] ,
273
273
} ) ;
274
+
275
+ await testSearch ( {
276
+ eventBus,
277
+ pdfFindController,
278
+ parameters : {
279
+ query : "1/2" ,
280
+ caseSensitive : false ,
281
+ entireWord : false ,
282
+ phraseSearch : true ,
283
+ findPrevious : false ,
284
+ } ,
285
+ matchesPerPage : [ 2 ] ,
286
+ selectedMatch : {
287
+ pageIndex : 0 ,
288
+ matchIndex : 0 ,
289
+ } ,
290
+ pageMatches : [ [ 28 , 57 ] ] ,
291
+ pageMatchesLength : [ [ 1 , 1 ] ] ,
292
+ } ) ;
293
+
294
+ await testSearch ( {
295
+ eventBus,
296
+ pdfFindController,
297
+ parameters : {
298
+ query : "½" ,
299
+ caseSensitive : false ,
300
+ entireWord : false ,
301
+ phraseSearch : true ,
302
+ findPrevious : false ,
303
+ } ,
304
+ matchesPerPage : [ 2 ] ,
305
+ selectedMatch : {
306
+ pageIndex : 0 ,
307
+ matchIndex : 0 ,
308
+ } ,
309
+ pageMatches : [ [ 28 , 57 ] ] ,
310
+ pageMatchesLength : [ [ 1 , 1 ] ] ,
311
+ } ) ;
312
+ } ) ;
313
+
314
+ it ( "performs a normal search, where the text with diacritics is normalized" , async function ( ) {
315
+ const { eventBus, pdfFindController } = await initPdfFindController (
316
+ "french_diacritics.pdf"
317
+ ) ;
318
+
319
+ await testSearch ( {
320
+ eventBus,
321
+ pdfFindController,
322
+ parameters : {
323
+ query : "a" ,
324
+ caseSensitive : false ,
325
+ entireWord : false ,
326
+ phraseSearch : true ,
327
+ findPrevious : false ,
328
+ matchDiacritics : false ,
329
+ } ,
330
+ matchesPerPage : [ 6 ] ,
331
+ selectedMatch : {
332
+ pageIndex : 0 ,
333
+ matchIndex : 0 ,
334
+ } ,
335
+ pageMatches : [ [ 0 , 2 , 4 , 6 , 8 , 10 ] ] ,
336
+ pageMatchesLength : [ [ 1 , 1 , 1 , 1 , 1 , 1 ] ] ,
337
+ } ) ;
338
+
339
+ await testSearch ( {
340
+ eventBus,
341
+ pdfFindController,
342
+ parameters : {
343
+ query : "u" ,
344
+ caseSensitive : false ,
345
+ entireWord : false ,
346
+ phraseSearch : true ,
347
+ findPrevious : false ,
348
+ matchDiacritics : false ,
349
+ } ,
350
+ matchesPerPage : [ 6 ] ,
351
+ selectedMatch : {
352
+ pageIndex : 0 ,
353
+ matchIndex : 0 ,
354
+ } ,
355
+ pageMatches : [ [ 44 , 46 , 48 , 50 , 52 , 54 ] ] ,
356
+ pageMatchesLength : [ [ 1 , 1 , 1 , 1 , 1 , 1 ] ] ,
357
+ } ) ;
358
+
359
+ await testSearch ( {
360
+ eventBus,
361
+ pdfFindController,
362
+ parameters : {
363
+ query : "ë" ,
364
+ caseSensitive : false ,
365
+ entireWord : false ,
366
+ phraseSearch : true ,
367
+ findPrevious : false ,
368
+ matchDiacritics : true ,
369
+ } ,
370
+ matchesPerPage : [ 2 ] ,
371
+ selectedMatch : {
372
+ pageIndex : 0 ,
373
+ matchIndex : 0 ,
374
+ } ,
375
+ pageMatches : [ [ 28 , 30 ] ] ,
376
+ pageMatchesLength : [ [ 1 , 1 ] ] ,
377
+ } ) ;
378
+ } ) ;
379
+
380
+ it ( "performs a search where one of the results contains an hyphen" , async function ( ) {
381
+ const { eventBus, pdfFindController } = await initPdfFindController ( ) ;
382
+
383
+ await testSearch ( {
384
+ eventBus,
385
+ pdfFindController,
386
+ parameters : {
387
+ query : "optimiz" ,
388
+ caseSensitive : false ,
389
+ entireWord : false ,
390
+ phraseSearch : true ,
391
+ findPrevious : false ,
392
+ } ,
393
+ matchesPerPage : [ 1 , 4 , 2 , 3 , 3 , 0 , 2 , 9 , 1 , 0 , 0 , 6 , 3 , 4 ] ,
394
+ selectedMatch : {
395
+ pageIndex : 0 ,
396
+ matchIndex : 0 ,
397
+ } ,
398
+ } ) ;
274
399
} ) ;
275
400
} ) ;
0 commit comments