|
| 1 | +{ |
| 2 | + "schemaType": "mieforms-v1.0", |
| 3 | + "id": "rich-content-test-schema", |
| 4 | + "title": "Rich Content Fields — Comprehensive Test", |
| 5 | + "fields": [ |
| 6 | + |
| 7 | + { |
| 8 | + "id": "intro-html", |
| 9 | + "fieldType": "html", |
| 10 | + "htmlContent": "<h2>Rich Content Fields Test</h2><p>This form exercises all five rich content field types:</p><ul><li><strong>HTML</strong> — arbitrary HTML rendered in a sandboxed iframe</li><li><strong>Image</strong> — upload / display an image with caption</li><li><strong>Diagram</strong> — freehand drawing pad with a background hint</li><li><strong>Signature</strong> — signature capture pad</li><li><strong>Display</strong> — computed read-only text with live field interpolation and markdown formatting</li></ul><p>Fill in the inputs below to observe the Display field update in real-time.</p>", |
| 11 | + "iframeHeight": 230 |
| 12 | + }, |
| 13 | + |
| 14 | + { |
| 15 | + "id": "section-inputs", |
| 16 | + "fieldType": "section", |
| 17 | + "title": "Inputs (drive the Display field)", |
| 18 | + "fields": [ |
| 19 | + |
| 20 | + { |
| 21 | + "id": "first-name", |
| 22 | + "fieldType": "text", |
| 23 | + "question": "First name", |
| 24 | + "inputType": "string", |
| 25 | + "required": true |
| 26 | + }, |
| 27 | + |
| 28 | + { |
| 29 | + "id": "last-name", |
| 30 | + "fieldType": "text", |
| 31 | + "question": "Last name", |
| 32 | + "inputType": "string", |
| 33 | + "required": true |
| 34 | + }, |
| 35 | + |
| 36 | + { |
| 37 | + "id": "weight-kg", |
| 38 | + "fieldType": "text", |
| 39 | + "question": "Weight (kg)", |
| 40 | + "inputType": "number", |
| 41 | + "required": true, |
| 42 | + "unit": "kg" |
| 43 | + }, |
| 44 | + |
| 45 | + { |
| 46 | + "id": "height-cm", |
| 47 | + "fieldType": "text", |
| 48 | + "question": "Height (cm)", |
| 49 | + "inputType": "number", |
| 50 | + "required": true, |
| 51 | + "unit": "cm" |
| 52 | + }, |
| 53 | + |
| 54 | + { |
| 55 | + "id": "score-a", |
| 56 | + "fieldType": "slider", |
| 57 | + "question": "Score A (1–10)", |
| 58 | + "required": true, |
| 59 | + "options": [ |
| 60 | + { "id": "sa-1", "value": "1", "text": "1" }, |
| 61 | + { "id": "sa-2", "value": "2", "text": "2" }, |
| 62 | + { "id": "sa-3", "value": "3", "text": "3" }, |
| 63 | + { "id": "sa-4", "value": "4", "text": "4" }, |
| 64 | + { "id": "sa-5", "value": "5", "text": "5" }, |
| 65 | + { "id": "sa-6", "value": "6", "text": "6" }, |
| 66 | + { "id": "sa-7", "value": "7", "text": "7" }, |
| 67 | + { "id": "sa-8", "value": "8", "text": "8" }, |
| 68 | + { "id": "sa-9", "value": "9", "text": "9" }, |
| 69 | + { "id": "sa-10", "value": "10", "text": "10" } |
| 70 | + ] |
| 71 | + }, |
| 72 | + |
| 73 | + { |
| 74 | + "id": "score-b", |
| 75 | + "fieldType": "slider", |
| 76 | + "question": "Score B (1–10)", |
| 77 | + "required": true, |
| 78 | + "options": [ |
| 79 | + { "id": "sb-1", "value": "1", "text": "1" }, |
| 80 | + { "id": "sb-2", "value": "2", "text": "2" }, |
| 81 | + { "id": "sb-3", "value": "3", "text": "3" }, |
| 82 | + { "id": "sb-4", "value": "4", "text": "4" }, |
| 83 | + { "id": "sb-5", "value": "5", "text": "5" }, |
| 84 | + { "id": "sb-6", "value": "6", "text": "6" }, |
| 85 | + { "id": "sb-7", "value": "7", "text": "7" }, |
| 86 | + { "id": "sb-8", "value": "8", "text": "8" }, |
| 87 | + { "id": "sb-9", "value": "9", "text": "9" }, |
| 88 | + { "id": "sb-10", "value": "10", "text": "10" } |
| 89 | + ] |
| 90 | + } |
| 91 | + |
| 92 | + ] |
| 93 | + }, |
| 94 | + |
| 95 | + { |
| 96 | + "id": "section-display", |
| 97 | + "fieldType": "section", |
| 98 | + "title": "Display Field Tests", |
| 99 | + "fields": [ |
| 100 | + |
| 101 | + { |
| 102 | + "id": "display-simple-ref", |
| 103 | + "fieldType": "display", |
| 104 | + "question": "Simple field reference — {field-id}", |
| 105 | + "content": "Hello, {first-name} {last-name}!\n\nYour first name is *{first-name}* and your last name is *{last-name}*." |
| 106 | + }, |
| 107 | + |
| 108 | + { |
| 109 | + "id": "display-arithmetic", |
| 110 | + "fieldType": "display", |
| 111 | + "question": "Arithmetic expressions — <expression>", |
| 112 | + "content": "# Score Summary\n\n- Score A: {score-a}\n- Score B: {score-b}\n- Combined: <{score-a} + {score-b}>\n- Average: <({score-a} + {score-b}) / 2>\n- Product: <{score-a} * {score-b}>" |
| 113 | + }, |
| 114 | + |
| 115 | + { |
| 116 | + "id": "display-bmi", |
| 117 | + "fieldType": "display", |
| 118 | + "question": "Multi-step calculation — BMI", |
| 119 | + "content": "## BMI Calculator\n\n- Weight: {weight-kg} kg\n- Height: {height-cm} cm\n- BMI: <{weight-kg} / (({height-cm} / 100) * ({height-cm} / 100))>" |
| 120 | + }, |
| 121 | + |
| 122 | + { |
| 123 | + "id": "display-markdown", |
| 124 | + "fieldType": "display", |
| 125 | + "question": "Markdown formatting — bold, italic, underline, strike, bullets, headings", |
| 126 | + "content": "# Heading 1\n## Heading 2\n### Heading 3\n\n*bold text* and -italic text- and _underlined text_ and ~strikethrough text~\n\n- Bullet one\n- Bullet two\n- Bullet three: score is {score-a}" |
| 127 | + }, |
| 128 | + |
| 129 | + { |
| 130 | + "id": "display-conditional-shown", |
| 131 | + "fieldType": "display", |
| 132 | + "question": "Conditionally visible — appears when Score A > 7", |
| 133 | + "content": "## High Score Alert\n\n*{first-name}* scored *{score-a}* on Score A — that's above the threshold of 7!\n\nCombined total: <{score-a} + {score-b}>", |
| 134 | + "rules": [ |
| 135 | + { |
| 136 | + "effect": "visible", |
| 137 | + "logic": "AND", |
| 138 | + "conditions": [ |
| 139 | + { "conditionType": "expression", "expression": "{score-a} > 7" } |
| 140 | + ] |
| 141 | + } |
| 142 | + ] |
| 143 | + }, |
| 144 | + |
| 145 | + { |
| 146 | + "id": "display-conditional-hidden", |
| 147 | + "fieldType": "display", |
| 148 | + "question": "Conditionally visible — appears when Score A <= 7", |
| 149 | + "content": "Score A is {score-a} — under the threshold. Try increasing it above 7 to swap these two display fields.", |
| 150 | + "rules": [ |
| 151 | + { |
| 152 | + "effect": "visible", |
| 153 | + "logic": "AND", |
| 154 | + "conditions": [ |
| 155 | + { "conditionType": "expression", "expression": "{score-a} <= 7" } |
| 156 | + ] |
| 157 | + } |
| 158 | + ] |
| 159 | + } |
| 160 | + |
| 161 | + ] |
| 162 | + }, |
| 163 | + |
| 164 | + { |
| 165 | + "id": "section-html", |
| 166 | + "fieldType": "section", |
| 167 | + "title": "HTML Field Tests", |
| 168 | + "fields": [ |
| 169 | + |
| 170 | + { |
| 171 | + "id": "html-basic", |
| 172 | + "fieldType": "html", |
| 173 | + "htmlContent": "<h3>Basic HTML rendering</h3><p>This field renders arbitrary HTML in a <code>sandbox=\"\"</code> iframe.</p><p>Supported content: headings, paragraphs, lists, tables, images, links, inline styles.</p>", |
| 174 | + "iframeHeight": 140 |
| 175 | + }, |
| 176 | + |
| 177 | + { |
| 178 | + "id": "html-table", |
| 179 | + "fieldType": "html", |
| 180 | + "htmlContent": "<h3>Table example</h3><table style=\"border-collapse:collapse;width:100%\"><thead><tr style=\"background:#f3f4f6\"><th style=\"padding:8px 12px;border:1px solid #e5e7eb;text-align:left\">Item</th><th style=\"padding:8px 12px;border:1px solid #e5e7eb;text-align:left\">Value</th></tr></thead><tbody><tr><td style=\"padding:8px 12px;border:1px solid #e5e7eb\">Alpha</td><td style=\"padding:8px 12px;border:1px solid #e5e7eb\">100</td></tr><tr><td style=\"padding:8px 12px;border:1px solid #e5e7eb\">Beta</td><td style=\"padding:8px 12px;border:1px solid #e5e7eb\">200</td></tr><tr><td style=\"padding:8px 12px;border:1px solid #e5e7eb\">Gamma</td><td style=\"padding:8px 12px;border:1px solid #e5e7eb\">300</td></tr></tbody></table>", |
| 181 | + "iframeHeight": 180 |
| 182 | + }, |
| 183 | + |
| 184 | + { |
| 185 | + "id": "html-xss-probe", |
| 186 | + "fieldType": "html", |
| 187 | + "htmlContent": "<!-- XSS / injection test vectors — all must be inert inside sandbox=\"\" -->\n<script>document.title='XSS';<\/script>\n<img src=\"x\" onerror=\"document.title='XSS'\" />\n<a href=\"javascript:alert('XSS')\">Click me (href must be inert)</a>\n<iframe src=\"https://example.com\"></iframe>\n<p><strong>Expected:</strong> All vectors above are inert. Page title unchanged, no alert fires, no navigation.</p>", |
| 188 | + "iframeHeight": 120 |
| 189 | + } |
| 190 | + |
| 191 | + ] |
| 192 | + }, |
| 193 | + |
| 194 | + { |
| 195 | + "id": "section-drawing", |
| 196 | + "fieldType": "section", |
| 197 | + "title": "Drawing Fields (Image / Diagram / Signature)", |
| 198 | + "fields": [ |
| 199 | + |
| 200 | + { |
| 201 | + "id": "test-image", |
| 202 | + "fieldType": "image", |
| 203 | + "question": "Image field — upload a file or paste a URL", |
| 204 | + "altText": "Test image upload", |
| 205 | + "caption": "Supports PNG, JPG, GIF, WebP. Stored as a data URL in the response." |
| 206 | + }, |
| 207 | + |
| 208 | + { |
| 209 | + "id": "test-diagram", |
| 210 | + "fieldType": "diagram", |
| 211 | + "question": "Diagram field — freehand drawing pad", |
| 212 | + "padPlaceholder": "Draw anything here — the pad records normalised strokes" |
| 213 | + }, |
| 214 | + |
| 215 | + { |
| 216 | + "id": "test-signature", |
| 217 | + "fieldType": "signature", |
| 218 | + "question": "Signature field — sign your name", |
| 219 | + "padPlaceholder": "Sign here", |
| 220 | + "required": true |
| 221 | + } |
| 222 | + |
| 223 | + ] |
| 224 | + } |
| 225 | + |
| 226 | + ] |
| 227 | +} |
0 commit comments