mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Implement a basic unit test for the find controller
This commit shows that we can now unit test the find controller and that executing regular queries works. Note that this is only a first step and not a complete suite of unit tests for all possible options of the find controller. While writing this unit test, I found two smaller issues that I addressed directly. The first one is that in the previous find controller refactoring I forgot to rename some occurrences of a now private member variable. Fortunately this did not cause any bugs since we did have a public getter and the fetched value may be changed by reference, but it's nevertheless good to fix. The second issue is that some entries in the `test/unit/clitests.json` file were not correct, resulting in these tests not being executed on e.g., Travis CI.
This commit is contained in:
parent
f79fb88864
commit
1b402996cf
4 changed files with 105 additions and 4 deletions
|
@ -526,8 +526,8 @@ class PDFFindController {
|
|||
|
||||
if (found) {
|
||||
const previousPage = this._selected.pageIdx;
|
||||
this.selected.pageIdx = this._offset.pageIdx;
|
||||
this.selected.matchIdx = this._offset.matchIdx;
|
||||
this._selected.pageIdx = this._offset.pageIdx;
|
||||
this._selected.matchIdx = this._offset.matchIdx;
|
||||
state = (wrapped ? FindState.WRAPPED : FindState.FOUND);
|
||||
|
||||
// Update the currently selected page to wipe out any selected matches.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue