Merge pull request #18303 from bootleq/findbar-state-entire-word
Expose entireWord in updateFindControlState
This commit is contained in:
commit
f9ff613e56
@ -1022,4 +1022,36 @@ describe("pdf_find_controller", function () {
|
|||||||
pageMatchesLength: [[1, 1, 1, 1, 1, 1, 1, 1, 1]],
|
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 });
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -2516,6 +2516,7 @@ function webViewerUpdateFindMatchesCount({ matchesCount }) {
|
|||||||
function webViewerUpdateFindControlState({
|
function webViewerUpdateFindControlState({
|
||||||
state,
|
state,
|
||||||
previous,
|
previous,
|
||||||
|
entireWord,
|
||||||
matchesCount,
|
matchesCount,
|
||||||
rawQuery,
|
rawQuery,
|
||||||
}) {
|
}) {
|
||||||
@ -2523,6 +2524,7 @@ function webViewerUpdateFindControlState({
|
|||||||
PDFViewerApplication.externalServices.updateFindControlState({
|
PDFViewerApplication.externalServices.updateFindControlState({
|
||||||
result: state,
|
result: state,
|
||||||
findPrevious: previous,
|
findPrevious: previous,
|
||||||
|
entireWord,
|
||||||
matchesCount,
|
matchesCount,
|
||||||
rawQuery,
|
rawQuery,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1133,6 +1133,7 @@ class PDFFindController {
|
|||||||
source: this,
|
source: this,
|
||||||
state,
|
state,
|
||||||
previous,
|
previous,
|
||||||
|
entireWord: this.#state?.entireWord ?? null,
|
||||||
matchesCount: this.#requestMatchesCount(),
|
matchesCount: this.#requestMatchesCount(),
|
||||||
rawQuery: this.#state?.query ?? null,
|
rawQuery: this.#state?.query ?? null,
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user