Standard element commands
Commands that are defined for all PennController element types.
Action commands
table of contents
Test commands
table of contents
standard.after
syntax
getX(“ELEMENT_NAME”).after(getX(“ARGUMENT_NAME”))
description
Takes an element as an argument, and adds that element’s content to the right of the element that the command is called on.
example
click to expand
@// Option 1: Pass a new element as an argument
@newTrial("option-1",
@ newText("center", "BANANA")
@ .before(newText("left", "apple"))
$ .after(newText("right", "orange"))
@ .print()
@)
@
@// Option 2: Pass an existing element as an argument
@newTrial("option-2",
@ newText("left", "apple")
@ ,
@ newText("right", "orange")
@ ,
@ newText("center", "BANANA")
@ .before(getText("left"))
$ .after(getText("right"))
@ .print()
@)
↳ Prints appleBANANAorange
to the screen.
standard.before
syntax
getX(“ELEMENT_NAME”).before(getX(“ARGUMENT_NAME”))
description
Takes an element as an argument, and adds that element’s content to the left of the element that the command is called on.
example
click to expand
@// Option 1: Pass a new element as an argument
@newTrial("option-1",
@ newText("center", "BANANA")
$ .before(newText("left", "apple"))
@ .after(newText("right", "orange"))
@ .print()
@)
@
@// Option 2: Pass an existing element as an argument
@newTrial("option-2",
@ newText("left", "apple")
@ ,
@ newText("right", "orange")
@ ,
@ newText("center", "BANANA")
$ .before(getText("left"))
@ .after(getText("right"))
@ .print()
@)
↳ Prints appleBANANAorange
to the screen.
standard.bold
syntax
getX(“ELEMENT_NAME”).bold()
description
Bolds any text that appears in the element.
example
click to expand
@newText("bolded-text", "Hello, text!")
$ .bold()
@ .print()
*,
@newButton("bolded-button", "Hello, button!")
$ .bold()
@ .print()
↳ Prints Hello, text!
in bold, then prints a button that says Hello, button!
in bold on a new line.
standard.center
syntax
getX(“ELEMENT_NAME”).center()
description
Horizontally centers the element.
example
click to expand
@newButton("centered-button", "Hello, button!")
$ .center()
@ .print()
↳ Prints a horizontally centered button that says Hello, button!
.
standard.css
syntax
getX(“ELEMENT_NAME”).css(“CSS_PROPERTY”, “VALUE”)
description
Applies the specified CSS property and value pair to the element.
example
click to expand
@newText("framed-text", "Hello, text!")
$ .css("border", "solid 1px red")
@ .print()
*,
@newButton("orchid-smallcaps-button", "Hello, button!")
$ .css({"background-color":"orchid", "font-variant":"small-caps"})
@ .print()
↳ Prints Hello, text!
surrounded by a 1px solid red border. On a new line, prints a button with an orchid background color that says Hello, button!
in small caps.
optional parameters
-
getX(“ELEMENT_NAME”).css({“CSS_PROPERTY_1”:”VALUE_1”, “CSS_PROPERTY_2”:”VALUE_2”})
standard.cssContainer
syntax
getX(“ELEMENT_NAME”).cssContainer(“CSS_PROPERTY”, “VALUE”)
description
Applies the specified CSS property and value pair to the container of the element.
example
click to expand
newText("center", "BANANA")
.before(newText("left", "apple"))
.after(newText("right", "orange"))
.css("color", "red")
.cssContainer("background-color", "aqua")
.print()
↳ Prints appleBANANAorange
to the screen. The substring BANANA
has a red text color, and the entire string has an aqua background color.
optional parameters
-
getX(“ELEMENT_NAME”).cssContainer({“CSS_PROPERTY_1”:”VALUE_1”, “CSS_PROPERTY_2”:”VALUE_2”})
standard.disable
syntax
getX(“ELEMENT_NAME”).disable()
description
Disables any interactive feature of the element.
example
click to expand
@// example
standard.enable
syntax
getX(“ELEMENT_NAME”).enable()
description
Enables any interactive feature that was previously disabled.
example
click to expand
// example
standard.hidden
standard.left
syntax
getX(“ELEMENT_NAME”).left()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
standard.log
syntax
getX(“ELEMENT_NAME”).log()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
standard.print
syntax
getX(“ELEMENT_NAME”).print()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
standard.refresh
syntax
getX(“ELEMENT_NAME”).refresh()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
standard.remove
syntax
getX(“ELEMENT_NAME”).remove()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
standard.right
syntax
getX(“ELEMENT_NAME”).right()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
standard.scaling
syntax
getX(“ELEMENT_NAME”).scaling()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
that zooms an element in/out to fit the argument(s), which can be: a ratio (with 1 for 100%), a unit dimension (eg. “10vw”), or the page/screen (pass "page"
)
standard.selector
syntax
getX(“ELEMENT_NAME”).selector()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
standard.setVar
syntax
getX(“ELEMENT_NAME”).setVar()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
standard.size
syntax
getX(“ELEMENT_NAME”).size()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example
standard.visible
syntax
getX(“ELEMENT_NAME”).visible()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
@newText("hidden-text", "Surprise!")
@ .hidden()
@ .print()
*,
@newButton("reveal", "Click to reveal a surprise")
@ .print()
@ .wait()
*,
@getText("hidden-text")
$ .visible()
↳ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
standard.test.printed
syntax
getX(“ELEMENT_NAME”).test.printed()
description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
example
click to expand
// example