mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Expose entireWord in updateFindControlState
Allow apps with supportsIntegratedFind to better monitor the find state. A recognized use case is the Firefox findbar, its "not found" sound must consider `entireWord` and only make noise when it is off. See related implementation in https://hg.mozilla.org/mozilla-central/rev/16b902cbcf26 This change can help if we have to move the implementation from cpp to jsm.
This commit is contained in:
parent
a081dd25eb
commit
890c567eca
3 changed files with 35 additions and 0 deletions
|
@ -1022,4 +1022,36 @@ describe("pdf_find_controller", function () {
|
|||
pageMatchesLength: [[1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
||||
});
|
||||
});
|
||||
|
||||
it("dispatches updatefindcontrolstate with correct properties", async function () {
|
||||
const testOnFind = ({ eventBus }) =>
|
||||
new Promise(function (resolve) {
|
||||
const eventState = {
|
||||
source: this,
|
||||
type: "",
|
||||
query: "Foo",
|
||||
caseSensitive: true,
|
||||
entireWord: true,
|
||||
findPrevious: false,
|
||||
matchDiacritics: false,
|
||||
};
|
||||
eventBus.dispatch("find", eventState);
|
||||
|
||||
eventBus.on("updatefindcontrolstate", function (evt) {
|
||||
expect(evt).toEqual(
|
||||
jasmine.objectContaining({
|
||||
state: FindState.NOT_FOUND,
|
||||
previous: false,
|
||||
entireWord: true,
|
||||
matchesCount: { current: 0, total: 0 },
|
||||
rawQuery: "Foo",
|
||||
})
|
||||
);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
const { eventBus } = await initPdfFindController();
|
||||
await testOnFind({ eventBus });
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue