text.test.text
description
Tests whether the text matches the string (identical, case-sensitive) or the regular expression.
syntax
getText(ELEMENT_NAME).test.text(string)
-
string
:
alternate(s)
-
getText(ELEMENT_NAME).test.text( /RegExp/ )
example(s)
@newTrial(
@ newText("q1", "What's up?")
@ .print()
@ ,
@ getText(q1)
$ .test.text( "Hi" )
@)
-
Adds a text to the screen and then tests if it is equal to the string “Hi” .
@Template( row => @ newTrial( @ newText(“sentence”, row.Text ).print() @ , @ newImage( row.Image ).print() @ , $ getText(“sentence”) $ .test.text( /\?$/ ) $ .success( newKey(“fj”).log().wait() ) $ .failure( newTimer(1000).start().wait() ) @ ) @) </code></pre>
- Prints a Text element named sentence onto the page using the text from the current table row’s Text column, and below it an Image element using the filename from the current table row’s Image column. Then, tests whether the text content of the sentence Text element ends with a
?
character: if it does, the script waits for a keypress onF
orJ
, otherwise it waits 1s before moving on to the next trial.