Skip to content

Update tests to not make strong assumptions about actionButton()'s HTML markup#1212

Merged
ColinFay merged 1 commit intoThinkR-open:masterfrom
cpsievert:master
Jul 2, 2025
Merged

Update tests to not make strong assumptions about actionButton()'s HTML markup#1212
ColinFay merged 1 commit intoThinkR-open:masterfrom
cpsievert:master

Conversation

@cpsievert
Copy link
Contributor

Hello, I'm a core contributor to Shiny, and this PR is in anticipation for rstudio/shiny#4249, where we plan on making changes to the HTML markup that actionButton() produces, which will break these tests of undisplay()'s logic.

I've made a minimal change to still test the logic you're aiming to test, but without making such strong assumptions about the markup that actionButton() generates. It would be great if golem could make a more extensive pass through tests (and utility functions) to not be so tightly coupled with Shiny's HTML markup generation. Some tools you can use to combat this include {htmltools}'s tagGetAttribute(), tagSetAttributes(), tagQuery(), etc. You may also consider snapshot testing for tests that truly do want to make assumptions about markup generation beyond your control.

@ColinFay ColinFay merged commit ab09e64 into ThinkR-open:master Jul 2, 2025
7 checks passed
@ColinFay
Copy link
Member

ColinFay commented Jul 2, 2025

Thanks a lot 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants