File tree Expand file tree Collapse file tree
src/editors/containers/ProblemEditor/components/EditProblemView Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ export const useFeedback = (answer) => {
9090} ;
9191
9292export const isSingleAnswerProblem = ( problemType ) => (
93- problemType === ProblemTypeKeys . DROPDOWN
93+ problemType === ProblemTypeKeys . SINGLESELECT || problemType === ProblemTypeKeys . DROPDOWN
9494) ;
9595
9696export const useAnswerContainer = ( { answers, updateField } ) => {
Original file line number Diff line number Diff line change @@ -200,7 +200,7 @@ describe('Answer Options Hooks', () => {
200200 } ) ;
201201 describe ( 'isSingleAnswerProblem()' , ( ) => {
202202 test ( 'singleSelect' , ( ) => {
203- expect ( module . isSingleAnswerProblem ( ProblemTypeKeys . SINGLESELECT ) ) . toBe ( false ) ;
203+ expect ( module . isSingleAnswerProblem ( ProblemTypeKeys . SINGLESELECT ) ) . toBe ( true ) ;
204204 } ) ;
205205 test ( 'multiSelect' , ( ) => {
206206 expect ( module . isSingleAnswerProblem ( ProblemTypeKeys . MULTISELECT ) ) . toBe ( false ) ;
Original file line number Diff line number Diff line change @@ -299,9 +299,9 @@ export const typeRowHooks = ({
299299 if ( typeKey === ProblemTypeKeys . TEXTINPUT && RichTextProblems . includes ( problemType ) ) {
300300 convertToPlainText ( ) ;
301301 }
302- // Dropdown problems can only have one correct answer. When there is more than one correct answer
302+ // Dropdown and single-select problems can only have one correct answer. When there is more than one correct answer
303303 // from a previous problem type, the correct attribute for selected answers need to be set to false.
304- if ( typeKey === ProblemTypeKeys . DROPDOWN ) {
304+ if ( typeKey === ProblemTypeKeys . DROPDOWN || typeKey === ProblemTypeKeys . SINGLESELECT ) {
305305 if ( correctAnswerCount > 1 ) {
306306 clearPreviouslySelectedAnswers ( ) ;
307307 } else if ( RichTextProblems . includes ( problemType ) ) {
You can’t perform that action at this time.
0 commit comments