Skip to content

Commit 258c38d

Browse files
committed
For #5670, #5025, #6929: more tests and PDF template support
- depends on #2479 - more form controls still need to be tested
1 parent 129216c commit 258c38d

File tree

7 files changed

+86
-31
lines changed

7 files changed

+86
-31
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<xbl:xbl xmlns:xh="http://www.w3.org/1999/xhtml"
2+
xmlns:xf="http://www.w3.org/2002/xforms"
3+
xmlns:xs="http://www.w3.org/2001/XMLSchema"
4+
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
5+
xmlns:xbl="http://www.w3.org/ns/xbl"
6+
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
7+
xmlns:fr="http://orbeon.org/oxf/xml/form-runner">
8+
9+
<xbl:binding
10+
id="fr-pdf-template-field"
11+
element="
12+
fr|pdf-template-field,
13+
xf|input[fr|pdf-template = true],
14+
xf|input[appearance ~= character-counter][fr|pdf-template = true],
15+
xf|textarea[appearance ~= character-counter][fr|pdf-template = true],
16+
xf|textarea[appearance ~= 'xxf:autosize'][fr|pdf-template = true],
17+
xf|textarea[appearance ~= clipboard-copy][fr|pdf-template = true],
18+
xf|output[appearance ~= clipboard-copy][fr|pdf-template = true],
19+
fr|us-ein[fr|pdf-template = true]"
20+
xxbl:mode="binding"
21+
xxbl:container="span">
22+
<xbl:template>
23+
<!-- Use `xf:input` so that we get default formatting depending on type -->
24+
<xf:input ref="xxf:binding('fr-pdf-template-field')"/>
25+
</xbl:template>
26+
</xbl:binding>
27+
28+
</xbl:xbl>

form-runner/jvm/src/test/resources/forms/issue/5670-1/data/4d07137a0f4f0f5c70ce68053fe8b8e93e78c7fe/data.xml

+4-11
Large diffs are not rendered by default.

form-runner/jvm/src/test/resources/forms/issue/5670-1/form/form.xhtml

+10-5
Large diffs are not rendered by default.

form-runner/jvm/src/test/scala/org/orbeon/oxf/fr/PdfProductionTest.scala

