From 1d07ef597e816f369fc21918c641e0e7357eb526 Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Tue, 20 Jul 2021 17:05:24 +0200 Subject: [PATCH] XFA - Must use bindItems element even if there is no direct binding (bug 1720907) --- src/core/xfa/bind.js | 2 ++ test/unit/xfa_parser_spec.js | 45 ++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/src/core/xfa/bind.js b/src/core/xfa/bind.js index 991be7060..c58f6d772 100644 --- a/src/core/xfa/bind.js +++ b/src/core/xfa/bind.js @@ -616,6 +616,8 @@ class Binder { dataNode[$appendChild](match); // Don't bind the value in newly created node because it's empty. + this._setProperties(child, match); + this._bindItems(child, match); this._bindElement(child, match); continue; } diff --git a/test/unit/xfa_parser_spec.js b/test/unit/xfa_parser_spec.js index a3736a383..3f04586c8 100644 --- a/test/unit/xfa_parser_spec.js +++ b/test/unit/xfa_parser_spec.js @@ -1354,5 +1354,50 @@ describe("XFAParser", function () { expect(searchNode(data, data, "root")[0][$dump]()).toEqual(expected); }); + + it("should make a binding with a bindItems", function () { + const xml = ` + + + + + + 1 + 2 + 3 + 4 + 5 + + + + + + + `; + const root = new XFAParser().parse(xml); + const form = new Binder(root).bind(); + + expect( + searchNode(form, form, "A.B.C.items[0].text[*]").map( + x => x[$dump]().$content + ) + ).toEqual(["1", "2", "3", "4", "5"]); + expect( + searchNode(form, form, "A.B.C.items[1].text[*]").map( + x => x[$dump]().$content + ) + ).toEqual(["a", "b", "c", "d", "e"]); + }); }); });