From 443a7cd82b3a874330b01c166a1456ed49d2dd3e Mon Sep 17 00:00:00 2001 From: Mark Bouslog Date: Mon, 1 Jul 2019 10:57:53 -0500 Subject: [PATCH] Update valid mobile task types for multiple (#5375) * Add failing test for multiple and mobile section * Update valid mobile task types for multiple --- app/pages/lab/mobile/mobile-section-container.jsx | 10 +++++++++- app/pages/lab/mobile/mobile-section-container.spec.js | 9 ++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/pages/lab/mobile/mobile-section-container.jsx b/app/pages/lab/mobile/mobile-section-container.jsx index 7f7d293d23..a40b972ac1 100644 --- a/app/pages/lab/mobile/mobile-section-container.jsx +++ b/app/pages/lab/mobile/mobile-section-container.jsx @@ -7,7 +7,7 @@ import MobileSection from './mobile-section'; import ValidationValue, { convertBooleanToValidation } from './mobile-validations'; const VALID_QUESTION_LENGTH = 200; -const VALID_TASK_TYPES_FOR_MOBILE = ['single', 'drawing']; +const VALID_TASK_TYPES_FOR_MOBILE = ['single', 'multiple', 'drawing']; const MARKDOWN_IMAGE = /!\[[^\]]*](:?\([^)]*\)|\[[^\]]*])/g; function taskQuestionNotTooLong({ task }) { @@ -82,6 +82,14 @@ const validatorFns = { workflowNotTooManyShortcuts: workflowHasNoMoreThanXShortcuts(2), workflowQuestionHasOneOrLessImages }, + multiple: { + taskQuestionNotTooLong, + taskFeedbackDisabled, + workflowFlipbookDisabled, + workflowHasSingleTask, + workflowNotTooManyShortcuts: workflowHasNoMoreThanXShortcuts(2), + workflowQuestionHasOneOrLessImages + }, drawing: { taskFeedbackDisabled, workflowFlipbookDisabled, diff --git a/app/pages/lab/mobile/mobile-section-container.spec.js b/app/pages/lab/mobile/mobile-section-container.spec.js index d473564d84..f0b99c466a 100644 --- a/app/pages/lab/mobile/mobile-section-container.spec.js +++ b/app/pages/lab/mobile/mobile-section-container.spec.js @@ -47,10 +47,17 @@ describe('', function () { shallow(); }); - it('should render the component if the task type is single or multiple', function () { + it('should render the component if the task type is single', function () { assert.strictEqual(component.length, 1); }); + it('should render the component if the task type is multiple', function () { + const task = fixtures.task({ type: 'multiple' }); + wrapper = shallow(); + const mobileSection = wrapper.find('MobileSection').first(); + assert.strictEqual(mobileSection.length, 1); + }); + it('should render nothing if the task type isn\'t single or multiple or drawing', function () { const task = fixtures.task({ type: 'survey' }); wrapper = shallow();