@pie-qti/item-player 0.1.1 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (469) hide show
  1. package/README.md +1 -1
  2. package/dist/components/actions/typesetAction.d.ts +24 -0
  3. package/dist/components/actions/typesetAction.d.ts.map +1 -0
  4. package/dist/components/actions/typesetAction.js +59 -0
  5. package/dist/components/utils/assignProps.d.ts +2 -0
  6. package/dist/components/utils/assignProps.d.ts.map +1 -0
  7. package/dist/components/utils/assignProps.js +1 -0
  8. package/dist/components/utils/feedbackUtils.d.ts +73 -0
  9. package/dist/components/utils/feedbackUtils.d.ts.map +1 -0
  10. package/dist/components/utils/feedbackUtils.js +93 -0
  11. package/dist/components/utils/index.d.ts +6 -0
  12. package/dist/components/utils/index.d.ts.map +1 -0
  13. package/dist/components/utils/index.js +5 -0
  14. package/dist/core/ComponentRegistry.d.ts +119 -0
  15. package/dist/core/ComponentRegistry.d.ts.map +1 -0
  16. package/dist/core/ComponentRegistry.js +123 -0
  17. package/dist/core/ItemRenderer.d.ts +91 -0
  18. package/dist/core/ItemRenderer.d.ts.map +1 -0
  19. package/dist/core/ItemRenderer.js +258 -0
  20. package/dist/core/Player.d.ts +143 -0
  21. package/dist/core/Player.d.ts.map +1 -0
  22. package/dist/core/Player.js +1081 -0
  23. package/dist/core/Plugin.d.ts +105 -0
  24. package/dist/core/Plugin.d.ts.map +1 -0
  25. package/dist/core/Plugin.js +7 -0
  26. package/dist/core/PluginManager.d.ts +56 -0
  27. package/dist/core/PluginManager.d.ts.map +1 -0
  28. package/dist/core/PluginManager.js +147 -0
  29. package/dist/core/constants.d.ts +68 -0
  30. package/dist/core/constants.d.ts.map +1 -0
  31. package/dist/core/constants.js +106 -0
  32. package/dist/core/declarations.d.ts +45 -0
  33. package/dist/core/declarations.d.ts.map +1 -0
  34. package/dist/core/declarations.js +133 -0
  35. package/dist/core/parsingLimits.d.ts +12 -0
  36. package/dist/core/parsingLimits.d.ts.map +1 -0
  37. package/dist/core/parsingLimits.js +45 -0
  38. package/dist/core/random.d.ts +12 -0
  39. package/dist/core/random.d.ts.map +1 -0
  40. package/dist/core/random.js +21 -0
  41. package/dist/core/sanitizer.d.ts +34 -0
  42. package/dist/core/sanitizer.d.ts.map +1 -0
  43. package/dist/core/sanitizer.js +198 -0
  44. package/dist/core/trustedTypes.d.ts +16 -0
  45. package/dist/core/trustedTypes.d.ts.map +1 -0
  46. package/dist/core/trustedTypes.js +55 -0
  47. package/dist/core/urlPolicy.d.ts +8 -0
  48. package/dist/core/urlPolicy.d.ts.map +1 -0
  49. package/dist/core/urlPolicy.js +87 -0
  50. package/dist/extensions/MathLiveEditor.d.ts +32 -0
  51. package/dist/extensions/MathLiveEditor.d.ts.map +1 -0
  52. package/dist/extensions/MathLiveEditor.js +249 -0
  53. package/dist/extraction/ExtractionRegistry.d.ts +112 -0
  54. package/dist/extraction/ExtractionRegistry.d.ts.map +1 -0
  55. package/dist/extraction/ExtractionRegistry.js +258 -0
  56. package/dist/extraction/createContext.d.ts +30 -0
  57. package/dist/extraction/createContext.d.ts.map +1 -0
  58. package/dist/extraction/createContext.js +39 -0
  59. package/dist/extraction/extractors/associateExtractor.d.ts +28 -0
  60. package/dist/extraction/extractors/associateExtractor.d.ts.map +1 -0
  61. package/dist/extraction/extractors/associateExtractor.js +94 -0
  62. package/dist/extraction/extractors/choiceExtractor.d.ts +25 -0
  63. package/dist/extraction/extractors/choiceExtractor.d.ts.map +1 -0
  64. package/dist/extraction/extractors/choiceExtractor.js +83 -0
  65. package/dist/extraction/extractors/customExtractor.d.ts +20 -0
  66. package/dist/extraction/extractors/customExtractor.d.ts.map +1 -0
  67. package/dist/extraction/extractors/customExtractor.js +51 -0
  68. package/dist/extraction/extractors/drawingExtractor.d.ts +30 -0
  69. package/dist/extraction/extractors/drawingExtractor.d.ts.map +1 -0
  70. package/dist/extraction/extractors/drawingExtractor.js +78 -0
  71. package/dist/extraction/extractors/endAttemptExtractor.d.ts +20 -0
  72. package/dist/extraction/extractors/endAttemptExtractor.d.ts.map +1 -0
  73. package/dist/extraction/extractors/endAttemptExtractor.js +53 -0
  74. package/dist/extraction/extractors/extendedTextExtractor.d.ts +21 -0
  75. package/dist/extraction/extractors/extendedTextExtractor.d.ts.map +1 -0
  76. package/dist/extraction/extractors/extendedTextExtractor.js +57 -0
  77. package/dist/extraction/extractors/gapMatchExtractor.d.ts +28 -0
  78. package/dist/extraction/extractors/gapMatchExtractor.d.ts.map +1 -0
  79. package/dist/extraction/extractors/gapMatchExtractor.js +142 -0
  80. package/dist/extraction/extractors/graphicAssociateExtractor.d.ts +40 -0
  81. package/dist/extraction/extractors/graphicAssociateExtractor.d.ts.map +1 -0
  82. package/dist/extraction/extractors/graphicAssociateExtractor.js +140 -0
  83. package/dist/extraction/extractors/graphicGapMatchExtractor.d.ts +42 -0
  84. package/dist/extraction/extractors/graphicGapMatchExtractor.d.ts.map +1 -0
  85. package/dist/extraction/extractors/graphicGapMatchExtractor.js +144 -0
  86. package/dist/extraction/extractors/graphicOrderExtractor.d.ts +37 -0
  87. package/dist/extraction/extractors/graphicOrderExtractor.d.ts.map +1 -0
  88. package/dist/extraction/extractors/graphicOrderExtractor.js +121 -0
  89. package/dist/extraction/extractors/hotspotExtractor.d.ts +38 -0
  90. package/dist/extraction/extractors/hotspotExtractor.d.ts.map +1 -0
  91. package/dist/extraction/extractors/hotspotExtractor.js +140 -0
  92. package/dist/extraction/extractors/hottextExtractor.d.ts +26 -0
  93. package/dist/extraction/extractors/hottextExtractor.d.ts.map +1 -0
  94. package/dist/extraction/extractors/hottextExtractor.js +120 -0
  95. package/dist/extraction/extractors/index.d.ts +62 -0
  96. package/dist/extraction/extractors/index.d.ts.map +1 -0
  97. package/dist/extraction/extractors/index.js +84 -0
  98. package/dist/extraction/extractors/inlineChoiceExtractor.d.ts +22 -0
  99. package/dist/extraction/extractors/inlineChoiceExtractor.d.ts.map +1 -0
  100. package/dist/extraction/extractors/inlineChoiceExtractor.js +67 -0
  101. package/dist/extraction/extractors/matchExtractor.d.ts +32 -0
  102. package/dist/extraction/extractors/matchExtractor.d.ts.map +1 -0
  103. package/dist/extraction/extractors/matchExtractor.js +134 -0
  104. package/dist/extraction/extractors/mediaExtractor.d.ts +33 -0
  105. package/dist/extraction/extractors/mediaExtractor.d.ts.map +1 -0
  106. package/dist/extraction/extractors/mediaExtractor.js +125 -0
  107. package/dist/extraction/extractors/orderExtractor.d.ts +26 -0
  108. package/dist/extraction/extractors/orderExtractor.d.ts.map +1 -0
  109. package/dist/extraction/extractors/orderExtractor.js +86 -0
  110. package/dist/extraction/extractors/positionObjectExtractor.d.ts +59 -0
  111. package/dist/extraction/extractors/positionObjectExtractor.d.ts.map +1 -0
  112. package/dist/extraction/extractors/positionObjectExtractor.js +191 -0
  113. package/dist/extraction/extractors/selectPointExtractor.d.ts +31 -0
  114. package/dist/extraction/extractors/selectPointExtractor.d.ts.map +1 -0
  115. package/dist/extraction/extractors/selectPointExtractor.js +109 -0
  116. package/dist/extraction/extractors/sliderExtractor.d.ts +24 -0
  117. package/dist/extraction/extractors/sliderExtractor.d.ts.map +1 -0
  118. package/dist/extraction/extractors/sliderExtractor.js +73 -0
  119. package/dist/extraction/extractors/textEntryExtractor.d.ts +20 -0
  120. package/dist/extraction/extractors/textEntryExtractor.d.ts.map +1 -0
  121. package/dist/extraction/extractors/textEntryExtractor.js +48 -0
  122. package/dist/extraction/extractors/uploadExtractor.d.ts +20 -0
  123. package/dist/extraction/extractors/uploadExtractor.d.ts.map +1 -0
  124. package/dist/extraction/extractors/uploadExtractor.js +52 -0
  125. package/dist/extraction/index.d.ts +49 -0
  126. package/dist/extraction/index.d.ts.map +1 -0
  127. package/dist/extraction/index.js +49 -0
  128. package/dist/extraction/types.d.ts +209 -0
  129. package/dist/extraction/types.d.ts.map +1 -0
  130. package/dist/extraction/types.js +30 -0
  131. package/dist/extraction/utils.d.ts +15 -0
  132. package/dist/extraction/utils.d.ts.map +1 -0
  133. package/dist/extraction/utils.js +178 -0
  134. package/dist/iframe/IFramePlayerHost.d.ts +122 -0
  135. package/dist/iframe/IFramePlayerHost.d.ts.map +1 -0
  136. package/dist/iframe/IFramePlayerHost.js +172 -0
  137. package/dist/iframe/index.d.ts +9 -0
  138. package/dist/iframe/index.d.ts.map +1 -0
  139. package/dist/iframe/index.js +8 -0
  140. package/dist/iframe/protocol.d.ts +75 -0
  141. package/dist/iframe/protocol.d.ts.map +1 -0
  142. package/dist/iframe/protocol.js +53 -0
  143. package/dist/index.d.ts +28 -0
  144. package/dist/index.d.ts.map +1 -0
  145. package/dist/index.js +35 -0
  146. package/dist/server.d.ts +10 -0
  147. package/dist/server.d.ts.map +1 -0
  148. package/dist/server.js +10 -0
  149. package/dist/types/index.d.ts +290 -0
  150. package/dist/types/index.d.ts.map +1 -0
  151. package/dist/types/index.js +7 -0
  152. package/dist/types/interactions.d.ts +323 -0
  153. package/dist/types/interactions.d.ts.map +1 -0
  154. package/dist/types/interactions.js +7 -0
  155. package/dist/types/responseValidation.d.ts +25 -0
  156. package/dist/types/responseValidation.d.ts.map +1 -0
  157. package/dist/types/responseValidation.js +1 -0
  158. package/dist/utils/PerformanceMonitor.d.ts +170 -0
  159. package/dist/utils/PerformanceMonitor.d.ts.map +1 -0
  160. package/dist/utils/PerformanceMonitor.js +242 -0
  161. package/dist/utils/drawingUtils.d.ts +39 -0
  162. package/dist/utils/drawingUtils.d.ts.map +1 -0
  163. package/dist/utils/drawingUtils.js +57 -0
  164. package/dist/utils/responseUtils.d.ts +16 -0
  165. package/dist/utils/responseUtils.d.ts.map +1 -0
  166. package/dist/utils/responseUtils.js +45 -0
  167. package/dist/utils/touchDragHelper.d.ts +2 -0
  168. package/dist/utils/touchDragHelper.d.ts.map +1 -0
  169. package/dist/utils/touchDragHelper.js +1 -0
  170. package/dist/web-components/QTIInteractionBase.d.ts +120 -0
  171. package/dist/web-components/QTIInteractionBase.d.ts.map +1 -0
  172. package/dist/web-components/QTIInteractionBase.js +243 -0
  173. package/dist/web-components/QTIInteractionElement.d.ts +77 -0
  174. package/dist/web-components/QTIInteractionElement.d.ts.map +1 -0
  175. package/dist/web-components/QTIInteractionElement.js +61 -0
  176. package/dist/web-components/index.d.ts +8 -0
  177. package/dist/web-components/index.d.ts.map +1 -0
  178. package/dist/web-components/index.js +10 -0
  179. package/package.json +94 -76
  180. package/src/__tests__/qti3-attribute-extraction.test.ts +174 -0
  181. package/src/__tests__/qti3-debug.test.ts +140 -0
  182. package/src/__tests__/qti3-extraction.test.ts +309 -0
  183. package/src/components/ItemBody.svelte +3 -1
  184. package/src/components/utils/assignProps.ts +1 -23
  185. package/src/core/Player.ts +138 -34
  186. package/src/core/parsingLimits.ts +1 -1
  187. package/src/extensions/MathLiveEditor.ts +6 -3
  188. package/src/extraction/ExtractionRegistry.ts +46 -10
  189. package/src/extraction/createContext.ts +6 -1
  190. package/src/extraction/extractors/extendedTextExtractor.ts +5 -2
  191. package/src/extraction/extractors/matchExtractor.ts +2 -2
  192. package/src/extraction/extractors/textEntryExtractor.ts +4 -2
  193. package/src/extraction/utils.ts +99 -16
  194. package/src/index.ts +2 -0
  195. package/src/types/index.ts +28 -8
  196. package/src/types/xmldom.d.ts +12 -0
  197. package/src/utils/drawingUtils.ts +73 -0
  198. package/src/utils/touchDragHelper.ts +1 -211
  199. package/.turbo/turbo-build.log +0 -1
  200. package/CHANGELOG.md +0 -9
  201. package/docs/QTI-COMPLIANCE.md +0 -197
  202. package/docs/WCAG-2.2-COMPLIANCE.md +0 -466
  203. package/docs/custom-extractors.md +0 -679
  204. package/docs/iframe-mode.md +0 -78
  205. package/docs/security-audit.md +0 -236
  206. package/docs/server-api.md +0 -691
  207. package/tests/conformance/FIXTURE_POLICY.md +0 -29
  208. package/tests/conformance/README.md +0 -70
  209. package/tests/conformance/fixtures/baseTypes_all/cases.json +0 -61
  210. package/tests/conformance/fixtures/baseTypes_all/item.xml +0 -131
  211. package/tests/conformance/fixtures/baseTypes_all/manifest.json +0 -7
  212. package/tests/conformance/fixtures/choice_match_correct/cases.json +0 -17
  213. package/tests/conformance/fixtures/choice_match_correct/item.xml +0 -55
  214. package/tests/conformance/fixtures/choice_match_correct/manifest.json +0 -14
  215. package/tests/conformance/fixtures/contains_multiple/cases.json +0 -12
  216. package/tests/conformance/fixtures/contains_multiple/item.xml +0 -37
  217. package/tests/conformance/fixtures/contains_multiple/manifest.json +0 -13
  218. package/tests/conformance/fixtures/isNull_isNotNull/cases.json +0 -9
  219. package/tests/conformance/fixtures/isNull_isNotNull/item.xml +0 -41
  220. package/tests/conformance/fixtures/isNull_isNotNull/manifest.json +0 -23
  221. package/tests/conformance/fixtures/mapResponse_bounds_default_duplicates/cases.json +0 -27
  222. package/tests/conformance/fixtures/mapResponse_bounds_default_duplicates/item.xml +0 -30
  223. package/tests/conformance/fixtures/mapResponse_bounds_default_duplicates/manifest.json +0 -15
  224. package/tests/conformance/fixtures/mapResponse_integer_mapKey/cases.json +0 -11
  225. package/tests/conformance/fixtures/mapResponse_integer_mapKey/item.xml +0 -26
  226. package/tests/conformance/fixtures/mapResponse_integer_mapKey/manifest.json +0 -13
  227. package/tests/conformance/fixtures/mapResponse_mapEntry_caseSensitive_override/cases.json +0 -27
  228. package/tests/conformance/fixtures/mapResponse_mapEntry_caseSensitive_override/item.xml +0 -32
  229. package/tests/conformance/fixtures/mapResponse_mapEntry_caseSensitive_override/manifest.json +0 -7
  230. package/tests/conformance/fixtures/mapResponse_mapping_caseSensitive_defaultValue/cases.json +0 -9
  231. package/tests/conformance/fixtures/mapResponse_mapping_caseSensitive_defaultValue/item.xml +0 -25
  232. package/tests/conformance/fixtures/mapResponse_mapping_caseSensitive_defaultValue/manifest.json +0 -12
  233. package/tests/conformance/fixtures/mapResponse_multiple_cardinality/cases.json +0 -12
  234. package/tests/conformance/fixtures/mapResponse_multiple_cardinality/item.xml +0 -35
  235. package/tests/conformance/fixtures/mapResponse_multiple_cardinality/manifest.json +0 -11
  236. package/tests/conformance/fixtures/mapping_bounds_upperLower/cases.json +0 -12
  237. package/tests/conformance/fixtures/mapping_bounds_upperLower/item.xml +0 -37
  238. package/tests/conformance/fixtures/mapping_bounds_upperLower/manifest.json +0 -11
  239. package/tests/conformance/fixtures/mapping_mapResponse/cases.json +0 -22
  240. package/tests/conformance/fixtures/mapping_mapResponse/item.xml +0 -53
  241. package/tests/conformance/fixtures/mapping_mapResponse/manifest.json +0 -16
  242. package/tests/conformance/fixtures/member_multiple/cases.json +0 -12
  243. package/tests/conformance/fixtures/member_multiple/item.xml +0 -37
  244. package/tests/conformance/fixtures/member_multiple/manifest.json +0 -13
  245. package/tests/conformance/fixtures/modalFeedback_basic/cases.json +0 -17
  246. package/tests/conformance/fixtures/modalFeedback_basic/item.xml +0 -52
  247. package/tests/conformance/fixtures/modalFeedback_basic/manifest.json +0 -13
  248. package/tests/conformance/fixtures/multiple_unordered_match/cases.json +0 -17
  249. package/tests/conformance/fixtures/multiple_unordered_match/item.xml +0 -44
  250. package/tests/conformance/fixtures/multiple_unordered_match/manifest.json +0 -11
  251. package/tests/conformance/fixtures/ordered_match/cases.json +0 -17
  252. package/tests/conformance/fixtures/ordered_match/item.xml +0 -48
  253. package/tests/conformance/fixtures/ordered_match/manifest.json +0 -13
  254. package/tests/conformance/fixtures/outcomeProcessing_derive_percent_passfail/cases.json +0 -27
  255. package/tests/conformance/fixtures/outcomeProcessing_derive_percent_passfail/item.xml +0 -103
  256. package/tests/conformance/fixtures/outcomeProcessing_derive_percent_passfail/manifest.json +0 -7
  257. package/tests/conformance/fixtures/outcomeProcessing_exitTest/cases.json +0 -15
  258. package/tests/conformance/fixtures/outcomeProcessing_exitTest/item.xml +0 -33
  259. package/tests/conformance/fixtures/outcomeProcessing_exitTest/manifest.json +0 -10
  260. package/tests/conformance/fixtures/outcomeProcessing_numberExpressions/cases.json +0 -14
  261. package/tests/conformance/fixtures/outcomeProcessing_numberExpressions/item.xml +0 -26
  262. package/tests/conformance/fixtures/outcomeProcessing_numberExpressions/manifest.json +0 -8
  263. package/tests/conformance/fixtures/outcomeProcessing_outcomeCondition_equal/cases.json +0 -17
  264. package/tests/conformance/fixtures/outcomeProcessing_outcomeCondition_equal/item.xml +0 -43
  265. package/tests/conformance/fixtures/outcomeProcessing_outcomeCondition_equal/manifest.json +0 -16
  266. package/tests/conformance/fixtures/outcomeProcessing_outcomeCondition_toBoolean/cases.json +0 -27
  267. package/tests/conformance/fixtures/outcomeProcessing_outcomeCondition_toBoolean/item.xml +0 -37
  268. package/tests/conformance/fixtures/outcomeProcessing_outcomeCondition_toBoolean/manifest.json +0 -16
  269. package/tests/conformance/fixtures/outcomeProcessing_outcomeMaximum/cases.json +0 -14
  270. package/tests/conformance/fixtures/outcomeProcessing_outcomeMaximum/item.xml +0 -35
  271. package/tests/conformance/fixtures/outcomeProcessing_outcomeMaximum/manifest.json +0 -8
  272. package/tests/conformance/fixtures/outcomeProcessing_outcomeMinimum/cases.json +0 -14
  273. package/tests/conformance/fixtures/outcomeProcessing_outcomeMinimum/item.xml +0 -35
  274. package/tests/conformance/fixtures/outcomeProcessing_outcomeMinimum/manifest.json +0 -8
  275. package/tests/conformance/fixtures/outcomeProcessing_outcomeProcessingFragment/cases.json +0 -15
  276. package/tests/conformance/fixtures/outcomeProcessing_outcomeProcessingFragment/item.xml +0 -39
  277. package/tests/conformance/fixtures/outcomeProcessing_outcomeProcessingFragment/manifest.json +0 -11
  278. package/tests/conformance/fixtures/outcomeProcessing_testVariables/cases.json +0 -14
  279. package/tests/conformance/fixtures/outcomeProcessing_testVariables/item.xml +0 -35
  280. package/tests/conformance/fixtures/outcomeProcessing_testVariables/manifest.json +0 -8
  281. package/tests/conformance/fixtures/pair_unordered_match/cases.json +0 -22
  282. package/tests/conformance/fixtures/pair_unordered_match/item.xml +0 -44
  283. package/tests/conformance/fixtures/pair_unordered_match/manifest.json +0 -13
  284. package/tests/conformance/fixtures/positionObject_coordinateSystem_aspectRatio/cases.json +0 -95
  285. package/tests/conformance/fixtures/positionObject_coordinateSystem_aspectRatio/item.xml +0 -53
  286. package/tests/conformance/fixtures/positionObject_mapResponsePoint_scoring/cases.json +0 -115
  287. package/tests/conformance/fixtures/positionObject_mapResponsePoint_scoring/item.xml +0 -45
  288. package/tests/conformance/fixtures/positionObject_mapResponse_wrong/cases.json +0 -29
  289. package/tests/conformance/fixtures/positionObject_mapResponse_wrong/item.xml +0 -40
  290. package/tests/conformance/fixtures/responseCondition_elseIf_chain/cases.json +0 -10
  291. package/tests/conformance/fixtures/responseCondition_elseIf_chain/item.xml +0 -49
  292. package/tests/conformance/fixtures/responseCondition_elseIf_chain/manifest.json +0 -15
  293. package/tests/conformance/fixtures/responseProcessing_anyN/cases.json +0 -27
  294. package/tests/conformance/fixtures/responseProcessing_anyN/item.xml +0 -47
  295. package/tests/conformance/fixtures/responseProcessing_anyN/manifest.json +0 -16
  296. package/tests/conformance/fixtures/responseProcessing_anyN_allN/cases.json +0 -27
  297. package/tests/conformance/fixtures/responseProcessing_anyN_allN/item.xml +0 -69
  298. package/tests/conformance/fixtures/responseProcessing_anyN_allN/manifest.json +0 -23
  299. package/tests/conformance/fixtures/responseProcessing_arithmetic_nulls/cases.json +0 -15
  300. package/tests/conformance/fixtures/responseProcessing_arithmetic_nulls/item.xml +0 -58
  301. package/tests/conformance/fixtures/responseProcessing_arithmetic_nulls/manifest.json +0 -15
  302. package/tests/conformance/fixtures/responseProcessing_boolean_compare_ops/cases.json +0 -37
  303. package/tests/conformance/fixtures/responseProcessing_boolean_compare_ops/item.xml +0 -94
  304. package/tests/conformance/fixtures/responseProcessing_boolean_compare_ops/manifest.json +0 -27
  305. package/tests/conformance/fixtures/responseProcessing_containerSize_index/cases.json +0 -33
  306. package/tests/conformance/fixtures/responseProcessing_containerSize_index/item.xml +0 -79
  307. package/tests/conformance/fixtures/responseProcessing_containerSize_index/manifest.json +0 -16
  308. package/tests/conformance/fixtures/responseProcessing_customOperator/cases.json +0 -15
  309. package/tests/conformance/fixtures/responseProcessing_customOperator/item.xml +0 -30
  310. package/tests/conformance/fixtures/responseProcessing_customOperator/manifest.json +0 -12
  311. package/tests/conformance/fixtures/responseProcessing_default_expression/cases.json +0 -12
  312. package/tests/conformance/fixtures/responseProcessing_default_expression/item.xml +0 -48
  313. package/tests/conformance/fixtures/responseProcessing_default_expression/manifest.json +0 -13
  314. package/tests/conformance/fixtures/responseProcessing_deleteValue_repeat/cases.json +0 -29
  315. package/tests/conformance/fixtures/responseProcessing_deleteValue_repeat/item.xml +0 -68
  316. package/tests/conformance/fixtures/responseProcessing_deleteValue_repeat/manifest.json +0 -17
  317. package/tests/conformance/fixtures/responseProcessing_equalRounded_tolerance/cases.json +0 -39
  318. package/tests/conformance/fixtures/responseProcessing_equalRounded_tolerance/item.xml +0 -39
  319. package/tests/conformance/fixtures/responseProcessing_equalRounded_tolerance/manifest.json +0 -17
  320. package/tests/conformance/fixtures/responseProcessing_exitResponse/cases.json +0 -12
  321. package/tests/conformance/fixtures/responseProcessing_exitResponse/item.xml +0 -25
  322. package/tests/conformance/fixtures/responseProcessing_exitResponse/manifest.json +0 -12
  323. package/tests/conformance/fixtures/responseProcessing_inside_duration_statsOperator/cases.json +0 -26
  324. package/tests/conformance/fixtures/responseProcessing_inside_duration_statsOperator/item.xml +0 -134
  325. package/tests/conformance/fixtures/responseProcessing_inside_duration_statsOperator/manifest.json +0 -16
  326. package/tests/conformance/fixtures/responseProcessing_lookupTable_interpolationTable/cases.json +0 -27
  327. package/tests/conformance/fixtures/responseProcessing_lookupTable_interpolationTable/item.xml +0 -33
  328. package/tests/conformance/fixtures/responseProcessing_lookupTable_interpolationTable/manifest.json +0 -13
  329. package/tests/conformance/fixtures/responseProcessing_lookupTable_matchTable/cases.json +0 -22
  330. package/tests/conformance/fixtures/responseProcessing_lookupTable_matchTable/item.xml +0 -33
  331. package/tests/conformance/fixtures/responseProcessing_lookupTable_matchTable/manifest.json +0 -13
  332. package/tests/conformance/fixtures/responseProcessing_mapOutcome_basic/cases.json +0 -27
  333. package/tests/conformance/fixtures/responseProcessing_mapOutcome_basic/item.xml +0 -40
  334. package/tests/conformance/fixtures/responseProcessing_mapOutcome_basic/manifest.json +0 -18
  335. package/tests/conformance/fixtures/responseProcessing_mapResponsePoint_basic/cases.json +0 -22
  336. package/tests/conformance/fixtures/responseProcessing_mapResponsePoint_basic/item.xml +0 -33
  337. package/tests/conformance/fixtures/responseProcessing_mapResponsePoint_basic/manifest.json +0 -12
  338. package/tests/conformance/fixtures/responseProcessing_mapResponse_directedPair_ordered/cases.json +0 -29
  339. package/tests/conformance/fixtures/responseProcessing_mapResponse_directedPair_ordered/item.xml +0 -26
  340. package/tests/conformance/fixtures/responseProcessing_mapResponse_directedPair_ordered/manifest.json +0 -7
  341. package/tests/conformance/fixtures/responseProcessing_mapResponse_directedPair_whitespace/cases.json +0 -23
  342. package/tests/conformance/fixtures/responseProcessing_mapResponse_directedPair_whitespace/item.xml +0 -28
  343. package/tests/conformance/fixtures/responseProcessing_mapResponse_directedPair_whitespace/manifest.json +0 -11
  344. package/tests/conformance/fixtures/responseProcessing_mapResponse_pair_unordered/cases.json +0 -29
  345. package/tests/conformance/fixtures/responseProcessing_mapResponse_pair_unordered/item.xml +0 -26
  346. package/tests/conformance/fixtures/responseProcessing_mapResponse_pair_unordered/manifest.json +0 -7
  347. package/tests/conformance/fixtures/responseProcessing_mathOperator_integerUtils/cases.json +0 -31
  348. package/tests/conformance/fixtures/responseProcessing_mathOperator_integerUtils/item.xml +0 -102
  349. package/tests/conformance/fixtures/responseProcessing_mathOperator_integerUtils/manifest.json +0 -18
  350. package/tests/conformance/fixtures/responseProcessing_math_max_min_round_truncate/cases.json +0 -22
  351. package/tests/conformance/fixtures/responseProcessing_math_max_min_round_truncate/item.xml +0 -45
  352. package/tests/conformance/fixtures/responseProcessing_math_max_min_round_truncate/manifest.json +0 -21
  353. package/tests/conformance/fixtures/responseProcessing_misc_math_string_stats/cases.json +0 -26
  354. package/tests/conformance/fixtures/responseProcessing_misc_math_string_stats/item.xml +0 -157
  355. package/tests/conformance/fixtures/responseProcessing_misc_math_string_stats/manifest.json +0 -22
  356. package/tests/conformance/fixtures/responseProcessing_notEqual_basic/cases.json +0 -22
  357. package/tests/conformance/fixtures/responseProcessing_notEqual_basic/item.xml +0 -39
  358. package/tests/conformance/fixtures/responseProcessing_notEqual_basic/manifest.json +0 -18
  359. package/tests/conformance/fixtures/responseProcessing_patternMatch_caseSensitive/cases.json +0 -22
  360. package/tests/conformance/fixtures/responseProcessing_patternMatch_caseSensitive/item.xml +0 -51
  361. package/tests/conformance/fixtures/responseProcessing_patternMatch_caseSensitive/manifest.json +0 -19
  362. package/tests/conformance/fixtures/responseProcessing_preCondition/cases.json +0 -31
  363. package/tests/conformance/fixtures/responseProcessing_preCondition/item.xml +0 -44
  364. package/tests/conformance/fixtures/responseProcessing_preCondition/manifest.json +0 -12
  365. package/tests/conformance/fixtures/responseProcessing_random_lookupOutcomeValue/cases.json +0 -27
  366. package/tests/conformance/fixtures/responseProcessing_random_lookupOutcomeValue/item.xml +0 -42
  367. package/tests/conformance/fixtures/responseProcessing_random_lookupOutcomeValue/manifest.json +0 -14
  368. package/tests/conformance/fixtures/responseProcessing_record_fieldValue/cases.json +0 -12
  369. package/tests/conformance/fixtures/responseProcessing_record_fieldValue/item.xml +0 -40
  370. package/tests/conformance/fixtures/responseProcessing_record_fieldValue/manifest.json +0 -17
  371. package/tests/conformance/fixtures/responseProcessing_responseCondition_toBoolean/cases.json +0 -17
  372. package/tests/conformance/fixtures/responseProcessing_responseCondition_toBoolean/item.xml +0 -63
  373. package/tests/conformance/fixtures/responseProcessing_responseCondition_toBoolean/manifest.json +0 -9
  374. package/tests/conformance/fixtures/responseProcessing_responseProcessingFragment/cases.json +0 -12
  375. package/tests/conformance/fixtures/responseProcessing_responseProcessingFragment/item.xml +0 -40
  376. package/tests/conformance/fixtures/responseProcessing_responseProcessingFragment/manifest.json +0 -13
  377. package/tests/conformance/fixtures/responseProcessing_setDefaultValue/cases.json +0 -15
  378. package/tests/conformance/fixtures/responseProcessing_setDefaultValue/item.xml +0 -67
  379. package/tests/conformance/fixtures/responseProcessing_setDefaultValue/manifest.json +0 -9
  380. package/tests/conformance/fixtures/responseProcessing_setResponseValue_setDefaultValue/cases.json +0 -27
  381. package/tests/conformance/fixtures/responseProcessing_setResponseValue_setDefaultValue/item.xml +0 -69
  382. package/tests/conformance/fixtures/responseProcessing_setResponseValue_setDefaultValue/manifest.json +0 -10
  383. package/tests/conformance/fixtures/responseProcessing_subtract_divide/cases.json +0 -15
  384. package/tests/conformance/fixtures/responseProcessing_subtract_divide/item.xml +0 -35
  385. package/tests/conformance/fixtures/responseProcessing_subtract_divide/manifest.json +0 -11
  386. package/tests/conformance/fixtures/responseProcessing_template_map_response/cases.json +0 -17
  387. package/tests/conformance/fixtures/responseProcessing_template_map_response/item.xml +0 -31
  388. package/tests/conformance/fixtures/responseProcessing_template_map_response/manifest.json +0 -8
  389. package/tests/conformance/fixtures/responseProcessing_template_map_response_point/cases.json +0 -22
  390. package/tests/conformance/fixtures/responseProcessing_template_map_response_point/item.xml +0 -27
  391. package/tests/conformance/fixtures/responseProcessing_template_map_response_point/manifest.json +0 -8
  392. package/tests/conformance/fixtures/responseProcessing_template_match_correct/cases.json +0 -17
  393. package/tests/conformance/fixtures/responseProcessing_template_match_correct/item.xml +0 -34
  394. package/tests/conformance/fixtures/responseProcessing_template_match_correct/manifest.json +0 -8
  395. package/tests/conformance/fixtures/responseProcessing_template_match_correct_directedPair/cases.json +0 -22
  396. package/tests/conformance/fixtures/responseProcessing_template_match_correct_directedPair/item.xml +0 -30
  397. package/tests/conformance/fixtures/responseProcessing_template_match_correct_directedPair/manifest.json +0 -7
  398. package/tests/conformance/fixtures/responseProcessing_template_match_correct_two_responses/cases.json +0 -17
  399. package/tests/conformance/fixtures/responseProcessing_template_match_correct_two_responses/item.xml +0 -30
  400. package/tests/conformance/fixtures/responseProcessing_template_match_correct_two_responses/manifest.json +0 -9
  401. package/tests/conformance/fixtures/responseProcessing_template_match_nothing/cases.json +0 -17
  402. package/tests/conformance/fixtures/responseProcessing_template_match_nothing/item.xml +0 -30
  403. package/tests/conformance/fixtures/responseProcessing_template_match_nothing/manifest.json +0 -8
  404. package/tests/conformance/fixtures/responseProcessing_xiInclude/cases.json +0 -14
  405. package/tests/conformance/fixtures/responseProcessing_xiInclude/item.xml +0 -25
  406. package/tests/conformance/fixtures/responseProcessing_xiInclude/manifest.json +0 -9
  407. package/tests/conformance/fixtures/stringMatch_caseSensitive_substring/cases.json +0 -12
  408. package/tests/conformance/fixtures/stringMatch_caseSensitive_substring/item.xml +0 -52
  409. package/tests/conformance/fixtures/stringMatch_caseSensitive_substring/manifest.json +0 -14
  410. package/tests/conformance/fixtures/templateProcessing_exitTemplate/cases.json +0 -12
  411. package/tests/conformance/fixtures/templateProcessing_exitTemplate/item.xml +0 -48
  412. package/tests/conformance/fixtures/templateProcessing_exitTemplate/manifest.json +0 -13
  413. package/tests/conformance/fixtures/templateProcessing_setCorrectResponse/cases.json +0 -27
  414. package/tests/conformance/fixtures/templateProcessing_setCorrectResponse/item.xml +0 -74
  415. package/tests/conformance/fixtures/templateProcessing_setCorrectResponse/manifest.json +0 -22
  416. package/tests/conformance/fixtures/templateProcessing_templateCondition_branching/cases.json +0 -17
  417. package/tests/conformance/fixtures/templateProcessing_templateCondition_branching/item.xml +0 -133
  418. package/tests/conformance/fixtures/templateProcessing_templateCondition_branching/manifest.json +0 -22
  419. package/tests/conformance/fixtures/templateProcessing_templateCondition_toBoolean/cases.json +0 -12
  420. package/tests/conformance/fixtures/templateProcessing_templateCondition_toBoolean/item.xml +0 -107
  421. package/tests/conformance/fixtures/templateProcessing_templateCondition_toBoolean/manifest.json +0 -16
  422. package/tests/conformance/fixtures/templateProcessing_templateConstraint/cases.json +0 -15
  423. package/tests/conformance/fixtures/templateProcessing_templateConstraint/item.xml +0 -52
  424. package/tests/conformance/fixtures/templateProcessing_templateConstraint/manifest.json +0 -14
  425. package/tests/conformance/fixtures/template_randomFloat_roundTo_mathConstant/cases.json +0 -16
  426. package/tests/conformance/fixtures/template_randomFloat_roundTo_mathConstant/item.xml +0 -49
  427. package/tests/conformance/fixtures/template_randomFloat_roundTo_mathConstant/manifest.json +0 -15
  428. package/tests/conformance/fixtures/template_randomInteger_printedVariable/cases.json +0 -16
  429. package/tests/conformance/fixtures/template_randomInteger_printedVariable/item.xml +0 -38
  430. package/tests/conformance/fixtures/template_randomInteger_printedVariable/manifest.json +0 -13
  431. package/tests/conformance/harness.ts +0 -84
  432. package/tests/conformance/run-fixtures.test.ts +0 -127
  433. package/tests/conformance/scripts/normalize-covers.ts +0 -152
  434. package/tests/conformance/types.ts +0 -53
  435. package/tests/core/Player.test.ts +0 -563
  436. package/tests/core/adaptiveItems.test.ts +0 -442
  437. package/tests/core/correctResponse.test.ts +0 -280
  438. package/tests/core/interaction-plumbing.test.ts +0 -141
  439. package/tests/core/modalFeedback.test.ts +0 -308
  440. package/tests/core/outcome-reset.test.ts +0 -43
  441. package/tests/extraction/extractors/associateExtractor.test.ts +0 -182
  442. package/tests/extraction/extractors/choiceExtractor.test.ts +0 -239
  443. package/tests/extraction/extractors/customExtractor.test.ts +0 -83
  444. package/tests/extraction/extractors/drawingExtractor.test.ts +0 -94
  445. package/tests/extraction/extractors/endAttemptExtractor.test.ts +0 -188
  446. package/tests/extraction/extractors/extendedTextExtractor.test.ts +0 -178
  447. package/tests/extraction/extractors/gapMatchExtractor.test.ts +0 -318
  448. package/tests/extraction/extractors/graphicAssociateExtractor.test.ts +0 -260
  449. package/tests/extraction/extractors/graphicGapMatchExtractor.test.ts +0 -320
  450. package/tests/extraction/extractors/graphicOrderExtractor.test.ts +0 -223
  451. package/tests/extraction/extractors/hotspotExtractor.test.ts +0 -298
  452. package/tests/extraction/extractors/hottextExtractor.test.ts +0 -240
  453. package/tests/extraction/extractors/inlineChoiceExtractor.test.ts +0 -292
  454. package/tests/extraction/extractors/matchExtractor.test.ts +0 -241
  455. package/tests/extraction/extractors/mediaExtractor.test.ts +0 -295
  456. package/tests/extraction/extractors/orderExtractor.test.ts +0 -212
  457. package/tests/extraction/extractors/positionObjectExtractor.test.ts +0 -363
  458. package/tests/extraction/extractors/selectPointExtractor.test.ts +0 -214
  459. package/tests/extraction/extractors/sliderExtractor.test.ts +0 -293
  460. package/tests/extraction/extractors/textEntryExtractor.test.ts +0 -133
  461. package/tests/extraction/extractors/uploadExtractor.test.ts +0 -119
  462. package/tests/extraction/test-utils.ts +0 -57
  463. package/tests/iframe/host.test.ts +0 -145
  464. package/tests/iframe/protocol.test.ts +0 -42
  465. package/tests/performance/player-benchmarks.bench.ts +0 -191
  466. package/tests/security/dos-limits.test.ts +0 -56
  467. package/tests/security/xss-prevention.test.ts +0 -522
  468. package/tsconfig.json +0 -20
  469. package/tsconfig.svelte.json +0 -14
