-
-
Notifications
You must be signed in to change notification settings - Fork 6
Fixes integrations tests using wait_for_js implementation for visibility
#673
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
base: main
Are you sure you want to change the base?
Conversation
Unit Tests Summary 1 files 31 suites 42s ⏱️ Results for commit b5f6bca. ♻️ This comment has been updated with latest results. |
Code Coverage SummaryDiff against mainResults for commit: b5f6bca Minimum allowed coverage is ♻️ This comment has been updated with latest results |
Unit Test Performance Difference
Results for commit 51ecc4c ♻️ This comment has been updated with latest results. |
| checkmate::assert( | ||
| .var.name = "selector", | ||
| combine = "and", | ||
| checkmate::check_string(selector), | ||
| if (grepl("[\"]", selector)) "Cannot contain double quotes (\") in CSS selectors" else TRUE | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about introducing such a function that check for double quotes for JS
escape_js_selector <- function(selector) {
# Escape backslashes first, then quotes
selector <- gsub("\\", "\\\\", selector, fixed = TRUE)
selector <- gsub('"', '\\"', selector, fixed = TRUE)
selector
}
m7pr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, left just one comment that maybe we can introduce
escape_js_selector <- function(selector) {
selector <- gsub("\\", "\\\\", selector, fixed = TRUE)
selector <- gsub('"', '\\"', selector, fixed = TRUE)
selector
}so that some functions could be simplified to
click_button_js <- function(selector) {
checkmate::assert(
.var.name = "selector",
combine = "and",
checkmate::check_string(selector)
)
selector_escaped <- escape_js_selector(selector)
sprintf("(btn = document.querySelector(\"%s\")) ? (btn.click(), true) : false;", selector_escaped)
}
Pull Request
Changes description
teal.widgetsandteal