kokopu-react 3.3.0 → 3.3.1

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 (337) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/lib/chessboard/Chessboard.js +3 -2
  3. package/dist/lib/chessboard/Chessboard.js.map +1 -1
  4. package/dist/lib/chessboard/ChessboardImpl.js +1 -1
  5. package/dist/lib/chessboard/ChessboardImpl.js.map +1 -1
  6. package/dist/lib/chessboard/Motion.js +1 -1
  7. package/dist/lib/chessboard/Motion.js.map +1 -1
  8. package/dist/lib/i18n.js +2 -2
  9. package/dist/lib/i18n.js.map +1 -1
  10. package/dist/lib/icons/ArrowMarkerIcon.js.map +1 -1
  11. package/dist/lib/icons/ChessPieceIcon.d.ts +1 -4
  12. package/dist/lib/icons/ChessPieceIcon.js +1 -5
  13. package/dist/lib/icons/ChessPieceIcon.js.map +1 -1
  14. package/dist/lib/icons/SquareMarkerIcon.d.ts +1 -4
  15. package/dist/lib/icons/SquareMarkerIcon.js +1 -5
  16. package/dist/lib/icons/SquareMarkerIcon.js.map +1 -1
  17. package/dist/lib/icons/TextMarkerIcon.d.ts +1 -4
  18. package/dist/lib/icons/TextMarkerIcon.js +1 -5
  19. package/dist/lib/icons/TextMarkerIcon.js.map +1 -1
  20. package/dist/lib/movetext/Movetext.js.map +1 -1
  21. package/dist/lib/movetext/MovetextImpl.js +4 -3
  22. package/dist/lib/movetext/MovetextImpl.js.map +1 -1
  23. package/dist/lib/movetext/htmlFilter.js +1 -1
  24. package/dist/lib/movetext/htmlFilter.js.map +1 -1
  25. package/dist/lib/navigationboard/NavigationBoard.d.ts +1 -1
  26. package/dist/lib/navigationboard/NavigationBoard.js +2 -2
  27. package/dist/lib/navigationboard/NavigationBoard.js.map +1 -1
  28. package/dist/lib/navigationboard/NavigationField.js +1 -1
  29. package/dist/lib/navigationboard/NavigationField.js.map +1 -1
  30. package/dist/lib/navigationboard/NavigationToolbar.js.map +1 -1
  31. package/dist/lib/util.js +2 -2
  32. package/dist/lib/util.js.map +1 -1
  33. package/doc_src/demo/PageChessboardBase.tsx +57 -51
  34. package/doc_src/demo/PageChessboardInteraction.tsx +78 -63
  35. package/doc_src/demo/PageChessboardMove.tsx +35 -30
  36. package/doc_src/demo/PageChessboardSmallScreens.tsx +3 -3
  37. package/doc_src/demo/PageMovetextBase.tsx +91 -81
  38. package/doc_src/demo/PageMovetextInteraction.tsx +23 -21
  39. package/doc_src/demo/PageNavigationBoardBase.tsx +62 -54
  40. package/doc_src/demo/PageNavigationBoardUncontrolledVsControlled.tsx +24 -18
  41. package/doc_src/theming/LogoRenderer.js +8 -9
  42. package/package.json +30 -28
  43. package/scripts/docker-compose.yml +1 -3
  44. package/src/chessboard/BoardProperties.ts +13 -13
  45. package/src/chessboard/Chessboard.tsx +43 -39
  46. package/src/chessboard/ChessboardImpl.tsx +58 -41
  47. package/src/chessboard/Draggable.tsx +15 -15
  48. package/src/chessboard/Motion.tsx +4 -4
  49. package/src/errorbox/ErrorBox.tsx +5 -5
  50. package/src/errorbox/parsing.tsx +6 -6
  51. package/src/i18n.ts +2 -2
  52. package/src/icons/AnnotationSymbolShape.tsx +5 -5
  53. package/src/icons/ArrowMarkerIcon.tsx +8 -4
  54. package/src/icons/ArrowTip.tsx +2 -2
  55. package/src/icons/ChessPieceIcon.tsx +4 -11
  56. package/src/icons/SquareMarkerIcon.tsx +3 -10
  57. package/src/icons/TextMarkerIcon.tsx +4 -11
  58. package/src/movetext/Movetext.tsx +11 -10
  59. package/src/movetext/MovetextImpl.tsx +34 -28
  60. package/src/movetext/htmlFilter.tsx +4 -4
  61. package/src/navigationboard/NavigationBoard.tsx +55 -50
  62. package/src/navigationboard/NavigationButton.ts +4 -4
  63. package/src/navigationboard/NavigationField.tsx +6 -6
  64. package/src/navigationboard/NavigationToolbar.tsx +17 -13
  65. package/src/types.ts +26 -26
  66. package/src/util.ts +2 -2
  67. package/test/01_types.js +83 -61
  68. package/test/02_chessboard_util.js +2 -0
  69. package/test/03_error_box_graphic.js +1 -1
  70. package/test/07_chessboard_interaction.js +1 -2
  71. package/test/13_navigation_board_graphic.js +3 -3
  72. package/test/common/graphic.js +11 -11
  73. package/test/graphic_references/03_error_box_graphic/base/cut_beginning_of_text.png +0 -0
  74. package/test/graphic_references/03_error_box_graphic/base/cut_end_of_text.png +0 -0
  75. package/test/graphic_references/03_error_box_graphic/base/cut_on_line_breaks.png +0 -0
  76. package/test/graphic_references/03_error_box_graphic/base/error_index_not_integer.png +0 -0
  77. package/test/graphic_references/03_error_box_graphic/base/full.png +0 -0
  78. package/test/graphic_references/03_error_box_graphic/base/minimal.png +0 -0
  79. package/test/graphic_references/03_error_box_graphic/base/missing_error_index.png +0 -0
  80. package/test/graphic_references/03_error_box_graphic/base/missing_error_text.png +0 -0
  81. package/test/graphic_references/03_error_box_graphic/base/negative_error_index.png +0 -0
  82. package/test/graphic_references/03_error_box_graphic/base/single_character_text.png +0 -0
  83. package/test/graphic_references/03_error_box_graphic/base/too_large_error_index.png +0 -0
  84. package/test/graphic_references/03_error_box_graphic/localization/default.png +0 -0
  85. package/test/graphic_references/04_icons_graphic/chess_piece/customized_pieceset.png +0 -0
  86. package/test/graphic_references/04_icons_graphic/chess_piece/invalid_multiple_pieces.png +0 -0
  87. package/test/graphic_references/04_icons_graphic/chess_piece/invalid_pieceset.png +0 -0
  88. package/test/graphic_references/04_icons_graphic/chess_piece/invalid_single_piece.png +0 -0
  89. package/test/graphic_references/04_icons_graphic/chess_piece/invalid_size.png +0 -0
  90. package/test/graphic_references/04_icons_graphic/chess_piece/multiple_pieces.png +0 -0
  91. package/test/graphic_references/04_icons_graphic/chess_piece/single_piece.png +0 -0
  92. package/test/graphic_references/04_icons_graphic/marker/colorized_arrow.png +0 -0
  93. package/test/graphic_references/04_icons_graphic/marker/colorized_square.png +0 -0
  94. package/test/graphic_references/04_icons_graphic/marker/colorized_symbol.png +0 -0
  95. package/test/graphic_references/04_icons_graphic/marker/colorized_text.png +0 -0
  96. package/test/graphic_references/04_icons_graphic/marker/default_arrow.png +0 -0
  97. package/test/graphic_references/04_icons_graphic/marker/default_square.png +0 -0
  98. package/test/graphic_references/04_icons_graphic/marker/default_text.png +0 -0
  99. package/test/graphic_references/04_icons_graphic/marker/invalid_arrow_size.png +0 -0
  100. package/test/graphic_references/04_icons_graphic/marker/invalid_square_size.png +0 -0
  101. package/test/graphic_references/04_icons_graphic/marker/invalid_symbol.png +0 -0
  102. package/test/graphic_references/04_icons_graphic/marker/invalid_text_size.png +0 -0
  103. package/test/graphic_references/04_icons_graphic/marker/wrapped_arrow.png +0 -0
  104. package/test/graphic_references/04_icons_graphic/marker/wrapped_square.png +0 -0
  105. package/test/graphic_references/04_icons_graphic/marker/wrapped_symbol.png +0 -0
  106. package/test/graphic_references/04_icons_graphic/marker/wrapped_text.png +0 -0
  107. package/test/graphic_references/05_chessboard_graphic/annotations/overlap.png +0 -0
  108. package/test/graphic_references/05_chessboard_graphic/annotations/overlap_and_flip.png +0 -0
  109. package/test/graphic_references/05_chessboard_graphic/annotations/with_coordinates.png +0 -0
  110. package/test/graphic_references/05_chessboard_graphic/annotations/with_coordinates_and_flip.png +0 -0
  111. package/test/graphic_references/05_chessboard_graphic/annotations/without_coordinates.png +0 -0
  112. package/test/graphic_references/05_chessboard_graphic/annotations/without_coordinates_and_flip.png +0 -0
  113. package/test/graphic_references/05_chessboard_graphic/base/default.png +0 -0
  114. package/test/graphic_references/05_chessboard_graphic/base/empty.png +0 -0
  115. package/test/graphic_references/05_chessboard_graphic/base/from_fen.png +0 -0
  116. package/test/graphic_references/05_chessboard_graphic/base/from_kokopu_object.png +0 -0
  117. package/test/graphic_references/05_chessboard_graphic/base/parsing_error.png +0 -0
  118. package/test/graphic_references/05_chessboard_graphic/base/wrong_position_type.png +0 -0
  119. package/test/graphic_references/05_chessboard_graphic/chess_variants/chess960.png +0 -0
  120. package/test/graphic_references/05_chessboard_graphic/chess_variants/chess960_with_move.png +0 -0
  121. package/test/graphic_references/05_chessboard_graphic/chess_variants/invalid_variant.png +0 -0
  122. package/test/graphic_references/05_chessboard_graphic/chess_variants/invalid_variant_with_fen.png +0 -0
  123. package/test/graphic_references/05_chessboard_graphic/chess_variants/special_code.png +0 -0
  124. package/test/graphic_references/05_chessboard_graphic/chess_variants/variant_with_std_initial_position.png +0 -0
  125. package/test/graphic_references/05_chessboard_graphic/chess_variants/variant_without_std_initial_position.png +0 -0
  126. package/test/graphic_references/05_chessboard_graphic/flipped/default.png +0 -0
  127. package/test/graphic_references/05_chessboard_graphic/flipped/empty.png +0 -0
  128. package/test/graphic_references/05_chessboard_graphic/flipped/from_fen.png +0 -0
  129. package/test/graphic_references/05_chessboard_graphic/flipped/from_kokopu_object.png +0 -0
  130. package/test/graphic_references/05_chessboard_graphic/flipped/parsing_error.png +0 -0
  131. package/test/graphic_references/05_chessboard_graphic/move/capture.png +0 -0
  132. package/test/graphic_references/05_chessboard_graphic/move/castling_move.png +0 -0
  133. package/test/graphic_references/05_chessboard_graphic/move/default.png +0 -0
  134. package/test/graphic_references/05_chessboard_graphic/move/en-passant.png +0 -0
  135. package/test/graphic_references/05_chessboard_graphic/move/illegal_null-move.png +0 -0
  136. package/test/graphic_references/05_chessboard_graphic/move/no_move_arrow.png +0 -0
  137. package/test/graphic_references/05_chessboard_graphic/move/null-move.png +0 -0
  138. package/test/graphic_references/05_chessboard_graphic/move/parsing_error.png +0 -0
  139. package/test/graphic_references/05_chessboard_graphic/move/promotion.png +0 -0
  140. package/test/graphic_references/05_chessboard_graphic/move/with_forced_move_arrow_and_flip.png +0 -0
  141. package/test/graphic_references/05_chessboard_graphic/move/wrong_move_arrow_color_type.png +0 -0
  142. package/test/graphic_references/05_chessboard_graphic/move/wrong_move_type.png +0 -0
  143. package/test/graphic_references/05_chessboard_graphic/theme/custom_1.png +0 -0
  144. package/test/graphic_references/05_chessboard_graphic/theme/custom_2.png +0 -0
  145. package/test/graphic_references/05_chessboard_graphic/theme/custom_3.png +0 -0
  146. package/test/graphic_references/05_chessboard_graphic/theme/custom_4.png +0 -0
  147. package/test/graphic_references/05_chessboard_graphic/theme/custom_5.png +0 -0
  148. package/test/graphic_references/05_chessboard_graphic/theme/custom_6.png +0 -0
  149. package/test/graphic_references/05_chessboard_graphic/theme/default.png +0 -0
  150. package/test/graphic_references/05_chessboard_graphic/theme/large.png +0 -0
  151. package/test/graphic_references/05_chessboard_graphic/theme/small.png +0 -0
  152. package/test/graphic_references/05_chessboard_graphic/theme/wrong_colorset.png +0 -0
  153. package/test/graphic_references/05_chessboard_graphic/theme/wrong_pieceset.png +0 -0
  154. package/test/graphic_references/05_chessboard_graphic/theme/wrong_square_size_type.png +0 -0
  155. package/test/graphic_references/06_chessboard_animation/base_1/capture.png +0 -0
  156. package/test/graphic_references/06_chessboard_animation/base_1/castling_move.png +0 -0
  157. package/test/graphic_references/06_chessboard_animation/base_1/en-passant.png +0 -0
  158. package/test/graphic_references/06_chessboard_animation/base_1/move_1.png +0 -0
  159. package/test/graphic_references/06_chessboard_animation/base_1/move_2.png +0 -0
  160. package/test/graphic_references/06_chessboard_animation/base_1/promotion.png +0 -0
  161. package/test/graphic_references/06_chessboard_animation/base_2/capture.png +0 -0
  162. package/test/graphic_references/06_chessboard_animation/base_2/castling_move.png +0 -0
  163. package/test/graphic_references/06_chessboard_animation/base_2/en-passant.png +0 -0
  164. package/test/graphic_references/06_chessboard_animation/base_2/move_1.png +0 -0
  165. package/test/graphic_references/06_chessboard_animation/base_2/move_2.png +0 -0
  166. package/test/graphic_references/06_chessboard_animation/base_2/promotion.png +0 -0
  167. package/test/graphic_references/06_chessboard_animation/base_3/capture.png +0 -0
  168. package/test/graphic_references/06_chessboard_animation/base_3/castling_move.png +0 -0
  169. package/test/graphic_references/06_chessboard_animation/base_3/en-passant.png +0 -0
  170. package/test/graphic_references/06_chessboard_animation/base_3/move_1.png +0 -0
  171. package/test/graphic_references/06_chessboard_animation/base_3/move_2.png +0 -0
  172. package/test/graphic_references/06_chessboard_animation/base_3/promotion.png +0 -0
  173. package/test/graphic_references/06_chessboard_animation/on_redraw/final_state.png +0 -0
  174. package/test/graphic_references/06_chessboard_animation/on_redraw/initial_state.png +0 -0
  175. package/test/graphic_references/07_chessboard_interaction/edit_arrows/base_1.png +0 -0
  176. package/test/graphic_references/07_chessboard_interaction/edit_arrows/base_2.png +0 -0
  177. package/test/graphic_references/07_chessboard_interaction/edit_arrows/from_==_to.png +0 -0
  178. package/test/graphic_references/07_chessboard_interaction/edit_arrows/out_of_board.png +0 -0
  179. package/test/graphic_references/07_chessboard_interaction/edit_arrows/over_arrow_marker.png +0 -0
  180. package/test/graphic_references/07_chessboard_interaction/edit_arrows/over_square_marker.png +0 -0
  181. package/test/graphic_references/07_chessboard_interaction/error/edit_color_not_set.png +0 -0
  182. package/test/graphic_references/07_chessboard_interaction/error/wrong_interaction_mode.png +0 -0
  183. package/test/graphic_references/07_chessboard_interaction/move_pieces/after_move.png +0 -0
  184. package/test/graphic_references/07_chessboard_interaction/move_pieces/from_==_to.png +0 -0
  185. package/test/graphic_references/07_chessboard_interaction/move_pieces/move_empty_square.png +0 -0
  186. package/test/graphic_references/07_chessboard_interaction/move_pieces/out_of_board.png +0 -0
  187. package/test/graphic_references/07_chessboard_interaction/move_pieces/over_arrow_marker.png +0 -0
  188. package/test/graphic_references/07_chessboard_interaction/move_pieces/over_empty.png +0 -0
  189. package/test/graphic_references/07_chessboard_interaction/move_pieces/over_non-empty_1.png +0 -0
  190. package/test/graphic_references/07_chessboard_interaction/move_pieces/over_non-empty_2.png +0 -0
  191. package/test/graphic_references/07_chessboard_interaction/move_pieces/over_square_marker.png +0 -0
  192. package/test/graphic_references/07_chessboard_interaction/move_pieces/over_text_marker.png +0 -0
  193. package/test/graphic_references/08_chessboard_play_moves/base/castling_move.png +0 -0
  194. package/test/graphic_references/08_chessboard_play_moves/base/chess960_ambiguous_king_move.png +0 -0
  195. package/test/graphic_references/08_chessboard_play_moves/base/chess960_castling_move_1.png +0 -0
  196. package/test/graphic_references/08_chessboard_play_moves/base/chess960_castling_move_2.png +0 -0
  197. package/test/graphic_references/08_chessboard_play_moves/base/chess960_non-kxr_castling.png +0 -0
  198. package/test/graphic_references/08_chessboard_play_moves/base/from_==_to.png +0 -0
  199. package/test/graphic_references/08_chessboard_play_moves/base/illegal_move.png +0 -0
  200. package/test/graphic_references/08_chessboard_play_moves/base/illegal_position.png +0 -0
  201. package/test/graphic_references/08_chessboard_play_moves/base/out_of_board.png +0 -0
  202. package/test/graphic_references/08_chessboard_play_moves/base/regular_move_1.png +0 -0
  203. package/test/graphic_references/08_chessboard_play_moves/base/regular_move_2.png +0 -0
  204. package/test/graphic_references/08_chessboard_play_moves/base/wrong_color_moved.png +0 -0
  205. package/test/graphic_references/08_chessboard_play_moves/promotions/antichess_promotion.png +0 -0
  206. package/test/graphic_references/08_chessboard_play_moves/promotions/cancel_promotion.png +0 -0
  207. package/test/graphic_references/08_chessboard_play_moves/promotions/regular_promotion_1.png +0 -0
  208. package/test/graphic_references/08_chessboard_play_moves/promotions/regular_promotion_2.png +0 -0
  209. package/test/graphic_references/09_chessboard_small_screens/base/default.png +0 -0
  210. package/test/graphic_references/09_chessboard_small_screens/base/invalid_limits.png +0 -0
  211. package/test/graphic_references/09_chessboard_small_screens/base/width_690.png +0 -0
  212. package/test/graphic_references/09_chessboard_small_screens/base/width_700.png +0 -0
  213. package/test/graphic_references/09_chessboard_small_screens/base/width_710.png +0 -0
  214. package/test/graphic_references/09_chessboard_small_screens/base/width_720.png +0 -0
  215. package/test/graphic_references/09_chessboard_small_screens/base/width_730.png +0 -0
  216. package/test/graphic_references/09_chessboard_small_screens/base/width_740.png +0 -0
  217. package/test/graphic_references/09_chessboard_small_screens/base/width_750.png +0 -0
  218. package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/default_bottom_component.png +0 -0
  219. package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/default_top_component.png +0 -0
  220. package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/reduced_bottom_component.png +0 -0
  221. package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/reduced_top_component.png +0 -0
  222. package/test/graphic_references/10_movetext_graphic/base/game_1.png +0 -0
  223. package/test/graphic_references/10_movetext_graphic/base/game_2.png +0 -0
  224. package/test/graphic_references/10_movetext_graphic/base/game_3.png +0 -0
  225. package/test/graphic_references/10_movetext_graphic/base/game_4.png +0 -0
  226. package/test/graphic_references/10_movetext_graphic/error/pgn_parsing_error_1.png +0 -0
  227. package/test/graphic_references/10_movetext_graphic/error/pgn_parsing_error_2.png +0 -0
  228. package/test/graphic_references/10_movetext_graphic/error/wrong_game_index_1.png +0 -0
  229. package/test/graphic_references/10_movetext_graphic/error/wrong_game_index_2.png +0 -0
  230. package/test/graphic_references/10_movetext_graphic/error/wrong_game_index_type.png +0 -0
  231. package/test/graphic_references/10_movetext_graphic/error/wrong_game_type.png +0 -0
  232. package/test/graphic_references/10_movetext_graphic/format_move/format_text.png +0 -0
  233. package/test/graphic_references/10_movetext_graphic/html/filtered_tags_and_attributes.png +0 -0
  234. package/test/graphic_references/10_movetext_graphic/html/html_in_comments.png +0 -0
  235. package/test/graphic_references/10_movetext_graphic/html/html_in_headers.png +0 -0
  236. package/test/graphic_references/10_movetext_graphic/options/custom_piece_symbols.png +0 -0
  237. package/test/graphic_references/10_movetext_graphic/options/figurine_piece_symbols_and_diagram_options.png +0 -0
  238. package/test/graphic_references/10_movetext_graphic/options/hidden_diagrams.png +0 -0
  239. package/test/graphic_references/10_movetext_graphic/options/localized_piece_symbols.png +0 -0
  240. package/test/graphic_references/10_movetext_graphic/options/other_diagram_options.png +0 -0
  241. package/test/graphic_references/10_movetext_graphic/options/wrong_diagram_options_1.png +0 -0
  242. package/test/graphic_references/10_movetext_graphic/options/wrong_diagram_options_2.png +0 -0
  243. package/test/graphic_references/10_movetext_graphic/options/wrong_piece_symbol_value.png +0 -0
  244. package/test/graphic_references/11_movetext_interaction/error/wrong_interaction_mode.png +0 -0
  245. package/test/graphic_references/11_movetext_interaction/select_moves/click_on_disabled.png +0 -0
  246. package/test/graphic_references/11_movetext_interaction/select_moves/click_on_unselected.png +0 -0
  247. package/test/graphic_references/11_movetext_interaction/select_moves/click_on_unselected_without_callback.png +0 -0
  248. package/test/graphic_references/11_movetext_interaction/select_moves/click_on_with_variations.png +0 -0
  249. package/test/graphic_references/12_navigation_board_base/controlled/default.png +0 -0
  250. package/test/graphic_references/12_navigation_board_base/controlled/forbidden_navigation_0.png +0 -0
  251. package/test/graphic_references/12_navigation_board_base/controlled/forbidden_navigation_1.png +0 -0
  252. package/test/graphic_references/12_navigation_board_base/controlled/invalid_node_id.png +0 -0
  253. package/test/graphic_references/12_navigation_board_base/controlled/no_callback_defined_0.png +0 -0
  254. package/test/graphic_references/12_navigation_board_base/controlled/no_callback_defined_1.png +0 -0
  255. package/test/graphic_references/12_navigation_board_base/controlled/overriding_initial_node_id.png +0 -0
  256. package/test/graphic_references/12_navigation_board_base/controlled/regular_navigation_0.png +0 -0
  257. package/test/graphic_references/12_navigation_board_base/controlled/regular_navigation_1.png +0 -0
  258. package/test/graphic_references/12_navigation_board_base/controlled/regular_navigation_2.png +0 -0
  259. package/test/graphic_references/12_navigation_board_base/controlled/regular_navigation_3.png +0 -0
  260. package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_beginning_0.png +0 -0
  261. package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_beginning_1.png +0 -0
  262. package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_beginning_2.png +0 -0
  263. package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_end_0.png +0 -0
  264. package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_end_1.png +0 -0
  265. package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_end_2.png +0 -0
  266. package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_at_end.png +0 -0
  267. package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_at_specific_id.png +0 -0
  268. package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_default.png +0 -0
  269. package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_default_with_game_index.png +0 -0
  270. package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_on_null-move.png +0 -0
  271. package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_0.png +0 -0
  272. package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_1.png +0 -0
  273. package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_2.png +0 -0
  274. package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_3.png +0 -0
  275. package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_4.png +0 -0
  276. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_flipping_0.png +0 -0
  277. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_flipping_1.png +0 -0
  278. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_0.png +0 -0
  279. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_1.png +0 -0
  280. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_2.png +0 -0
  281. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_3.png +0 -0
  282. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_4.png +0 -0
  283. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_5.png +0 -0
  284. package/test/graphic_references/13_navigation_board_graphic/additional_buttons/error_1.png +0 -0
  285. package/test/graphic_references/13_navigation_board_graphic/additional_buttons/error_2.png +0 -0
  286. package/test/graphic_references/13_navigation_board_graphic/additional_buttons/multiple_buttons.png +0 -0
  287. package/test/graphic_references/13_navigation_board_graphic/additional_buttons/single_button.png +0 -0
  288. package/test/graphic_references/13_navigation_board_graphic/error/pgn_parsing_error.png +0 -0
  289. package/test/graphic_references/13_navigation_board_graphic/error/wrong_game_type.png +0 -0
  290. package/test/graphic_references/13_navigation_board_graphic/theme/custom_1.png +0 -0
  291. package/test/graphic_references/13_navigation_board_graphic/theme/custom_2.png +0 -0
  292. package/test/graphic_references/13_navigation_board_graphic/theme/large.png +0 -0
  293. package/test/graphic_references/13_navigation_board_graphic/theme/small.png +0 -0
  294. package/test/graphic_references/14_navigation_board_autoplay/controlled/after_1_move_acknowledging_is-playing_changes.png +0 -0
  295. package/test/graphic_references/14_navigation_board_autoplay/controlled/after_1_move_not_acknowledging_is-playing_changes.png +0 -0
  296. package/test/graphic_references/14_navigation_board_autoplay/controlled/after_2_moves_acknowledging_node_changes.png +0 -0
  297. package/test/graphic_references/14_navigation_board_autoplay/controlled/after_2_moves_not_acknowledging_node_changes.png +0 -0
  298. package/test/graphic_references/14_navigation_board_autoplay/controlled/after_reaching_the_end.png +0 -0
  299. package/test/graphic_references/14_navigation_board_autoplay/controlled/already_at_the_end.png +0 -0
  300. package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_acknowledging_is-playing_changes.png +0 -0
  301. package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_acknowledging_node_changes.png +0 -0
  302. package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_at_the_end.png +0 -0
  303. package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_close_to_end.png +0 -0
  304. package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_not_acknowledging_is-playing_changes.png +0 -0
  305. package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_not_acknowledging_node_changes.png +0 -0
  306. package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/after_2_moves_from_beginning_after_stop.png +0 -0
  307. package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/after_2_moves_from_beginning_before_stop.png +0 -0
  308. package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/after_reaching_the_end_after_stop.png +0 -0
  309. package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/after_reaching_the_end_before_stop.png +0 -0
  310. package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/initial_state_close_to_end.png +0 -0
  311. package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/initial_state_default.png +0 -0
  312. package/test/graphic_test_app/03_error_box_graphic/base.tsx +18 -6
  313. package/test/graphic_test_app/04_icons_graphic/chess_piece.tsx +12 -3
  314. package/test/graphic_test_app/04_icons_graphic/marker.tsx +14 -4
  315. package/test/graphic_test_app/05_chessboard_graphic/annotations.tsx +7 -3
  316. package/test/graphic_test_app/05_chessboard_graphic/base.tsx +1 -1
  317. package/test/graphic_test_app/05_chessboard_graphic/move.tsx +9 -2
  318. package/test/graphic_test_app/05_chessboard_graphic/theme.tsx +1 -1
  319. package/test/graphic_test_app/06_chessboard_animation/on_redraw.tsx +8 -6
  320. package/test/graphic_test_app/07_chessboard_interaction/click_squares.tsx +4 -2
  321. package/test/graphic_test_app/07_chessboard_interaction/edit_arrows.tsx +4 -2
  322. package/test/graphic_test_app/07_chessboard_interaction/error.tsx +3 -1
  323. package/test/graphic_test_app/07_chessboard_interaction/move_pieces.tsx +4 -2
  324. package/test/graphic_test_app/08_chessboard_play_moves/base.tsx +12 -6
  325. package/test/graphic_test_app/08_chessboard_play_moves/promotions.tsx +12 -3
  326. package/test/graphic_test_app/09_chessboard_small_screens/base.tsx +3 -1
  327. package/test/graphic_test_app/09_chessboard_small_screens/top_bottom_components.tsx +8 -6
  328. package/test/graphic_test_app/10_movetext_graphic/error.tsx +1 -1
  329. package/test/graphic_test_app/10_movetext_graphic/options.tsx +16 -6
  330. package/test/graphic_test_app/11_movetext_interaction/error.tsx +4 -1
  331. package/test/graphic_test_app/13_navigation_board_graphic/additional_buttons.tsx +23 -16
  332. package/test/graphic_test_app/13_navigation_board_graphic/error.tsx +1 -1
  333. package/test/graphic_test_app/14_navigation_board_autoplay/controlled.tsx +34 -18
  334. package/test/graphic_test_app/common/test_app.tsx +4 -4
  335. package/.eslintrc.yml +0 -83
  336. package/test/.eslintrc.yml +0 -8
  337. package/test/graphic_test_app/.eslintrc.yml +0 -3
@@ -30,8 +30,8 @@ import './NavigationToolbar.css';
30
30
 
31
31
 
32
32
  interface NavigationToolbarProps {
33
- squareSize: number;
34
- buttons: NavigationBar;
33
+ squareSize: number,
34
+ buttons: NavigationBar,
35
35
  }
36
36
 
37
37
 
@@ -62,13 +62,15 @@ export function NavigationToolbar({ squareSize, buttons }: NavigationToolbarProp
62
62
  atLeastOneButtonEncountered = true;
63
63
 
64
64
  // Enqueue the button node.
65
- buttonNodes.push(<NavigationButtonImpl
66
- key={buttonNodes.length}
67
- tooltip={button.tooltip} iconPath={button.iconPath} enabled={button.enabled} onClick={button.onClick}
68
- size={buttonSize}
69
- spaceOnLeft={i === 0 || buttons[i - 1] === 'spacer'}
70
- spaceOnRight={i === buttons.length - 1 || buttons[i + 1] === 'spacer'}
71
- />);
65
+ buttonNodes.push(
66
+ <NavigationButtonImpl
67
+ key={buttonNodes.length}
68
+ tooltip={button.tooltip} iconPath={button.iconPath} enabled={button.enabled} onClick={button.onClick}
69
+ size={buttonSize}
70
+ spaceOnLeft={i === 0 || buttons[i - 1] === 'spacer'}
71
+ spaceOnRight={i === buttons.length - 1 || buttons[i + 1] === 'spacer'}
72
+ />,
73
+ );
72
74
  }
73
75
 
74
76
  return <div className="kokopu-navigationToolbar" style={{ marginTop: computeMarginTop(squareSize) }}>{buttonNodes}</div>;
@@ -76,9 +78,9 @@ export function NavigationToolbar({ squareSize, buttons }: NavigationToolbarProp
76
78
 
77
79
 
78
80
  interface NavigationButtonImplProps extends NavigationButton {
79
- size: number;
80
- spaceOnLeft: boolean;
81
- spaceOnRight: boolean;
81
+ size: number,
82
+ spaceOnLeft: boolean,
83
+ spaceOnRight: boolean,
82
84
  }
83
85
 
84
86
 
@@ -90,7 +92,9 @@ function NavigationButtonImpl({ size, spaceOnLeft, spaceOnRight, iconPath, toolt
90
92
  const rightBoundary = spaceOnRight ? 'A 16 16 0 0 0 16 0' : 'L 31 32 L 31 0 L 16 0';
91
93
  const actuallyEnabled = enabled ?? true;
92
94
  return (
93
- <div className={actuallyEnabled ? 'kokopu-enabledNavigationButton' : 'kokopu-disabledNavigationButton'} title={tooltip}
95
+ <div
96
+ className={actuallyEnabled ? 'kokopu-enabledNavigationButton' : 'kokopu-disabledNavigationButton'}
97
+ title={tooltip}
94
98
  onClick={actuallyEnabled ? onClick : undefined}
95
99
  >
96
100
  <svg viewBox="0 0 32 32" width={size} height={size}>
package/src/types.ts CHANGED
@@ -62,22 +62,22 @@ export function isChessPieceIconType(iconType: unknown): iconType is ChessPieceI
62
62
  export type Colorset = {
63
63
 
64
64
  /** Color of the black squares. */
65
- b: string;
65
+ b: string,
66
66
 
67
67
  /** Color of the white squares. */
68
- w: string;
68
+ w: string,
69
69
 
70
70
  /** Color of the blue markers. */
71
- cb: string;
71
+ cb: string,
72
72
 
73
73
  /** Color of the green markers. */
74
- cg: string;
74
+ cg: string,
75
75
 
76
76
  /** Color of the red markers. */
77
- cr: string;
77
+ cr: string,
78
78
 
79
79
  /** Color of the yellow markers. */
80
- cy: string;
80
+ cy: string,
81
81
  };
82
82
 
83
83
 
@@ -89,46 +89,46 @@ export type Colorset = {
89
89
  export type Pieceset = {
90
90
 
91
91
  /** Image for the black bishops. */
92
- bb: string;
92
+ bb: string,
93
93
 
94
94
  /** Image for the black kings. */
95
- bk: string;
95
+ bk: string,
96
96
 
97
97
  /** Image for the black knights. */
98
- bn: string;
98
+ bn: string,
99
99
 
100
100
  /** Image for the black pawns. */
101
- bp: string;
101
+ bp: string,
102
102
 
103
103
  /** Image for the black queens. */
104
- bq: string;
104
+ bq: string,
105
105
 
106
106
  /** Image for the black rooks. */
107
- br: string;
107
+ br: string,
108
108
 
109
109
  /** Image for the black turn flags. */
110
- bx: string;
110
+ bx: string,
111
111
 
112
112
  /** Image for the white bishops. */
113
- wb: string;
113
+ wb: string,
114
114
 
115
115
  /** Image for the white kings. */
116
- wk: string;
116
+ wk: string,
117
117
 
118
118
  /** Image for the white knights. */
119
- wn: string;
119
+ wn: string,
120
120
 
121
121
  /** Image for the white pawns. */
122
- wp: string;
122
+ wp: string,
123
123
 
124
124
  /** Image for the white queens. */
125
- wq: string;
125
+ wq: string,
126
126
 
127
127
  /** Image for the white rooks. */
128
- wr: string;
128
+ wr: string,
129
129
 
130
130
  /** Image for the white turn flags. */
131
- wx: string;
131
+ wx: string,
132
132
  };
133
133
 
134
134
 
@@ -136,12 +136,12 @@ export type Pieceset = {
136
136
  * Set of aliases for chess pieces symbols.
137
137
  */
138
138
  export type PieceSymbolMapping = {
139
- K: string;
140
- Q: string;
141
- R: string;
142
- B: string;
143
- N: string;
144
- P: string;
139
+ K: string,
140
+ Q: string,
141
+ R: string,
142
+ B: string,
143
+ N: string,
144
+ P: string,
145
145
  };
146
146
 
147
147
 
package/src/util.ts CHANGED
@@ -26,8 +26,8 @@ export function generateRandomId() {
26
26
  const buffer = new Uint32Array(8);
27
27
  crypto.getRandomValues(buffer);
28
28
  let result = '';
29
- for (let i = 0; i < buffer.length; ++i) {
30
- result += buffer[i].toString(16);
29
+ for (const c of buffer) {
30
+ result += c.toString(16);
31
31
  }
32
32
  return result;
33
33
  }
package/test/01_types.js CHANGED
@@ -35,7 +35,7 @@ describe('Is piece symbol mapping', () => {
35
35
  });
36
36
  }
37
37
 
38
- itIsPieceSymbolMapping('French localization', { K: 'R', Q: 'D', R: 'T', B: 'F', N: 'C', P: 'P' } , true);
38
+ itIsPieceSymbolMapping('French localization', { K: 'R', Q: 'D', R: 'T', B: 'F', N: 'C', P: 'P' }, true);
39
39
  itIsPieceSymbolMapping('Additional fields', { K: 'Ki_', Q: 'Qu_', R: 'Rk_', B: 'Bi_', N: 'Kn_', P: 'Pw_', Z: 'whatever', val: 42 }, true);
40
40
  itIsPieceSymbolMapping('Missing fields', { K: 'Ki_', Q: 'Qu_', R: 'Rk_', B: 'Bi_', N: 'Kn_' }, false);
41
41
  itIsPieceSymbolMapping('Non-string valued fields', { K: 42, Q: 'Qu_', R: 'Rk_', B: 'Bi_', N: 'Kn_', P: 'Pw_' }, false);
@@ -125,46 +125,60 @@ describe('Parse square markers', () => {
125
125
  describe('Flatten text markers', () => {
126
126
 
127
127
  it('RAe4', () => { test.value(flattenTextMarkers({ e4: { symbol: 'A', color: 'r' } })).is('RAe4'); });
128
- it('Gzd3,Y1h8', () => { test.value(flattenTextMarkers({
129
- h8: { symbol: '1', color: 'y' },
130
- d3: { symbol: 'z', color: 'g' },
131
- })).is('Gzd3,Y1h8'); });
132
- it('G2a1,YMc5,RLd2,Rxh7,Bwh8', () => { test.value(flattenTextMarkers({
133
- c5: { symbol: 'M', color: 'y' },
134
- h8: { symbol: 'w', color: 'b' },
135
- a1: { symbol: '2', color: 'g' },
136
- h7: { symbol: 'x', color: 'r' },
137
- d2: { symbol: 'L', color: 'r' },
138
- })).is('G2a1,YMc5,RLd2,Rxh7,Bwh8'); });
139
- it('Multi-character symbols', () => { test.value(flattenTextMarkers({
140
- a1: { symbol: 'A', color: 'y' },
141
- a7: { symbol: 'plus', color: 'g' },
142
- b3: { symbol: 'times', color: 'r' },
143
- g5: { symbol: 'dot', color: 'y' },
144
- h3: { symbol: 'circle', color: 'g' },
145
- })).is('YAa1,G(plus)a7,R(times)b3,Y(dot)g5,G(circle)h3'); });
128
+ it('Gzd3,Y1h8', () => {
129
+ test.value(flattenTextMarkers({
130
+ h8: { symbol: '1', color: 'y' },
131
+ d3: { symbol: 'z', color: 'g' },
132
+ })).is('Gzd3,Y1h8');
133
+ });
134
+ it('G2a1,YMc5,RLd2,Rxh7,Bwh8', () => {
135
+ test.value(flattenTextMarkers({
136
+ c5: { symbol: 'M', color: 'y' },
137
+ h8: { symbol: 'w', color: 'b' },
138
+ a1: { symbol: '2', color: 'g' },
139
+ h7: { symbol: 'x', color: 'r' },
140
+ d2: { symbol: 'L', color: 'r' },
141
+ })).is('G2a1,YMc5,RLd2,Rxh7,Bwh8');
142
+ });
143
+ it('Multi-character symbols', () => {
144
+ test.value(flattenTextMarkers({
145
+ a1: { symbol: 'A', color: 'y' },
146
+ a7: { symbol: 'plus', color: 'g' },
147
+ b3: { symbol: 'times', color: 'r' },
148
+ g5: { symbol: 'dot', color: 'y' },
149
+ h3: { symbol: 'circle', color: 'g' },
150
+ })).is('YAa1,G(plus)a7,R(times)b3,Y(dot)g5,G(circle)h3');
151
+ });
146
152
  it('<empty>', () => { test.value(flattenTextMarkers({})).is(''); });
147
153
 
148
- it('Wrong square', () => { test.value(flattenTextMarkers({
149
- e1: { symbol: 'H', color: 'r' },
150
- j5: { symbol: 'A', color: 'g' },
151
- })).is('RHe1'); });
152
- it('Wrong color', () => { test.value(flattenTextMarkers({
153
- a2: { symbol: '0', color: 'g' },
154
- b5: { symbol: 'A', color: 'R' },
155
- h8: { symbol: 'A' },
156
- })).is('G0a2'); });
157
- it('Wrong symbol', () => { test.value(flattenTextMarkers({
158
- a2: { symbol: '0', color: 'g' },
159
- b5: { symbol: '', color: 'r' },
160
- h8: { color: 'g' },
161
- d8: { symbol: '-', color: 'r' },
162
- c1: { symbol: 'abcd', color: 'r' },
163
- })).is('G0a2'); });
164
- it('Wrong multi-character symbol', () => { test.value(flattenTextMarkers({
165
- a2: { symbol: '0', color: 'g' },
166
- b5: { symbol: 'whatever', color: 'r' },
167
- })).is('G0a2'); });
154
+ it('Wrong square', () => {
155
+ test.value(flattenTextMarkers({
156
+ e1: { symbol: 'H', color: 'r' },
157
+ j5: { symbol: 'A', color: 'g' },
158
+ })).is('RHe1');
159
+ });
160
+ it('Wrong color', () => {
161
+ test.value(flattenTextMarkers({
162
+ a2: { symbol: '0', color: 'g' },
163
+ b5: { symbol: 'A', color: 'R' },
164
+ h8: { symbol: 'A' },
165
+ })).is('G0a2');
166
+ });
167
+ it('Wrong symbol', () => {
168
+ test.value(flattenTextMarkers({
169
+ a2: { symbol: '0', color: 'g' },
170
+ b5: { symbol: '', color: 'r' },
171
+ h8: { color: 'g' },
172
+ d8: { symbol: '-', color: 'r' },
173
+ c1: { symbol: 'abcd', color: 'r' },
174
+ })).is('G0a2');
175
+ });
176
+ it('Wrong multi-character symbol', () => {
177
+ test.value(flattenTextMarkers({
178
+ a2: { symbol: '0', color: 'g' },
179
+ b5: { symbol: 'whatever', color: 'r' },
180
+ })).is('G0a2');
181
+ });
168
182
 
169
183
  it('Wrong type (not an object)', () => { test.exception(() => flattenTextMarkers('whatever')).isInstanceOf(exception.IllegalArgument); });
170
184
  it('Wrong type (null)', () => { test.exception(() => flattenTextMarkers(null)).isInstanceOf(exception.IllegalArgument); });
@@ -175,24 +189,30 @@ describe('Flatten text markers', () => {
175
189
  describe('Parse text markers', () => {
176
190
 
177
191
  it('RAe4', () => { test.value(parseTextMarkers('RAe4')).is({ e4: { symbol: 'A', color: 'r' } }); });
178
- it('Gzd3,Y1h8', () => { test.value(parseTextMarkers('Gzd3,Y1h8')).is({
179
- h8: { symbol: '1', color: 'y' },
180
- d3: { symbol: 'z', color: 'g' },
181
- }); });
182
- it('G2a1,YMc5,RLd2,Rxh7,Bwh8', () => { test.value(parseTextMarkers(' G2a1, Rxh7 ,YMc5 ,RLd2,Bwh8 ')).is({
183
- c5: { symbol: 'M', color: 'y' },
184
- h8: { symbol: 'w', color: 'b' },
185
- a1: { symbol: '2', color: 'g' },
186
- h7: { symbol: 'x', color: 'r' },
187
- d2: { symbol: 'L', color: 'r' },
188
- }); });
189
- it('Multi-character symbols', () => { test.value(parseTextMarkers('YAa1,G(plus)a7, R(times)b3 ,Y(dot)g5,G(circle)h3')).is({
190
- a1: { symbol: 'A', color: 'y' },
191
- a7: { symbol: 'plus', color: 'g' },
192
- b3: { symbol: 'times', color: 'r' },
193
- g5: { symbol: 'dot', color: 'y' },
194
- h3: { symbol: 'circle', color: 'g' },
195
- }); });
192
+ it('Gzd3,Y1h8', () => {
193
+ test.value(parseTextMarkers('Gzd3,Y1h8')).is({
194
+ h8: { symbol: '1', color: 'y' },
195
+ d3: { symbol: 'z', color: 'g' },
196
+ });
197
+ });
198
+ it('G2a1,YMc5,RLd2,Rxh7,Bwh8', () => {
199
+ test.value(parseTextMarkers(' G2a1, Rxh7 ,YMc5 ,RLd2,Bwh8 ')).is({
200
+ c5: { symbol: 'M', color: 'y' },
201
+ h8: { symbol: 'w', color: 'b' },
202
+ a1: { symbol: '2', color: 'g' },
203
+ h7: { symbol: 'x', color: 'r' },
204
+ d2: { symbol: 'L', color: 'r' },
205
+ });
206
+ });
207
+ it('Multi-character symbols', () => {
208
+ test.value(parseTextMarkers('YAa1,G(plus)a7, R(times)b3 ,Y(dot)g5,G(circle)h3')).is({
209
+ a1: { symbol: 'A', color: 'y' },
210
+ a7: { symbol: 'plus', color: 'g' },
211
+ b3: { symbol: 'times', color: 'r' },
212
+ g5: { symbol: 'dot', color: 'y' },
213
+ h3: { symbol: 'circle', color: 'g' },
214
+ });
215
+ });
196
216
  it('<empty>', () => { test.value(parseTextMarkers('')).is({}); });
197
217
  it('<blank>', () => { test.value(parseTextMarkers(' ')).is({}); });
198
218
 
@@ -213,8 +233,9 @@ describe('Flatten arrow markers', () => {
213
233
 
214
234
  it('Re4d6', () => { test.value(flattenArrowMarkers({ e4d6: 'r' })).is('Re4d6'); });
215
235
  it('Gd3b4,Yh8h7', () => { test.value(flattenArrowMarkers({ h8h7: 'y', d3b4: 'g' })).is('Gd3b4,Yh8h7'); });
216
- it('Ga1h8,Yc5a1,Rd2d2,Rh7h8,Bh8c5', () => { test.value(flattenArrowMarkers({ c5a1: 'y', h8c5: 'b', a1h8: 'g', h7h8: 'r', d2d2: 'r' }))
217
- .is('Ga1h8,Yc5a1,Rd2d2,Rh7h8,Bh8c5'); });
236
+ it('Ga1h8,Yc5a1,Rd2d2,Rh7h8,Bh8c5', () => {
237
+ test.value(flattenArrowMarkers({ c5a1: 'y', h8c5: 'b', a1h8: 'g', h7h8: 'r', d2d2: 'r' })).is('Ga1h8,Yc5a1,Rd2d2,Rh7h8,Bh8c5');
238
+ });
218
239
  it('<empty>', () => { test.value(flattenArrowMarkers({})).is(''); });
219
240
 
220
241
  it('Wrong vector', () => { test.value(flattenArrowMarkers({ e1c2: 'r', a1b9: 'g', c0d2: 'r', i3d4: 'r', f2k3: 'g', whatever: 'y' })).is('Re1c2'); });
@@ -230,8 +251,9 @@ describe('Parse arrow markers', () => {
230
251
 
231
252
  it('Re4d6', () => { test.value(parseArrowMarkers('Re4d6')).is({ e4d6: 'r' }); });
232
253
  it('Gd3b4,Yh8h7', () => { test.value(parseArrowMarkers('Gd3b4,Yh8h7')).is({ h8h7: 'y', d3b4: 'g' }); });
233
- it('Ga1h8,Yc5a1,Rd2d2,Rh7h8,Bh8c5', () => { test.value(parseArrowMarkers(' Bh8c5,Ga1h8 , Yc5a1 , Rd2d2,Rh7h8 '))
234
- .is({ c5a1: 'y', h8c5: 'b', a1h8: 'g', h7h8: 'r', d2d2: 'r' }); });
254
+ it('Ga1h8,Yc5a1,Rd2d2,Rh7h8,Bh8c5', () => {
255
+ test.value(parseArrowMarkers(' Bh8c5,Ga1h8 , Yc5a1 , Rd2d2,Rh7h8 ')).is({ c5a1: 'y', h8c5: 'b', a1h8: 'g', h7h8: 'r', d2d2: 'r' });
256
+ });
235
257
  it('<empty>', () => { test.value(parseArrowMarkers('')).is({}); });
236
258
  it('<blank>', () => { test.value(parseArrowMarkers(' ')).is({}); });
237
259
 
@@ -211,6 +211,8 @@ describe('Adapt square-size with small-screen limits', () => {
211
211
  delete global.window;
212
212
  });
213
213
 
214
+ /* global window */
215
+
214
216
  it('Window-limited', () => {
215
217
  window.innerWidth = 640;
216
218
  testAdaptSquareSize(32, 9999, 9999, true, true, limits);
@@ -42,7 +42,7 @@ describeWithBrowser('Error box graphic', browserContext => {
42
42
  ]);
43
43
 
44
44
  itChecksScreenshots(browserContext, '03_error_box_graphic/localization', [
45
- 'default'
45
+ 'default',
46
46
  ]);
47
47
 
48
48
  });
@@ -31,8 +31,7 @@ describeWithBrowser('Chessboard interaction', browserContext => {
31
31
  itCustom(browserContext, '07_chessboard_interaction/click_squares', itemIndex, label, async element => {
32
32
  const actions = browserContext.driver.actions({ async: true });
33
33
  const area = await element.getRect();
34
- for (let i = 0; i < targets.length; ++i) {
35
- const target = targets[i];
34
+ for (const target of targets) {
36
35
  await actions.move({ x: area.x + target.x, y: area.y + target.y }).click().perform();
37
36
  await compareSandbox(browserContext, target.expectedText);
38
37
  }
@@ -50,10 +50,10 @@ describeWithBrowser('Navigation board graphic', browserContext => {
50
50
  function itCheckClickButton(itemIndex, label, buttons) {
51
51
  itCustom(browserContext, '13_navigation_board_graphic/additional_buttons', itemIndex, label, async element => {
52
52
  await setSandbox(browserContext, '');
53
- for (let i = 0; i < buttons.length; ++i) {
54
- const buttonElement = await element.findElement(By.xpath(`.//div[@title='${buttons[i].title}']`));
53
+ for (const button of buttons) {
54
+ const buttonElement = await element.findElement(By.xpath(`.//div[@title='${button.title}']`));
55
55
  await buttonElement.click();
56
- await compareSandbox(browserContext, buttons[i].expectedSandbox ?? '');
56
+ await compareSandbox(browserContext, button.expectedSandbox ?? '');
57
57
  }
58
58
  });
59
59
  }
@@ -47,8 +47,8 @@ const AUTOPLAY_DELAY = 1000;
47
47
  /**
48
48
  * Create a Mocha test-suite that runs graphic tests in Dockerized Selenium webbrowser.
49
49
  */
50
- exports.describeWithBrowser = function(suiteLabel, testFactory) {
51
- describe(suiteLabel, function() {
50
+ exports.describeWithBrowser = function (suiteLabel, testFactory) {
51
+ describe(suiteLabel, function () {
52
52
 
53
53
  // Fetching a new page in the browser may take a while, thus increase the timeout threshold.
54
54
  this.timeout(10000);
@@ -147,7 +147,7 @@ async function fetchTestCase(browserContext, testCaseName) {
147
147
  /**
148
148
  * Wait until the end of the chessboard animations.
149
149
  */
150
- const waitForAnimation = exports.waitForAnimation = async function() {
150
+ const waitForAnimation = exports.waitForAnimation = async function () {
151
151
  await new Promise(resolve => setTimeout(resolve, ANIMATION_DELAY));
152
152
  };
153
153
 
@@ -155,7 +155,7 @@ const waitForAnimation = exports.waitForAnimation = async function() {
155
155
  /**
156
156
  * Wait until the given number of moves have been auto-played.
157
157
  */
158
- exports.waitForAutoplay = async function(nbMoves) {
158
+ exports.waitForAutoplay = async function (nbMoves) {
159
159
  await new Promise(resolve => setTimeout(resolve, (nbMoves + 0.5) * AUTOPLAY_DELAY));
160
160
  };
161
161
 
@@ -163,7 +163,7 @@ exports.waitForAutoplay = async function(nbMoves) {
163
163
  /**
164
164
  * Take a screenshot of the element identified by the given CSS target.
165
165
  */
166
- const takeScreenshot = exports.takeScreenshot = async function(browserContext, imageBaseName, element) {
166
+ const takeScreenshot = exports.takeScreenshot = async function (browserContext, imageBaseName, element) {
167
167
 
168
168
  imageBaseName = imageBaseName.replaceAll(' ', '_').toLowerCase();
169
169
  const actualFilename = `${outputDir}/${browserContext.latestTestCase}/${imageBaseName}.png`;
@@ -178,7 +178,7 @@ const takeScreenshot = exports.takeScreenshot = async function(browserContext, i
178
178
  /**
179
179
  * Compare a screenshot to its reference.
180
180
  */
181
- const compareScreenshot = exports.compareScreenshot = async function(browserContext, imageBaseName) {
181
+ const compareScreenshot = exports.compareScreenshot = async function (browserContext, imageBaseName) {
182
182
 
183
183
  imageBaseName = imageBaseName.replaceAll(' ', '_').toLowerCase();
184
184
  const actualFilename = `${outputDir}/${browserContext.latestTestCase}/${imageBaseName}.png`;
@@ -198,7 +198,7 @@ const compareScreenshot = exports.compareScreenshot = async function(browserCont
198
198
  /**
199
199
  * Compare content of the sandbox to the expected text.
200
200
  */
201
- exports.compareSandbox = async function(browserContext, expectedText) {
201
+ exports.compareSandbox = async function (browserContext, expectedText) {
202
202
  const actualText = await browserContext.driver.findElement(By.id('sandbox')).getText();
203
203
  test.value(actualText).is(expectedText);
204
204
  };
@@ -207,7 +207,7 @@ exports.compareSandbox = async function(browserContext, expectedText) {
207
207
  /**
208
208
  * Set the content of the sandbox to the given value.
209
209
  */
210
- exports.setSandbox = async function(browserContext, value) {
210
+ exports.setSandbox = async function (browserContext, value) {
211
211
  if (/[^\w \-=]/.test(value)) {
212
212
  throw new Error('Invalid characters found in the sandox message.');
213
213
  }
@@ -218,7 +218,7 @@ exports.setSandbox = async function(browserContext, value) {
218
218
  /**
219
219
  * Set the width of the browser.
220
220
  */
221
- exports.setWindowWidth = async function(browserContext, width) {
221
+ exports.setWindowWidth = async function (browserContext, width) {
222
222
  const { height } = await await browserContext.driver.manage().window().getRect();
223
223
  await browserContext.driver.manage().window().setRect({ width: width, height: height });
224
224
  };
@@ -227,7 +227,7 @@ exports.setWindowWidth = async function(browserContext, width) {
227
227
  /**
228
228
  * Open the page corresponding to the given test-case, and execute the given scenario.
229
229
  */
230
- const itCustom = exports.itCustom = function(browserContext, testCaseName, itemIndex, itemName, scenario) {
230
+ const itCustom = exports.itCustom = function (browserContext, testCaseName, itemIndex, itemName, scenario) {
231
231
  it(`${testCaseName} - ${itemName}`, async () => {
232
232
  await fetchTestCase(browserContext, testCaseName);
233
233
  const element = await browserContext.driver.findElement(By.id('test-item-' + itemIndex));
@@ -239,7 +239,7 @@ const itCustom = exports.itCustom = function(browserContext, testCaseName, itemI
239
239
  /**
240
240
  * Open the page corresponding to the given test-case, take a screenshot for each item, and compare them to the reference.
241
241
  */
242
- exports.itChecksScreenshots = function(browserContext, testCaseName, itemNames) {
242
+ exports.itChecksScreenshots = function (browserContext, testCaseName, itemNames) {
243
243
  for (let i = 0; i < itemNames.length; ++i) {
244
244
  const itemName = itemNames[i];
245
245
  itCustom(browserContext, testCaseName, i, itemName, async element => {