Skip to content

Commit

Permalink
Update valid mobile task types for multiple (#5375)
Browse files Browse the repository at this point in the history
* Add failing test  for multiple and mobile section

* Update valid mobile task types for multiple
  • Loading branch information
mcbouslog authored and wgranger committed Jul 1, 2019
1 parent 4599e5b commit 443a7cd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
10 changes: 9 additions & 1 deletion app/pages/lab/mobile/mobile-section-container.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
Expand Down Expand Up @@ -82,6 +82,14 @@ const validatorFns = {
workflowNotTooManyShortcuts: workflowHasNoMoreThanXShortcuts(2),
workflowQuestionHasOneOrLessImages
},
multiple: {
taskQuestionNotTooLong,
taskFeedbackDisabled,
workflowFlipbookDisabled,
workflowHasSingleTask,
workflowNotTooManyShortcuts: workflowHasNoMoreThanXShortcuts(2),
workflowQuestionHasOneOrLessImages
},
drawing: {
taskFeedbackDisabled,
workflowFlipbookDisabled,
Expand Down
9 changes: 8 additions & 1 deletion app/pages/lab/mobile/mobile-section-container.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,17 @@ describe('<MobileSectionContainer />', function () {
shallow(<MobileSectionContainer task={fixtures.task()} workflow={fixtures.workflow()} project={fixtures.project()} />);
});

it('should render the <MobileSection /> component if the task type is single or multiple', function () {
it('should render the <MobileSection /> component if the task type is single', function () {
assert.strictEqual(component.length, 1);
});

it('should render the <MobileSection /> component if the task type is multiple', function () {
const task = fixtures.task({ type: 'multiple' });
wrapper = shallow(<MobileSectionContainer task={task} workflow={fixtures.workflow()} project={fixtures.project()} />);
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(<MobileSectionContainer task={task} workflow={fixtures.workflow()} project={fixtures.project()} />);
Expand Down

0 comments on commit 443a7cd

Please sign in to comment.