@@ -1,240 +0,0 @@
1
- /**
2
- * Tests for standardHottextExtractor
3
- */
4
-
5
- import { describe, expect, test } from 'bun:test';
6
- import { standardHottextExtractor } from '../../../src/extraction/extractors/hottextExtractor.js';
7
- import { createTestContext, parseQTI } from '../test-utils.js';
8
-
9
- describe('standardHottextExtractor', () => {
10
- describe('Single Selection Hottext', () => {
11
- test('extracts hottextInteraction with single selection', () => {
12
- const xml = `
13
- <hottextInteraction responseIdentifier="RESPONSE" maxChoices="1">
14
- <prompt>Select the correct word:</prompt>
15
- <p>The <hottext identifier="H1">cat</hottext> sat on the <hottext identifier="H2">mat</hottext>.</p>
16
- </hottextInteraction>
17
- `;
18
-
19
- const element = parseQTI(xml);
20
- const context = createTestContext(element, 'RESPONSE');
21
-
22
- const result = standardHottextExtractor.extract(element, context);
23
-
24
- expect(result.prompt).toBe('Select the correct word:');
25
- expect(result.maxChoices).toBe(1);
26
- expect(result.hottextChoices).toHaveLength(2);
27
- expect(result.hottextChoices[0].identifier).toBe('H1');
28
- expect(result.hottextChoices[0].text).toBe('cat');
29
- expect(result.hottextChoices[1].identifier).toBe('H2');
30
- expect(result.hottextChoices[1].text).toBe('mat');
31
- });
32
- });
33
-
34
- describe('Multiple Selection Hottext', () => {
35
- test('extracts hottextInteraction with multiple selection', () => {
36
- const xml = `
37
- <hottextInteraction responseIdentifier="RESPONSE" maxChoices="3">
38
- <prompt>Select all nouns:</prompt>
39
- <p>
40
- The <hottext identifier="H1">quick</hottext>
41
- <hottext identifier="H2">fox</hottext>
42
- <hottext identifier="H3">jumps</hottext> over the
43
- <hottext identifier="H4">dog</hottext>.
44
- </p>
45
- </hottextInteraction>
46
- `;
47
-
48
- const element = parseQTI(xml);
49
- const context = createTestContext(element, 'RESPONSE');
50
-
51
- const result = standardHottextExtractor.extract(element, context);
52
-
53
- expect(result.maxChoices).toBe(3);
54
- expect(result.hottextChoices).toHaveLength(4);
55
- expect(result.hottextChoices[0].text).toBe('quick');
56
- expect(result.hottextChoices[1].text).toBe('fox');
57
- expect(result.hottextChoices[2].text).toBe('jumps');
58
- expect(result.hottextChoices[3].text).toBe('dog');
59
- });
60
- });
61
-
62
- describe('Complex Content', () => {
63
- test('handles hottextInteraction with multiple paragraphs', () => {
64
- const xml = `
65
- <hottextInteraction responseIdentifier="RESPONSE" maxChoices="2">
66
- <prompt>Select two statements that are facts:</prompt>
67
- <p><hottext identifier="H1">Water freezes at 0°C</hottext></p>
68
- <p><hottext identifier="H2">Summer is the best season</hottext></p>
69
- <p><hottext identifier="H3">The Earth orbits the Sun</hottext></p>
70
- </hottextInteraction>
71
- `;
72
-
73
- const element = parseQTI(xml);
74
- const context = createTestContext(element, 'RESPONSE');
75
-
76
- const result = standardHottextExtractor.extract(element, context);
77
-
78
- expect(result.hottextChoices).toHaveLength(3);
79
- expect(result.hottextChoices[0].text).toBe('Water freezes at 0°C');
80
- expect(result.hottextChoices[1].text).toBe('Summer is the best season');
81
- expect(result.hottextChoices[2].text).toBe('The Earth orbits the Sun');
82
- });
83
-
84
- test('preserves HTML content structure', () => {
85
- const xml = `
86
- <hottextInteraction responseIdentifier="RESPONSE" maxChoices="1">
87
- <p>Select the verb: The <hottext identifier="H1">dog</hottext> <hottext identifier="H2">barks</hottext> loudly.</p>
88
- </hottextInteraction>
89
- `;
90
-
91
- const element = parseQTI(xml);
92
- const context = createTestContext(element, 'RESPONSE');
93
-
94
- const result = standardHottextExtractor.extract(element, context);
95
-
96
- expect(result.contentHtml).toContain('<p>');
97
- expect(result.contentHtml).toContain('hottext');
98
- });
99
- });
100
-
101
- describe('Default Values', () => {
102
- test('uses default maxChoices when not specified', () => {
103
- const xml = `
104
- <hottextInteraction responseIdentifier="RESPONSE">
105
- <p>Select: <hottext identifier="H1">option1</hottext></p>
106
- </hottextInteraction>
107
- `;
108
-
109
- const element = parseQTI(xml);
110
- const context = createTestContext(element, 'RESPONSE');
111
-
112
- const result = standardHottextExtractor.extract(element, context);
113
-
114
- expect(result.maxChoices).toBe(1);
115
- expect(result.prompt).toBeNull();
116
- });
117
- });
118
-
119
- describe('Edge Cases', () => {
120
- test('handles empty hottext elements', () => {
121
- const xml = `
122
- <hottextInteraction responseIdentifier="RESPONSE" maxChoices="1">
123
- <p>Text with <hottext identifier="H1"></hottext> empty hottext.</p>
124
- </hottextInteraction>
125
- `;
126
-
127
- const element = parseQTI(xml);
128
- const context = createTestContext(element, 'RESPONSE');
129
-
130
- const result = standardHottextExtractor.extract(element, context);
131
-
132
- expect(result.hottextChoices).toHaveLength(1);
133
- expect(result.hottextChoices[0].text).toBe('');
134
- });
135
-
136
- test('handles no hottext elements', () => {
137
- const xml = `
138
- <hottextInteraction responseIdentifier="RESPONSE" maxChoices="1">
139
- <p>Text without any selectable elements.</p>
140
- </hottextInteraction>
141
- `;
142
-
143
- const element = parseQTI(xml);
144
- const context = createTestContext(element, 'RESPONSE');
145
-
146
- const result = standardHottextExtractor.extract(element, context);
147
-
148
- expect(result.hottextChoices).toHaveLength(0);
149
- });
150
- });
151
-
152
- describe('canHandle predicate', () => {
153
- test('handles hottextInteraction element', () => {
154
- const xml = `
155
- <hottextInteraction responseIdentifier="RESPONSE">
156
- <p><hottext identifier="H1">Text</hottext></p>
157
- </hottextInteraction>
158
- `;
159
- const element = parseQTI(xml);
160
- const context = createTestContext(element);
161
-
162
- expect(standardHottextExtractor.canHandle(element, context)).toBe(true);
163
- });
164
-
165
- test('rejects non-hottextInteraction elements', () => {
166
- const xml = `<choiceInteraction responseIdentifier="RESPONSE" />`;
167
- const element = parseQTI(xml);
168
- const context = createTestContext(element);
169
-
170
- expect(standardHottextExtractor.canHandle(element, context)).toBe(false);
171
- });
172
- });
173
-
174
- describe('validation', () => {
175
- test('validates correct hottext data', () => {
176
- const data = {
177
- hottextChoices: [
178
- { identifier: 'H1', text: 'Text 1' },
179
- { identifier: 'H2', text: 'Text 2' },
180
- ],
181
- contentHtml: '<p>Content</p>',
182
- maxChoices: 1,
183
- prompt: null,
184
- };
185
-
186
- const validation = standardHottextExtractor.validate!(data);
187
-
188
- expect(validation.valid).toBe(true);
189
- expect(validation.errors).toBeUndefined();
190
- });
191
-
192
- test('reports error for empty hottextChoices', () => {
193
- const data = {
194
- hottextChoices: [],
195
- contentHtml: '<p>Content</p>',
196
- maxChoices: 1,
197
- prompt: null,
198
- };
199
-
200
- const validation = standardHottextExtractor.validate!(data);
201
-
202
- expect(validation.valid).toBe(false);
203
- expect(validation.errors).toContain('hottextInteraction must have at least one hottext');
204
- });
205
-
206
- test('reports error for duplicate identifiers', () => {
207
- const data = {
208
- hottextChoices: [
209
- { identifier: 'H1', text: 'Text 1' },
210
- { identifier: 'H1', text: 'Text 2' },
211
- ],
212
- contentHtml: '<p>Content</p>',
213
- maxChoices: 1,
214
- prompt: null,
215
- };
216
-
217
- const validation = standardHottextExtractor.validate!(data);
218
-
219
- expect(validation.valid).toBe(false);
220
- expect(validation.errors).toContain('Duplicate hottext identifier: H1');
221
- });
222
-
223
- test('reports warning when maxChoices exceeds hottext count', () => {
224
- const data = {
225
- hottextChoices: [
226
- { identifier: 'H1', text: 'Text 1' },
227
- { identifier: 'H2', text: 'Text 2' },
228
- ],
229
- contentHtml: '<p>Content</p>',
230
- maxChoices: 5,
231
- prompt: null,
232
- };
233
-
234
- const validation = standardHottextExtractor.validate!(data);
235
-
236
- expect(validation.valid).toBe(true);
237
- expect(validation.warnings).toContain('maxChoices (5) exceeds the number of hottext choices (2)');
238
- });
239
- });
240
- });
@@ -1,292 +0,0 @@
1
- /**
2
- * Tests for standardInlineChoiceExtractor
3
- */
4
-
5
- import { describe, expect, test } from 'bun:test';
6
- import { standardInlineChoiceExtractor } from '../../../src/extraction/extractors/inlineChoiceExtractor.js';
7
- import { createTestContext, parseQTI } from '../test-utils.js';
8
-
9
- describe('standardInlineChoiceExtractor', () => {
10
- test('extracts basic inline choice interaction', () => {
11
- const xml = `
12
- <inlineChoiceInteraction responseIdentifier="RESPONSE" shuffle="false">
13
- <inlineChoice identifier="A">choice A</inlineChoice>
14
- <inlineChoice identifier="B">choice B</inlineChoice>
15
- <inlineChoice identifier="C">choice C</inlineChoice>
16
- </inlineChoiceInteraction>
17
- `;
18
- const element = parseQTI(xml);
19
- const context = createTestContext(element, 'RESPONSE');
20
-
21
- const result = standardInlineChoiceExtractor.extract(element, context);
22
-
23
- expect(result.shuffle).toBe(false);
24
- expect(result.choices).toHaveLength(3);
25
- });
26
-
27
- test('extracts choice identifiers and text correctly', () => {
28
- const xml = `
29
- <inlineChoiceInteraction responseIdentifier="RESPONSE" shuffle="false">
30
- <inlineChoice identifier="CORRECT">Paris</inlineChoice>
31
- <inlineChoice identifier="WRONG1">London</inlineChoice>
32
- <inlineChoice identifier="WRONG2">Berlin</inlineChoice>
33
- </inlineChoiceInteraction>
34
- `;
35
- const element = parseQTI(xml);
36
- const context = createTestContext(element, 'RESPONSE');
37
-
38
- const result = standardInlineChoiceExtractor.extract(element, context);
39
-
40
- expect(result.choices[0]).toEqual({ identifier: 'CORRECT', text: 'Paris' });
41
- expect(result.choices[1]).toEqual({ identifier: 'WRONG1', text: 'London' });
42
- expect(result.choices[2]).toEqual({ identifier: 'WRONG2', text: 'Berlin' });
43
- });
44
-
45
- test('handles interaction with shuffle enabled', () => {
46
- const xml = `
47
- <inlineChoiceInteraction responseIdentifier="RESPONSE" shuffle="true">
48
- <inlineChoice identifier="A">choice A</inlineChoice>
49
- <inlineChoice identifier="B">choice B</inlineChoice>
50
- </inlineChoiceInteraction>
51
- `;
52
- const element = parseQTI(xml);
53
- const context = createTestContext(element, 'RESPONSE');
54
-
55
- const result = standardInlineChoiceExtractor.extract(element, context);
56
-
57
- expect(result.shuffle).toBe(true);
58
- });
59
-
60
- test('handles interaction without shuffle attribute', () => {
61
- const xml = `
62
- <inlineChoiceInteraction responseIdentifier="RESPONSE">
63
- <inlineChoice identifier="A">choice A</inlineChoice>
64
- </inlineChoiceInteraction>
65
- `;
66
- const element = parseQTI(xml);
67
- const context = createTestContext(element, 'RESPONSE');
68
-
69
- const result = standardInlineChoiceExtractor.extract(element, context);
70
-
71
- expect(result.shuffle).toBe(false);
72
- });
73
-
74
- test('handles interaction with no choices', () => {
75
- const xml = `
76
- <inlineChoiceInteraction responseIdentifier="RESPONSE" shuffle="false">
77
- </inlineChoiceInteraction>
78
- `;
79
- const element = parseQTI(xml);
80
- const context = createTestContext(element, 'RESPONSE');
81
-
82
- const result = standardInlineChoiceExtractor.extract(element, context);
83
-
84
- expect(result.choices).toHaveLength(0);
85
- });
86
-
87
- test('handles choices with HTML content', () => {
88
- const xml = `
89
- <inlineChoiceInteraction responseIdentifier="RESPONSE" shuffle="false">
90
- <inlineChoice identifier="A">Choice with <strong>bold</strong> text</inlineChoice>
91
- <inlineChoice identifier="B">Choice with <em>italic</em> text</inlineChoice>
92
- </inlineChoiceInteraction>
93
- `;
94
- const element = parseQTI(xml);
95
- const context = createTestContext(element, 'RESPONSE');
96
-
97
- const result = standardInlineChoiceExtractor.extract(element, context);
98
-
99
- expect(result.choices[0].text).toContain('bold');
100
- expect(result.choices[1].text).toContain('italic');
101
- });
102
-
103
- test('handles choices with whitespace', () => {
104
- const xml = `
105
- <inlineChoiceInteraction responseIdentifier="RESPONSE" shuffle="false">
106
- <inlineChoice identifier="A"> text with spaces </inlineChoice>
107
- <inlineChoice identifier="B">
108
- text with newlines
109
- </inlineChoice>
110
- </inlineChoiceInteraction>
111
- `;
112
- const element = parseQTI(xml);
113
- const context = createTestContext(element, 'RESPONSE');
114
-
115
- const result = standardInlineChoiceExtractor.extract(element, context);
116
-
117
- expect(result.choices[0].text).toBeTruthy();
118
- expect(result.choices[1].text).toBeTruthy();
119
- });
120
-
121
- test('handles single choice', () => {
122
- const xml = `
123
- <inlineChoiceInteraction responseIdentifier="RESPONSE" shuffle="false">
124
- <inlineChoice identifier="ONLY">only option</inlineChoice>
125
- </inlineChoiceInteraction>
126
- `;
127
- const element = parseQTI(xml);
128
- const context = createTestContext(element, 'RESPONSE');
129
-
130
- const result = standardInlineChoiceExtractor.extract(element, context);
131
-
132
- expect(result.choices).toHaveLength(1);
133
- expect(result.choices[0]).toEqual({ identifier: 'ONLY', text: 'only option' });
134
- });
135
-
136
- test('handles many choices', () => {
137
- const xml = `
138
- <inlineChoiceInteraction responseIdentifier="RESPONSE" shuffle="true">
139
- <inlineChoice identifier="A">A</inlineChoice>
140
- <inlineChoice identifier="B">B</inlineChoice>
141
- <inlineChoice identifier="C">C</inlineChoice>
142
- <inlineChoice identifier="D">D</inlineChoice>
143
- <inlineChoice identifier="E">E</inlineChoice>
144
- <inlineChoice identifier="F">F</inlineChoice>
145
- </inlineChoiceInteraction>
146
- `;
147
- const element = parseQTI(xml);
148
- const context = createTestContext(element, 'RESPONSE');
149
-
150
- const result = standardInlineChoiceExtractor.extract(element, context);
151
-
152
- expect(result.choices).toHaveLength(6);
153
- expect(result.choices[0].identifier).toBe('A');
154
- expect(result.choices[5].identifier).toBe('F');
155
- });
156
-
157
- test('handles choices with numeric text', () => {
158
- const xml = `
159
- <inlineChoiceInteraction responseIdentifier="RESPONSE" shuffle="false">
160
- <inlineChoice identifier="N1">100</inlineChoice>
161
- <inlineChoice identifier="N2">200</inlineChoice>
162
- <inlineChoice identifier="N3">300</inlineChoice>
163
- </inlineChoiceInteraction>
164
- `;
165
- const element = parseQTI(xml);
166
- const context = createTestContext(element, 'RESPONSE');
167
-
168
- const result = standardInlineChoiceExtractor.extract(element, context);
169
-
170
- expect(result.choices[0].text).toBe('100');
171
- expect(result.choices[1].text).toBe('200');
172
- expect(result.choices[2].text).toBe('300');
173
- });
174
-
175
- test('handles choices with special characters', () => {
176
- const xml = `
177
- <inlineChoiceInteraction responseIdentifier="RESPONSE" shuffle="false">
178
- <inlineChoice identifier="A">&lt;tag&gt;</inlineChoice>
179
- <inlineChoice identifier="B">x &amp; y</inlineChoice>
180
- <inlineChoice identifier="C">"quoted"</inlineChoice>
181
- </inlineChoiceInteraction>
182
- `;
183
- const element = parseQTI(xml);
184
- const context = createTestContext(element, 'RESPONSE');
185
-
186
- const result = standardInlineChoiceExtractor.extract(element, context);
187
-
188
- expect(result.choices).toHaveLength(3);
189
- expect(result.choices[0].text).toBeTruthy();
190
- expect(result.choices[1].text).toBeTruthy();
191
- expect(result.choices[2].text).toBeTruthy();
192
- });
193
-
194
- describe('canHandle predicate', () => {
195
- test('handles inlineChoiceInteraction element', () => {
196
- const xml = `
197
- <inlineChoiceInteraction responseIdentifier="RESPONSE">
198
- <inlineChoice identifier="A">Choice A</inlineChoice>
199
- </inlineChoiceInteraction>
200
- `;
201
- const element = parseQTI(xml);
202
- const context = createTestContext(element);
203
-
204
- expect(standardInlineChoiceExtractor.canHandle(element, context)).toBe(true);
205
- });
206
-
207
- test('rejects non-inlineChoiceInteraction elements', () => {
208
- const xml = `<choiceInteraction responseIdentifier="RESPONSE" />`;
209
- const element = parseQTI(xml);
210
- const context = createTestContext(element);
211
-
212
- expect(standardInlineChoiceExtractor.canHandle(element, context)).toBe(false);
213
- });
214
- });
215
-
216
- describe('validation', () => {
217
- test('validates correct inlineChoice data', () => {
218
- const data = {
219
- choices: [
220
- { identifier: 'A', text: 'Choice A' },
221
- { identifier: 'B', text: 'Choice B' },
222
- ],
223
- shuffle: false,
224
- };
225
-
226
- const validation = standardInlineChoiceExtractor.validate!(data);
227
-
228
- expect(validation.valid).toBe(true);
229
- expect(validation.errors).toBeUndefined();
230
- });
231
-
232
- test('reports error for empty choices', () => {
233
- const data = {
234
- choices: [],
235
- shuffle: false,
236
- };
237
-
238
- const validation = standardInlineChoiceExtractor.validate!(data);
239
-
240
- expect(validation.valid).toBe(false);
241
- expect(validation.errors).toContain('inlineChoiceInteraction must have at least one choice');
242
- });
243
-
244
- test('reports error for missing identifiers', () => {
245
- const data = {
246
- choices: [
247
- { identifier: 'A', text: 'Choice A' },
248
- { identifier: '', text: 'Choice B' },
249
- ],
250
- shuffle: false,
251
- };
252
-
253
- const validation = standardInlineChoiceExtractor.validate!(data);
254
-
255
- expect(validation.valid).toBe(false);
256
- expect(validation.errors).toContain('All choices must have an identifier');
257
- });
258
-
259
- test('reports error for duplicate identifiers', () => {
260
- const data = {
261
- choices: [
262
- { identifier: 'A', text: 'Choice A' },
263
- { identifier: 'A', text: 'Choice B' },
264
- ],
265
- shuffle: false,
266
- };
267
-
268
- const validation = standardInlineChoiceExtractor.validate!(data);
269
-
270
- expect(validation.valid).toBe(false);
271
- expect(validation.errors).toContain('Duplicate choice identifier: A');
272
- });
273
-
274
- test('reports warning for too many choices', () => {
275
- const choices = [];
276
- for (let i = 1; i <= 20; i++) {
277
- choices.push({ identifier: `C${i}`, text: `Choice ${i}` });
278
- }
279
- const data = {
280
- choices,
281
- shuffle: false,
282
- };
283
-
284
- const validation = standardInlineChoiceExtractor.validate!(data);
285
-
286
- expect(validation.valid).toBe(true);
287
- expect(validation.warnings).toContain(
288
- 'inlineChoiceInteraction has 20 choices - consider limiting for better usability'
289
- );
290
- });
291
- });
292
- });