Skip to content

Commit

Permalink
return by value always,
Browse files Browse the repository at this point in the history
return by value always, removed comment, removed as.character
  • Loading branch information
siddhesh195 committed Jul 31, 2024
1 parent 30f8e49 commit 1e5c897
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
10 changes: 3 additions & 7 deletions tests/testthat/helper-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -417,14 +417,10 @@ find_test_path <- function(dir = ".") {
file.path(dir, ext_dir)
}

runtime_evaluate <- function(script=NULL,return.value=FALSE){
runtime_evaluate <- function(script=NULL){

eval.result<- remDr$Runtime$evaluate(script,returnByValue = TRUE)
if (return.value){
eval.result$result$value
}else{
eval.result
}

}

runtime_evaluate_helper <- function(class_name=NULL, id=NULL, list_num=NULL, dispatch_event=NULL, return.value=FALSE) {
Expand All @@ -441,5 +437,5 @@ runtime_evaluate_helper <- function(class_name=NULL, id=NULL, list_num=NULL, dis
script_template <- "document.getElementsByClassName('%s')[%d].dispatchEvent(new CustomEvent('click'));"
script <- sprintf(script_template,class_name,list_num)
}
runtime_evaluate(script = script, return.value = return.value)
runtime_evaluate(script = script)
}
8 changes: 4 additions & 4 deletions tests/testthat/test-renderer1-knit-print.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ get_circles <- function(html=getHTML()) {
}

get_elements <- function(id){
a<- runtime_evaluate_helper(id=as.character(id),class_name='show_hide_selector_widgets',list_num=0,return.value=TRUE)
b<- runtime_evaluate_helper(id=as.character(id),class_name='show_hide_selector_widgets',list_num=0,return.value=TRUE)
show_hide <- runtime_evaluate_helper(id=as.character(id),class_name='table.legend tr.label_variable',list_num=0,return.value=TRUE)
widget <- runtime_evaluate_helper(id=as.character(id),class_name='table.legend tr.label_variable',list_num=1,return.value=TRUE)
a<- runtime_evaluate_helper(id=id,class_name='show_hide_selector_widgets',list_num=0,return.value=TRUE)
b<- runtime_evaluate_helper(id=id,class_name='show_hide_selector_widgets',list_num=0,return.value=TRUE)
show_hide <- runtime_evaluate_helper(id=id,class_name='table.legend tr.label_variable',list_num=0,return.value=TRUE)
widget <- runtime_evaluate_helper(id=id,class_name='table.legend tr.label_variable',list_num=1,return.value=TRUE)
list(a178=a,
b934=b,
show_hide=show_hide,
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test-renderer2-widerect.R
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ test_that("pause stops animation (third time)", {
expect_true(old.year == new.year)
})

#runtime_evaluate(script="document.getElementsByClassName('show_hide_selector_widgets')[0].dispatchEvent(new CustomEvent('click'));")
runtime_evaluate_helper(class_name="show_hide_selector_widgets",list_num=0,dispatch_event=TRUE)
clickSelector("year_variable_selector_widget")
sendKey("Backspace", "Backspace", 8)
Expand Down

0 comments on commit 1e5c897

Please sign in to comment.