From 6d5bf2da7c877988224e7db669e74de37857e3a1 Mon Sep 17 00:00:00 2001 From: NB Kelly Date: Sun, 14 Jul 2024 10:08:28 +1200 Subject: [PATCH] dont display empty prompt buttons --- src/cljs/nr/gameboard/board.cljs | 2 +- test/clj/game/cards/upgrades_test.clj | 32 +++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/cljs/nr/gameboard/board.cljs b/src/cljs/nr/gameboard/board.cljs index 86b3023a30..e89d81dd35 100644 --- a/src/cljs/nr/gameboard/board.cljs +++ b/src/cljs/nr/gameboard/board.cljs @@ -1652,7 +1652,7 @@ ;; otherwise choice of all present choices :else (doall (for [{:keys [idx uuid value]} choices] - (when (not= value "Hide") + (when (and (seq value) (not= value "Hide")) [:button {:key idx :on-click #(do (send-command "choice" {:choice {:uuid uuid}}) (card-highlight-mouse-out % value button-channel)) diff --git a/test/clj/game/cards/upgrades_test.clj b/test/clj/game/cards/upgrades_test.clj index 23b1398ce0..b68bc74179 100644 --- a/test/clj/game/cards/upgrades_test.clj +++ b/test/clj/game/cards/upgrades_test.clj @@ -3378,6 +3378,38 @@ (take-credits state :corp) (is (no-prompt? state :corp)))) +(deftest overseer-matrix-duplicated-prompt-issue + ;; Doesn't cause duplicate ghost buttons in the prompts + ;; this test is primarily to assert that the issue is on the front-end, + ;; rather than the backend + (do-game + (new-game {:corp {:hand [(qty "Overseer Matrix" 3) (qty "Daruma" 3) "Yakov Erikovich Avdakov"] + :credits 50} + :runner {:credits 50}}) + (core/gain state :corp :click 5) + (play-from-hand state :corp "Overseer Matrix" "New remote") + (dotimes [_ 2] + (play-from-hand state :corp "Overseer Matrix" "Server 1")) + (dotimes [_ 3] + (play-from-hand state :corp "Daruma" "Server 1")) + (dotimes [n 3] + (rez state :corp (get-content state :remote1 n))) + (play-from-hand state :corp "Yakov Erikovich Avdakov" "Server 1") + (rez state :corp (get-content state :remote1 6)) + (take-credits state :corp) + (run-on state "Server 1") + (run-continue-until state :success) + (let [expected-prompt '("Overseer Matrix" "Overseer Matrix" "Overseer Matrix" "Yakov Erikovich Avdakov")] + (click-card state :runner (get-content state :remote1 5)) + (click-prompt state :runner "Pay 2 [Credits] to trash") + (is (= expected-prompt (map :title (prompt-buttons :corp))) "Only expected buttons (first time)") + (dotimes [n 3] + (click-prompt state :corp "Overseer Matrix") + (click-prompt state :corp "1")) + (click-card state :runner (get-content state :remote1 4)) + (click-prompt state :runner "Pay 2 [Credits] to trash") + (is (= expected-prompt (map :title (prompt-buttons :corp))) "Only expected buttons (second time)")))) + (deftest panic-button (do-game (new-game {:corp {:hand ["Panic Button"]