Description Public fields Active bindings Methods Examples
An R6 class suitable for testing that simulates the session parameter
provided to Shiny server functions or modules.
envThe environment associated with the session.
singletonsHardcoded as empty. Needed for rendering HTML (i.e. renderUI)
clientDataMock client data that always returns a size for plots
outputThe shinyoutputs associated with the session
inputThe reactive inputs associated with the session
userDataAn environment initialized as empty.
progressStackA stack of progress objects
returnedThe value returned from the module
requestAn empty environment where the request should be. The request isn't meaningfully mocked currently.
reactlog()No-op
MockShinySession$reactlog(logEntry)
logEntryNot used
incrementBusyCount()No-op
MockShinySession$incrementBusyCount()
new()Create a new MockShinySession
MockShinySession$new()
onFlush()Define a callback to be invoked before a reactive flush
MockShinySession$onFlush(fun, once = TRUE)
funThe function to invoke
onceIf TRUE, will only run once. Otherwise, will run every time reactives are flushed.
onFlushed()Define a callback to be invoked after a reactive flush
MockShinySession$onFlushed(fun, once = TRUE)
funThe function to invoke
onceIf TRUE, will only run once. Otherwise, will run every time reactives are flushed.
onEnded()Define a callback to be invoked when the session ends
MockShinySession$onEnded(sessionEndedCallback)
sessionEndedCallbackThe callback to invoke when the session has ended.
isEnded()Returns FALSE if the session has not yet been closed
MockShinySession$isEnded()
isClosed()Returns FALSE if the session has not yet been closed
MockShinySession$isClosed()
close()Closes the session
MockShinySession$close()
cycleStartAction()Unsophisticated mock implementation that merely invokes the given callback immediately.
MockShinySession$cycleStartAction(callback)
callbackThe callback ato be invoked.
fileUrl()Base64-encode the given file. Needed for image rendering.
MockShinySession$fileUrl(name, file, contentType = "application/octet-stream")
nameNot used
fileThe file to be encoded
contentTypeThe content type of the base64-encoded string
setInputs()Sets reactive values associated with the session$inputs object
and flushes the reactives.
MockShinySession$setInputs(...)
...The inputs to set.
s <- MockShinySession$new() s$setInputs(x=1, y=2)
.scheduleTask()An internal method which shouldn't be used by others.
MockShinySession$.scheduleTask(millis, callback)
millisThe number of milliseconds on which to schedule a callback
callbackThe function to schedule
elapse()Simulate the passing of time by the given number of milliseconds.
MockShinySession$elapse(millis)
millisThe number of milliseconds to advance time.
.now()An internal method which shouldn't be used by others.
MockShinySession$.now()
defineOutput()An internal method which shouldn't be used by others.
MockShinySession$defineOutput(name, func, label)
nameThe name of the output
funcThe render definition
labelNot used
getOutput()An internal method which shouldn't be used by others.
MockShinySession$getOutput(name)
nameThe name of the output
registerDataObj()No-op
MockShinySession$registerDataObj(name, data, filterFunc)
nameNot used
dataNot used
filterFuncNot used
allowReconnect()No-op
MockShinySession$allowReconnect(value)
valueNot used
reload()No-op
MockShinySession$reload()
resetBrush()No-op
MockShinySession$resetBrush(brushId)
brushIdNot used
sendCustomMessage()No-op
MockShinySession$sendCustomMessage(type, message)
typeNot used
messageNot used
sendBinaryMessage()No-op
MockShinySession$sendBinaryMessage(type, message)
typeNot used
messageNot used
sendInputMessage()No-op
MockShinySession$sendInputMessage(inputId, message)
inputIdNot used
messageNot used
setBookmarkExclude()No-op
MockShinySession$setBookmarkExclude(names)
namesNot used
getBookmarkExclude()No-op
MockShinySession$getBookmarkExclude()
onBookmark()No-op
MockShinySession$onBookmark(fun)
funNot used
onBookmarked()No-op
MockShinySession$onBookmarked(fun)
funNot used
doBookmark()No-op
MockShinySession$doBookmark()
onRestore()No-op
MockShinySession$onRestore(fun)
funNot used
onRestored()No-op
MockShinySession$onRestored(fun)
funNot used
exportTestValues()No-op
MockShinySession$exportTestValues()
getTestSnapshotUrl()No-op
MockShinySession$getTestSnapshotUrl( input = TRUE, output = TRUE, export = TRUE, format = "json" )
inputNot used
outputNot used
exportNot used
formatNot used
ns()Returns the given id prefixed by mock-session-.
MockShinySession$ns(id)
idThe id to modify.
flushReact()Trigger a reactive flush right now.
MockShinySession$flushReact()
makeScope()MockShinySession$makeScope(namespace)
clone()The objects of this class are cloneable with this method.
MockShinySession$clone(deep = FALSE)
deepWhether to make a deep clone.
1 2 3 4 5 6 | ## ------------------------------------------------
## Method `MockShinySession$setInputs`
## ------------------------------------------------
s <- MockShinySession$new()
s$setInputs(x=1, y=2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.