mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Merge pull request #16247 from Snuffleupagus/issue-7442
[api-minor] Add support, in `PDFFindController`, for mixing phrase/word searches (issue 7442)
This commit is contained in:
commit
f46ed43b81
6 changed files with 95 additions and 48 deletions
|
@ -95,7 +95,6 @@ function testSearch({
|
|||
query: null,
|
||||
caseSensitive: false,
|
||||
entireWord: false,
|
||||
phraseSearch: true,
|
||||
findPrevious: false,
|
||||
matchDiacritics: false,
|
||||
},
|
||||
|
@ -182,7 +181,6 @@ function testEmptySearch({ eventBus, pdfFindController, state }) {
|
|||
query: null,
|
||||
caseSensitive: false,
|
||||
entireWord: false,
|
||||
phraseSearch: true,
|
||||
findPrevious: false,
|
||||
matchDiacritics: false,
|
||||
},
|
||||
|
@ -321,8 +319,7 @@ describe("pdf_find_controller", function () {
|
|||
eventBus,
|
||||
pdfFindController,
|
||||
state: {
|
||||
query: "alternate solution",
|
||||
phraseSearch: false,
|
||||
query: ["alternate", "solution"],
|
||||
},
|
||||
matchesPerPage: [0, 0, 0, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0],
|
||||
selectedMatch: {
|
||||
|
@ -332,6 +329,25 @@ describe("pdf_find_controller", function () {
|
|||
});
|
||||
});
|
||||
|
||||
it("performs a multiple term (phrase) search", async function () {
|
||||
// Page 9 contains 'alternate solution' and pages 6 and 9 contain
|
||||
// 'solution'. Both should be found for multiple term (phrase) search.
|
||||
const { eventBus, pdfFindController } = await initPdfFindController();
|
||||
|
||||
await testSearch({
|
||||
eventBus,
|
||||
pdfFindController,
|
||||
state: {
|
||||
query: ["alternate solution", "solution"],
|
||||
},
|
||||
matchesPerPage: [0, 0, 0, 0, 0, 1, 0, 0, 3, 0, 0, 0, 0, 0],
|
||||
selectedMatch: {
|
||||
pageIndex: 5,
|
||||
matchIndex: 0,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("performs a normal search, where the text is normalized", async function () {
|
||||
const { eventBus, pdfFindController } = await initPdfFindController(
|
||||
"fraction-highlight.pdf"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue