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.
- package/CHANGELOG.md +4 -0
- package/dist/lib/chessboard/Chessboard.js +3 -2
- package/dist/lib/chessboard/Chessboard.js.map +1 -1
- package/dist/lib/chessboard/ChessboardImpl.js +1 -1
- package/dist/lib/chessboard/ChessboardImpl.js.map +1 -1
- package/dist/lib/chessboard/Motion.js +1 -1
- package/dist/lib/chessboard/Motion.js.map +1 -1
- package/dist/lib/i18n.js +2 -2
- package/dist/lib/i18n.js.map +1 -1
- package/dist/lib/icons/ArrowMarkerIcon.js.map +1 -1
- package/dist/lib/icons/ChessPieceIcon.d.ts +1 -4
- package/dist/lib/icons/ChessPieceIcon.js +1 -5
- package/dist/lib/icons/ChessPieceIcon.js.map +1 -1
- package/dist/lib/icons/SquareMarkerIcon.d.ts +1 -4
- package/dist/lib/icons/SquareMarkerIcon.js +1 -5
- package/dist/lib/icons/SquareMarkerIcon.js.map +1 -1
- package/dist/lib/icons/TextMarkerIcon.d.ts +1 -4
- package/dist/lib/icons/TextMarkerIcon.js +1 -5
- package/dist/lib/icons/TextMarkerIcon.js.map +1 -1
- package/dist/lib/movetext/Movetext.js.map +1 -1
- package/dist/lib/movetext/MovetextImpl.js +4 -3
- package/dist/lib/movetext/MovetextImpl.js.map +1 -1
- package/dist/lib/movetext/htmlFilter.js +1 -1
- package/dist/lib/movetext/htmlFilter.js.map +1 -1
- package/dist/lib/navigationboard/NavigationBoard.d.ts +1 -1
- package/dist/lib/navigationboard/NavigationBoard.js +2 -2
- package/dist/lib/navigationboard/NavigationBoard.js.map +1 -1
- package/dist/lib/navigationboard/NavigationField.js +1 -1
- package/dist/lib/navigationboard/NavigationField.js.map +1 -1
- package/dist/lib/navigationboard/NavigationToolbar.js.map +1 -1
- package/dist/lib/util.js +2 -2
- package/dist/lib/util.js.map +1 -1
- package/doc_src/demo/PageChessboardBase.tsx +57 -51
- package/doc_src/demo/PageChessboardInteraction.tsx +78 -63
- package/doc_src/demo/PageChessboardMove.tsx +35 -30
- package/doc_src/demo/PageChessboardSmallScreens.tsx +3 -3
- package/doc_src/demo/PageMovetextBase.tsx +91 -81
- package/doc_src/demo/PageMovetextInteraction.tsx +23 -21
- package/doc_src/demo/PageNavigationBoardBase.tsx +62 -54
- package/doc_src/demo/PageNavigationBoardUncontrolledVsControlled.tsx +24 -18
- package/doc_src/theming/LogoRenderer.js +8 -9
- package/package.json +30 -28
- package/scripts/docker-compose.yml +1 -3
- package/src/chessboard/BoardProperties.ts +13 -13
- package/src/chessboard/Chessboard.tsx +43 -39
- package/src/chessboard/ChessboardImpl.tsx +58 -41
- package/src/chessboard/Draggable.tsx +15 -15
- package/src/chessboard/Motion.tsx +4 -4
- package/src/errorbox/ErrorBox.tsx +5 -5
- package/src/errorbox/parsing.tsx +6 -6
- package/src/i18n.ts +2 -2
- package/src/icons/AnnotationSymbolShape.tsx +5 -5
- package/src/icons/ArrowMarkerIcon.tsx +8 -4
- package/src/icons/ArrowTip.tsx +2 -2
- package/src/icons/ChessPieceIcon.tsx +4 -11
- package/src/icons/SquareMarkerIcon.tsx +3 -10
- package/src/icons/TextMarkerIcon.tsx +4 -11
- package/src/movetext/Movetext.tsx +11 -10
- package/src/movetext/MovetextImpl.tsx +34 -28
- package/src/movetext/htmlFilter.tsx +4 -4
- package/src/navigationboard/NavigationBoard.tsx +55 -50
- package/src/navigationboard/NavigationButton.ts +4 -4
- package/src/navigationboard/NavigationField.tsx +6 -6
- package/src/navigationboard/NavigationToolbar.tsx +17 -13
- package/src/types.ts +26 -26
- package/src/util.ts +2 -2
- package/test/01_types.js +83 -61
- package/test/02_chessboard_util.js +2 -0
- package/test/03_error_box_graphic.js +1 -1
- package/test/07_chessboard_interaction.js +1 -2
- package/test/13_navigation_board_graphic.js +3 -3
- package/test/common/graphic.js +11 -11
- package/test/graphic_references/03_error_box_graphic/base/cut_beginning_of_text.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/cut_end_of_text.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/cut_on_line_breaks.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/error_index_not_integer.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/full.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/minimal.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/missing_error_index.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/missing_error_text.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/negative_error_index.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/single_character_text.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/too_large_error_index.png +0 -0
- package/test/graphic_references/03_error_box_graphic/localization/default.png +0 -0
- package/test/graphic_references/04_icons_graphic/chess_piece/customized_pieceset.png +0 -0
- package/test/graphic_references/04_icons_graphic/chess_piece/invalid_multiple_pieces.png +0 -0
- package/test/graphic_references/04_icons_graphic/chess_piece/invalid_pieceset.png +0 -0
- package/test/graphic_references/04_icons_graphic/chess_piece/invalid_single_piece.png +0 -0
- package/test/graphic_references/04_icons_graphic/chess_piece/invalid_size.png +0 -0
- package/test/graphic_references/04_icons_graphic/chess_piece/multiple_pieces.png +0 -0
- package/test/graphic_references/04_icons_graphic/chess_piece/single_piece.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/colorized_arrow.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/colorized_square.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/colorized_symbol.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/colorized_text.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/default_arrow.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/default_square.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/default_text.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/invalid_arrow_size.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/invalid_square_size.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/invalid_symbol.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/invalid_text_size.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/wrapped_arrow.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/wrapped_square.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/wrapped_symbol.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/wrapped_text.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/annotations/overlap.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/annotations/overlap_and_flip.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/annotations/with_coordinates.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/annotations/with_coordinates_and_flip.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/annotations/without_coordinates.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/annotations/without_coordinates_and_flip.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/base/default.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/base/empty.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/base/from_fen.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/base/from_kokopu_object.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/base/parsing_error.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/base/wrong_position_type.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/chess960.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/chess960_with_move.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/invalid_variant.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/invalid_variant_with_fen.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/special_code.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/variant_with_std_initial_position.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/variant_without_std_initial_position.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/flipped/default.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/flipped/empty.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/flipped/from_fen.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/flipped/from_kokopu_object.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/flipped/parsing_error.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/capture.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/castling_move.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/default.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/en-passant.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/illegal_null-move.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/no_move_arrow.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/null-move.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/parsing_error.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/promotion.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/with_forced_move_arrow_and_flip.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/wrong_move_arrow_color_type.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/wrong_move_type.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/custom_1.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/custom_2.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/custom_3.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/custom_4.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/custom_5.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/custom_6.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/default.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/large.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/small.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/wrong_colorset.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/wrong_pieceset.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/wrong_square_size_type.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_1/capture.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_1/castling_move.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_1/en-passant.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_1/move_1.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_1/move_2.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_1/promotion.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_2/capture.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_2/castling_move.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_2/en-passant.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_2/move_1.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_2/move_2.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_2/promotion.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_3/capture.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_3/castling_move.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_3/en-passant.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_3/move_1.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_3/move_2.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_3/promotion.png +0 -0
- package/test/graphic_references/06_chessboard_animation/on_redraw/final_state.png +0 -0
- package/test/graphic_references/06_chessboard_animation/on_redraw/initial_state.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/edit_arrows/base_1.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/edit_arrows/base_2.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/edit_arrows/from_==_to.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/edit_arrows/out_of_board.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/edit_arrows/over_arrow_marker.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/edit_arrows/over_square_marker.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/error/edit_color_not_set.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/error/wrong_interaction_mode.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/move_pieces/after_move.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/move_pieces/from_==_to.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/move_pieces/move_empty_square.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/move_pieces/out_of_board.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/move_pieces/over_arrow_marker.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/move_pieces/over_empty.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/move_pieces/over_non-empty_1.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/move_pieces/over_non-empty_2.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/move_pieces/over_square_marker.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/move_pieces/over_text_marker.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/base/castling_move.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/base/chess960_ambiguous_king_move.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/base/chess960_castling_move_1.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/base/chess960_castling_move_2.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/base/chess960_non-kxr_castling.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/base/from_==_to.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/base/illegal_move.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/base/illegal_position.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/base/out_of_board.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/base/regular_move_1.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/base/regular_move_2.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/base/wrong_color_moved.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/promotions/antichess_promotion.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/promotions/cancel_promotion.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/promotions/regular_promotion_1.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/promotions/regular_promotion_2.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/base/default.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/base/invalid_limits.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/base/width_690.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/base/width_700.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/base/width_710.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/base/width_720.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/base/width_730.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/base/width_740.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/base/width_750.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/default_bottom_component.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/default_top_component.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/reduced_bottom_component.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/reduced_top_component.png +0 -0
- package/test/graphic_references/10_movetext_graphic/base/game_1.png +0 -0
- package/test/graphic_references/10_movetext_graphic/base/game_2.png +0 -0
- package/test/graphic_references/10_movetext_graphic/base/game_3.png +0 -0
- package/test/graphic_references/10_movetext_graphic/base/game_4.png +0 -0
- package/test/graphic_references/10_movetext_graphic/error/pgn_parsing_error_1.png +0 -0
- package/test/graphic_references/10_movetext_graphic/error/pgn_parsing_error_2.png +0 -0
- package/test/graphic_references/10_movetext_graphic/error/wrong_game_index_1.png +0 -0
- package/test/graphic_references/10_movetext_graphic/error/wrong_game_index_2.png +0 -0
- package/test/graphic_references/10_movetext_graphic/error/wrong_game_index_type.png +0 -0
- package/test/graphic_references/10_movetext_graphic/error/wrong_game_type.png +0 -0
- package/test/graphic_references/10_movetext_graphic/format_move/format_text.png +0 -0
- package/test/graphic_references/10_movetext_graphic/html/filtered_tags_and_attributes.png +0 -0
- package/test/graphic_references/10_movetext_graphic/html/html_in_comments.png +0 -0
- package/test/graphic_references/10_movetext_graphic/html/html_in_headers.png +0 -0
- package/test/graphic_references/10_movetext_graphic/options/custom_piece_symbols.png +0 -0
- package/test/graphic_references/10_movetext_graphic/options/figurine_piece_symbols_and_diagram_options.png +0 -0
- package/test/graphic_references/10_movetext_graphic/options/hidden_diagrams.png +0 -0
- package/test/graphic_references/10_movetext_graphic/options/localized_piece_symbols.png +0 -0
- package/test/graphic_references/10_movetext_graphic/options/other_diagram_options.png +0 -0
- package/test/graphic_references/10_movetext_graphic/options/wrong_diagram_options_1.png +0 -0
- package/test/graphic_references/10_movetext_graphic/options/wrong_diagram_options_2.png +0 -0
- package/test/graphic_references/10_movetext_graphic/options/wrong_piece_symbol_value.png +0 -0
- package/test/graphic_references/11_movetext_interaction/error/wrong_interaction_mode.png +0 -0
- package/test/graphic_references/11_movetext_interaction/select_moves/click_on_disabled.png +0 -0
- package/test/graphic_references/11_movetext_interaction/select_moves/click_on_unselected.png +0 -0
- package/test/graphic_references/11_movetext_interaction/select_moves/click_on_unselected_without_callback.png +0 -0
- package/test/graphic_references/11_movetext_interaction/select_moves/click_on_with_variations.png +0 -0
- package/test/graphic_references/12_navigation_board_base/controlled/default.png +0 -0
- package/test/graphic_references/12_navigation_board_base/controlled/forbidden_navigation_0.png +0 -0
- package/test/graphic_references/12_navigation_board_base/controlled/forbidden_navigation_1.png +0 -0
- package/test/graphic_references/12_navigation_board_base/controlled/invalid_node_id.png +0 -0
- package/test/graphic_references/12_navigation_board_base/controlled/no_callback_defined_0.png +0 -0
- package/test/graphic_references/12_navigation_board_base/controlled/no_callback_defined_1.png +0 -0
- package/test/graphic_references/12_navigation_board_base/controlled/overriding_initial_node_id.png +0 -0
- package/test/graphic_references/12_navigation_board_base/controlled/regular_navigation_0.png +0 -0
- package/test/graphic_references/12_navigation_board_base/controlled/regular_navigation_1.png +0 -0
- package/test/graphic_references/12_navigation_board_base/controlled/regular_navigation_2.png +0 -0
- package/test/graphic_references/12_navigation_board_base/controlled/regular_navigation_3.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_beginning_0.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_beginning_1.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_beginning_2.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_end_0.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_end_1.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_end_2.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_at_end.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_at_specific_id.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_default.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_default_with_game_index.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_on_null-move.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_0.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_1.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_2.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_3.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_4.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_flipping_0.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_flipping_1.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_0.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_1.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_2.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_3.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_4.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_5.png +0 -0
- package/test/graphic_references/13_navigation_board_graphic/additional_buttons/error_1.png +0 -0
- package/test/graphic_references/13_navigation_board_graphic/additional_buttons/error_2.png +0 -0
- package/test/graphic_references/13_navigation_board_graphic/additional_buttons/multiple_buttons.png +0 -0
- package/test/graphic_references/13_navigation_board_graphic/additional_buttons/single_button.png +0 -0
- package/test/graphic_references/13_navigation_board_graphic/error/pgn_parsing_error.png +0 -0
- package/test/graphic_references/13_navigation_board_graphic/error/wrong_game_type.png +0 -0
- package/test/graphic_references/13_navigation_board_graphic/theme/custom_1.png +0 -0
- package/test/graphic_references/13_navigation_board_graphic/theme/custom_2.png +0 -0
- package/test/graphic_references/13_navigation_board_graphic/theme/large.png +0 -0
- package/test/graphic_references/13_navigation_board_graphic/theme/small.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/controlled/after_1_move_acknowledging_is-playing_changes.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/controlled/after_1_move_not_acknowledging_is-playing_changes.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/controlled/after_2_moves_acknowledging_node_changes.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/controlled/after_2_moves_not_acknowledging_node_changes.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/controlled/after_reaching_the_end.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/controlled/already_at_the_end.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_acknowledging_is-playing_changes.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_acknowledging_node_changes.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_at_the_end.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_close_to_end.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_not_acknowledging_is-playing_changes.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_not_acknowledging_node_changes.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/after_2_moves_from_beginning_after_stop.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/after_2_moves_from_beginning_before_stop.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/after_reaching_the_end_after_stop.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/after_reaching_the_end_before_stop.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/initial_state_close_to_end.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/initial_state_default.png +0 -0
- package/test/graphic_test_app/03_error_box_graphic/base.tsx +18 -6
- package/test/graphic_test_app/04_icons_graphic/chess_piece.tsx +12 -3
- package/test/graphic_test_app/04_icons_graphic/marker.tsx +14 -4
- package/test/graphic_test_app/05_chessboard_graphic/annotations.tsx +7 -3
- package/test/graphic_test_app/05_chessboard_graphic/base.tsx +1 -1
- package/test/graphic_test_app/05_chessboard_graphic/move.tsx +9 -2
- package/test/graphic_test_app/05_chessboard_graphic/theme.tsx +1 -1
- package/test/graphic_test_app/06_chessboard_animation/on_redraw.tsx +8 -6
- package/test/graphic_test_app/07_chessboard_interaction/click_squares.tsx +4 -2
- package/test/graphic_test_app/07_chessboard_interaction/edit_arrows.tsx +4 -2
- package/test/graphic_test_app/07_chessboard_interaction/error.tsx +3 -1
- package/test/graphic_test_app/07_chessboard_interaction/move_pieces.tsx +4 -2
- package/test/graphic_test_app/08_chessboard_play_moves/base.tsx +12 -6
- package/test/graphic_test_app/08_chessboard_play_moves/promotions.tsx +12 -3
- package/test/graphic_test_app/09_chessboard_small_screens/base.tsx +3 -1
- package/test/graphic_test_app/09_chessboard_small_screens/top_bottom_components.tsx +8 -6
- package/test/graphic_test_app/10_movetext_graphic/error.tsx +1 -1
- package/test/graphic_test_app/10_movetext_graphic/options.tsx +16 -6
- package/test/graphic_test_app/11_movetext_interaction/error.tsx +4 -1
- package/test/graphic_test_app/13_navigation_board_graphic/additional_buttons.tsx +23 -16
- package/test/graphic_test_app/13_navigation_board_graphic/error.tsx +1 -1
- package/test/graphic_test_app/14_navigation_board_autoplay/controlled.tsx +34 -18
- package/test/graphic_test_app/common/test_app.tsx +4 -4
- package/.eslintrc.yml +0 -83
- package/test/.eslintrc.yml +0 -8
- 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(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
|
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 (
|
|
30
|
-
result +=
|
|
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' }
|
|
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', () => {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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', () => {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
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', () => {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
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', () => {
|
|
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', () => {
|
|
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
|
|
|
@@ -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 (
|
|
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 (
|
|
54
|
-
const buttonElement = await element.findElement(By.xpath(`.//div[@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,
|
|
56
|
+
await compareSandbox(browserContext, button.expectedSandbox ?? '');
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
}
|
package/test/common/graphic.js
CHANGED
|
@@ -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 => {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/test/graphic_references/05_chessboard_graphic/annotations/with_coordinates_and_flip.png
CHANGED
|
Binary file
|
|
Binary file
|
package/test/graphic_references/05_chessboard_graphic/annotations/without_coordinates_and_flip.png
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|