mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Use the original value of a field when propagating event (fixes #17540)
And avoid to not format a field when the value is 0.
This commit is contained in:
parent
f8e3c79cb5
commit
5732c0c54a
6 changed files with 81 additions and 8 deletions
|
@ -716,6 +716,11 @@ describe("Scripting", function () {
|
|||
`AFNumber_Format(2, 0, 3, 0, "€", false);` +
|
||||
`event.source.value = event.value;`,
|
||||
],
|
||||
test6: [
|
||||
`event.value = 0;` +
|
||||
`AFNumber_Format(2, 0, 0, 0, "€", false);` +
|
||||
`event.source.value = event.value;`,
|
||||
],
|
||||
},
|
||||
type: "text",
|
||||
},
|
||||
|
@ -727,6 +732,30 @@ describe("Scripting", function () {
|
|||
};
|
||||
|
||||
sandbox.createSandbox(data);
|
||||
await sandbox.dispatchEventInSandbox({
|
||||
id: refId,
|
||||
value: "0",
|
||||
name: "test1",
|
||||
});
|
||||
expect(send_queue.has(refId)).toEqual(true);
|
||||
expect(send_queue.get(refId)).toEqual({
|
||||
id: refId,
|
||||
value: "0.00€",
|
||||
});
|
||||
send_queue.delete(refId);
|
||||
|
||||
await sandbox.dispatchEventInSandbox({
|
||||
id: refId,
|
||||
value: "",
|
||||
name: "test6",
|
||||
});
|
||||
expect(send_queue.has(refId)).toEqual(true);
|
||||
expect(send_queue.get(refId)).toEqual({
|
||||
id: refId,
|
||||
value: "0.00€",
|
||||
});
|
||||
send_queue.delete(refId);
|
||||
|
||||
await sandbox.dispatchEventInSandbox({
|
||||
id: refId,
|
||||
value: "123456.789",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue