Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dont display empty prompt buttons #7543

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cljs/nr/gameboard/board.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
32 changes: 32 additions & 0 deletions test/clj/game/cards/upgrades_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
Loading