+39-15
Original file line numberDiff line numberDiff line change
@@ -100,27 +100,53 @@ class PdfProductionTest
100100
it("PDF template output for most form controls must contain data text") {
101101

102102
val ExpectedMatches = List(
103-
"For #5670: test PDF template output",
104-
"Michelle",
105-
// TODO: Text field with Character Counter
106-
// TODO: Text field with Clipboard Copy
107-
"Music is an art form whose medium is sound.",
108-
"Common elements of music are pitch (which",
109-
"Greek µ (mousike)",
110-
"From Wikipedia",
111-
// TODO: Plain text Area with Resizing
112-
// TODO: Plain text Area with Character Counter
113-
// TODO: Plain text Area with Clipboard Copy
103+
// Text Field
104+
"a23599e2da5cd2afca30670a801e465c7993f0ae",
105+
// Text Field with Character Counter
106+
"1a7f1efa91c4835191b6551376c2ceef93f1b36e",
107+
// Text Field with Clipboard Copy
108+
"85c20808a5e73558375b86e2ea4ce4e1b3e4c642",
109+
// Plain Text Area
110+
"Lorem ipsum dolor sit amet, consectetur",
111+
"adipiscing elit. Nam condimentum quam ut orci",
112+
"efficitur, sit amet elementum nunc lobortis.",
113+
"Sed consequat viverra varius. In at turpis",
114+
"rutrum, ultricies lorem sed, scelerisque justo.",
115+
// Plain Text Area with Character Counter
116+
"Nulla pretium, justo at gravida suscipit, mi felis",
117+
"malesuada ligula, nec placerat libero felis a",
118+
"nibh. Pellentesque fermentum rutrum aliquam.",
119+
"Ut eleifend velit id tellus tempor mollis.",
120+
// Plain Text Area with Resizing
121+
"Pellentesque orci ex, venenatis id nunc non,",
122+
"commodo imperdiet magna. Sed faucibus",
123+
"enim in nunc laoreet, vitae aliquam neque",
124+
"mattis. Duis a nibh et magna auctor maximus",
125+
"aliquam nec enim. Nunc convallis laoreet",
126+
// Plain Text Area with Clipboard Copy
127+
"Sed consectetur ante ut mauris dictum,",
128+
"tincidunt tincidunt sapien feugiat. Maecenas",
129+
"fermentum sagittis nisl et fringilla. Sed at",
130+
"cursus turpis. Aliquam erat volutpat. Aliquam",
131+
"erat volutpat. Pellentesque tristique euismod",
132+
"sem sed commodo.",
133+
// "Music is an art form whose medium is sound.",
134+
// "Common elements of music are pitch (which",
135+
// "Greek µ (mousike)",
136+
// "From Wikipedia",
114137
// TODO: Formatted Text Area
115138
// TODO: Explanatory Text
116-
"Michelle:[email protected]",
139+
// Calculated value
140+
"686614dd52e678010d2ad24a5ff04e0160b1fb02",
141+
// Calculated value with Clipboard Copy
142+
"3dbf71213d81e2e21a15fbdb2426abd650ffb5d5",
117143
"299,792,458 m/s",
118144
"$ 10.99",
119145
120146
"(555) 555-5555",
121147
"CA - California",
122148
// TODO: US SSN
123-
// TODO: US EIN
149+
"00-1234567",
124150
"4/11/2025",
125151
"6:29:45 pm",
126152
// TODO: Date and Time
@@ -131,7 +157,6 @@ class PdfProductionTest
131157
// TODO: Dropdown with Search
132158
"Antarctica",
133159
// TODO: Dynamic Dropdown with Search
134-
"For #5670: test PDF template output 1 / 2",
135160
// TODO: Radio Buttons
136161
// TODO: Radio Buttons with "Other"
137162
// TODO: Checkboxes
@@ -140,7 +165,6 @@ class PdfProductionTest
140165
// TODO: Yes/No Answer
141166
// TODO: Image Attachment
142167
// TODO: Handwritten Signature
143-
"For #5670: test PDF template output 2 / 2",
144168
)
145169

146170
val (_, content, _) =

src/main/resources/config/properties-internal.xml

+4
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,9 @@
296296
<!-- PDF template formatting -->
297297
<!-- NOTE: In the future we don't want those to apply to XHTML, but to an intermediate representation -->
298298
<!-- NOTE: Can't use xxf:split() in these expressions yet (saxon:evaluate() doesn't find the functions). -->
299+
<property as="xs:string" name="oxf.fr.pdf.format.input-field">
300+
(./descendant-or-self::*[tokenize(@class, '\s+') = 'xforms-input']/input)[1]/@value/string()
301+
</property>
299302
<property as="xs:string" name="oxf.fr.pdf.format.input-string">
300303
(./descendant-or-self::*[tokenize(@class, '\s+') = 'xforms-input']/input)[1]/@value/string()
301304
</property>
@@ -362,6 +365,7 @@
362365
.//*[tokenize(@class, '\s+') = 'fr-autocomplete-external-value']/input/@value/string()
363366
</property>
364367

368+
<property as="xs:string" name="oxf.fr.pdf.map.*.*.fr-pdf-template-field.*" value="input-field"/>
365369
<property as="xs:string" name="oxf.fr.pdf.map.*.*.xforms-input.*" value="input-string"/>
366370
<property as="xs:string" name="oxf.fr.pdf.map.*.*.xforms-input.date" value="input-string"/>
367371
<property as="xs:string" name="oxf.fr.pdf.map.*.*.xforms-input.time" value="input-string"/>

src/main/resources/config/properties-xforms.xml

+1
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@
253253
fr:autosize-textarea
254254
fb:xpath-completion
255255
<!-- For static readonly output bindings -->
256+
fr:pdf-template-field
256257
fr:date
257258
fr:time
258259
fr:datetime

0 commit comments

Comments
 (0)