tests/testthat/test-surveyOutput-paged_questions.R

paged_teaching_r_questions <- data.frame(
  stringsAsFactors = FALSE,
  question = c("What's your age?",
               "Which best describes your gender?",
               "Which best describes your gender?","Which best describes your gender?",
               "Which best describes your gender?",
               "Which best describes your gender?",
               "What is the highest level of education you have attained?",
               "What is the highest level of education you have attained?",
               "What is the highest level of education you have attained?",
               "What is the highest level of education you have attained?",
               "What is the highest level of education you have attained?",
               "What is the highest level of education you have attained?",
               "What was your first language?","What was your first language?",
               "What was your first language?","What was your first language?",
               "What was your first language?","What was your first language?",
               "What was your first language?",
               "What was your first language?","What was your first language?",
               "What was your first language?","What was your first language?",
               "What was your first language?","What was your first language?",
               "What was your first language?",
               "What was your first language?","In what language do you read most often?",
               "In what language do you read most often?",
               "In what language do you read most often?",
               "In what language do you read most often?","In what language do you read most often?",
               "In what language do you read most often?",
               "In what language do you read most often?",
               "In what language do you read most often?",
               "In what language do you read most often?","In what language do you read most often?",
               "In what language do you read most often?",
               "In what language do you read most often?",
               "In what language do you read most often?","In what language do you read most often?",
               "In what language do you read most often?",
               "Have you ever learned to program in R?",
               "Have you ever learned to program in R?",
               "If yes, how many years have you been using R?",
               "Have you ever learned a programming language (other than R)?",
               "Have you ever learned a programming language (other than R)?",
               "If yes, which language(s) and how many years have you been using each language?",
               "Have you ever completed a data analysis?",
               "Have you ever completed a data analysis?",
               "If yes, approximately how many data analyses have you completed?",
               "If yes, approximately how many data analyses have you completed?",
               "If yes, approximately how many data analyses have you completed?",
               "If yes, approximately how many data analyses have you completed?"),
  option = c("25","Female","Male",
             "Prefer not to say","Prefer to self describe",NA,
             "Did not attend high school","Some high school",
             "High school graduate","Some college","College","Graduate Work","Arabic",
             "Armenian","Chinese","English","French","Creole",
             "German","Greek","Gujarati","Hebrew","Hindi",
             "Italian","Japanese","Other",NA,"Arabic","Armenian",
             "Chinese","English","French","Creole","German","Greek",
             "Gujarati","Hebrew","Hindi","Italian","Japanese",
             "Other",NA,"Yes","No","5","Yes","No",NA,"Yes","No",
             "0 to 5","5 to 10","10 to 15","15+"),
  input_type = c("numeric","mc","mc","mc",
                 "mc","text","select","select","select","select",
                 "select","select","select","select","select","select",
                 "select","select","select","select","select","select",
                 "select","select","select","select","text","select",
                 "select","select","select","select","select",
                 "select","select","select","select","select","select",
                 "select","select","text","y/n","y/n","numeric","y/n",
                 "y/n","text","y/n","y/n","mc","mc","mc","mc"),
  input_id = c("age","gender","gender",
               "gender","gender","self_describe_gender",
               "education_attained","education_attained","education_attained",
               "education_attained","education_attained","education_attained",
               "first_language","first_language","first_language",
               "first_language","first_language","first_language",
               "first_language","first_language","first_language",
               "first_language","first_language","first_language",
               "first_language","first_language","first_language_other",
               "read_language","read_language","read_language",
               "read_language","read_language","read_language","read_language",
               "read_language","read_language","read_language",
               "read_language","read_language","read_language","read_language",
               "read_language_other","learned_r","learned_r",
               "years_using_r","learned_programming_not_r",
               "learned_programming_not_r","years_programming_not_r",
               "completed_data_analysis","completed_data_analysis",
               "number_completed_data_analysis","number_completed_data_analysis",
               "number_completed_data_analysis","number_completed_data_analysis"),
  dependence = c(NA,NA,NA,NA,NA,"gender",
                 NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,
                 NA,NA,NA,NA,NA,"first_language",NA,NA,NA,NA,
                 NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,"read_language",
                 NA,NA,"learned_r",NA,NA,"learned_programming_not_r",
                 NA,NA,"completed_data_analysis",
                 "completed_data_analysis","completed_data_analysis","completed_data_analysis"),
  dependence_value = c(NA,NA,NA,NA,NA,
                       "Prefer to self describe",NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,
                       NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,"Other",NA,NA,
                       NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,"Other",
                       NA,NA,"Yes",NA,NA,"Yes",NA,NA,"Yes","Yes","Yes",
                       "Yes"),
  required = c(TRUE,TRUE,TRUE,TRUE,TRUE,
               FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,
               FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,
               FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,
               FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,
               FALSE,FALSE,FALSE,FALSE,TRUE,TRUE,FALSE,TRUE,
               TRUE,FALSE,TRUE,TRUE,FALSE,FALSE,FALSE,FALSE),
  page = c("intro","intro","intro",
           "intro","intro","intro","intro","intro","intro","intro",
           "intro","intro","mid","mid","mid","mid","mid",
           "mid","mid","mid","mid","mid","mid","mid","mid",
           "mid","mid","mid","mid","mid","mid","mid","mid",
           "mid","mid","mid","mid","mid","mid","mid","mid","mid",
           "finale","finale","finale","finale","finale",
           "finale","finale","finale","finale","finale","finale",
           "finale")
)

test_that("surveyOutput() works - paged_questions", {
  local_edition(3)
  expect_snapshot_output(shiny::fluidPage(
    shinysurveys::surveyOutput(df = paged_teaching_r_questions,
                               survey_title = "Test This MultiPaged Survey")
  ))
})

Try the shinysurveys package in your browser

Any scripts or data that you put into this service are public.

shinysurveys documentation built on July 11, 2021, 9:06 a.m.