1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

Replace the forEach method in Dict with "proper" iteration support

This commit is contained in:
Jonas Jenwald 2024-11-16 11:51:09 +01:00
parent 691be77f65
commit 2c0cc48d1b
6 changed files with 19 additions and 30 deletions

View file

@ -221,17 +221,12 @@ describe("primitives", function () {
expect(values[2]).toEqual(testFontFile);
});
it("should callback for each stored key", function () {
const callbackSpy = jasmine.createSpy("spy on callback in dictionary");
dictWithManyKeys.forEach(callbackSpy);
expect(callbackSpy).toHaveBeenCalled();
const callbackSpyCalls = callbackSpy.calls;
expect(callbackSpyCalls.argsFor(0)).toEqual(["FontFile", testFontFile]);
expect(callbackSpyCalls.argsFor(1)).toEqual(["FontFile2", testFontFile2]);
expect(callbackSpyCalls.argsFor(2)).toEqual(["FontFile3", testFontFile3]);
expect(callbackSpyCalls.count()).toEqual(3);
it("should iterate through each stored key", function () {
expect([...dictWithManyKeys]).toEqual([
["FontFile", testFontFile],
["FontFile2", testFontFile2],
["FontFile3", testFontFile3],
]);
});
it("should handle keys pointing to indirect objects, both sync and async", async function () {