PennController for IBEX › Forums › Support › How to test whether multiple elements were selected?
Tagged: multiple tests
- This topic has 1 reply, 2 voices, and was last updated 2 years, 11 months ago by Jeremy.
-
AuthorPosts
-
October 29, 2021 at 6:28 am #7453rhododendronParticipant
Hello,
I am currently trying to implement three scales as a post-sentence comprehension task. Ideally, participants should not be able to proceed unless they made selections on each scale. So far, my implementation does only work for one scale, while all other scales are ignored. So far I have attempted to use a button press to check all three scales:
newButton("validation", "Confirm") .settings.center() .print() .wait( getScale("comprehensibility_prac3","comprehensibility_prac2","comprehensibility_prac" ).test.selected() .failure( newText("timedout","<b>Please rate the sentence using the scale!</b>") .settings.css("font-size", "19px") .settings.css("font-family","times-new") .settings.color("red") .settings.center() .print() ) )
I have also tried to nest the tests, but it did not work:
newButton("validation", "Confirm") .settings.center() .print() .wait( getScale("comprehensibility_prac3" ).test.selected() .failure( newText("timedout","<b>Please rate the sentence using the scale!</b>") .settings.css("font-size", "19px") .settings.css("font-family","times-new") .settings.color("red") .settings.center() .print() ) .success( getScale("comprehensibility_prac2").test.selected() .failure( newText("timedout","<b>Please rate the sentence using the scale!</b>") .settings.css("font-size", "19px") .settings.css("font-family","times-new") .settings.color("red") .settings.center() .print() ) ) )
Any suggestions would be very much appreciated.
Best,
Ana-Maria
November 2, 2021 at 12:54 pm #7463JeremyKeymasterHello Ana-Maria,
Your reasoning is on the right track, but things work slightly differently: tests embedded in a
success
command won’t count as conjoined to the main test. For that, you have theand
command. You can do this:newTrial( newScale("comprehensibility_prac1", 8).print(), newScale("comprehensibility_prac2", 8).print(), newScale("comprehensibility_prac3", 8).print() , newButton("validation", "Confirm") .center() .print() .wait( getScale("comprehensibility_prac3" ).test.selected() .and( getScale("comprehensibility_prac2").test.selected() ) .and( getScale("comprehensibility_prac1").test.selected() ) .failure( newText("timedout","<b>Please use all the scales!</b>") .css("font-size", "19px") .css("font-family","times-new") .color("red") .center() .print() ) ) )
Note that the error message will appear whenever any scale is unselected
If you want scale-specific messages, you could conjoin all three tests to a main test, so you can apply test-specific failures:
newTrial( newScale("comprehensibility_prac1", 8).print(), newScale("comprehensibility_prac2", 8).print(), newScale("comprehensibility_prac3", 8).print() , defaultText .css("font-size", "19px") .css("font-family","times-new") .color("red") .center() , newButton("validation", "Confirm") .center() .print() .wait( newVar("dummy", 1).test.is(1) .and( getScale("comprehensibility_prac3" ).test.selected().failure( newText("timedout3","<b>Please use scale 3!</b>").print() ) ) .and( getScale("comprehensibility_prac2" ).test.selected().failure( newText("timedout2","<b>Please use scale 2!</b>").print() ) ) .and( getScale("comprehensibility_prac1" ).test.selected().failure( newText("timedout1","<b>Please use scale 1!</b>").print() ) ) ) )
Jeremy
-
AuthorPosts
- You must be logged in to reply to this topic.