Skip to content

Commit

Permalink
Merge pull request #6 from edx/jwesson/remove-checkboxes
Browse files Browse the repository at this point in the history
refactor: remove checkboxes from second prompt
  • Loading branch information
jsnwesson committed Jun 30, 2023
2 parents 69fdc9a + 3d41da2 commit 54a3b29
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ import messages from './messages';

const JobTitleSelect = () => {
const { formatMessage } = useIntl();
const { state, dispatch, algolia } = useContext(SkillsBuilderContext);
const { dispatch, algolia } = useContext(SkillsBuilderContext);
const { searchClient } = algolia;
const { currentJobTitle } = state;

const handleCurrentJobTitleSelect = (value) => {
dispatch(setCurrentJobTitle(value));
Expand All @@ -31,20 +30,6 @@ const JobTitleSelect = () => {
);
};

const handleCheckboxChange = (e) => {
const { value } = e.target;
// only setCurrentJobTitle if the user hasn't selected a current job as we don't want to override their selection
if (!currentJobTitle) { dispatch(setCurrentJobTitle(value)); }

sendTrackEvent(
`edx.skills_builder.current_job.${value}`,
{
app_name: 'skills_builder',
category: 'skills_builder',
},
);
};

return (
<Stack>
<Form.Label>
Expand All @@ -59,19 +44,6 @@ const JobTitleSelect = () => {
/>
</InstantSearch>
</Form.Label>
<Form.Group>
<Form.CheckboxSet
name="other-occupations"
onChange={handleCheckboxChange}
>
<Form.Checkbox value="student">
{formatMessage(messages.studentCheckboxPrompt)}
</Form.Checkbox>
<Form.Checkbox value="looking_for_work">
{formatMessage(messages.currentlyLookingCheckboxPrompt)}
</Form.Checkbox>
</Form.CheckboxSet>
</Form.Group>
</Stack>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,6 @@ const messages = defineMessages({
defaultMessage: 'Search and select a job title',
description: 'Placeholder text for the job title input control.',
},
studentCheckboxPrompt: {
id: 'student.checkbox.prompt',
defaultMessage: 'I\'m a student',
description: 'Label text for the corresponding checkbox',
},
currentlyLookingCheckboxPrompt: {
id: 'currently.looking.checkbox.prompt',
defaultMessage: 'I\'m currently looking for work',
description: 'Label text for the corresponding checkbox',
},
careerInterestPrompt: {
id: 'career.interest.prompt',
defaultMessage: 'What careers are you interested in?',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ describe('select-preferences', () => {
payload: 'I want to advance my career',
type: 'SET_GOAL',
};
const expectedStudent = {
payload: 'student',
type: 'SET_CURRENT_JOB_TITLE',
};

const expectedJobTitle = {
payload: 'Prospector',
type: 'SET_CURRENT_JOB_TITLE',
Expand All @@ -47,16 +42,12 @@ describe('select-preferences', () => {
const goalSelect = screen.getByTestId('goal-select-dropdown');
fireEvent.change(goalSelect, { target: { value: 'I want to advance my career' } });

const checkbox = screen.getByRole('checkbox', { name: 'I\'m a student' });
fireEvent.click(checkbox);

const jobTitleInput = screen.getByTestId('job-title-select');
fireEvent.change(jobTitleInput, { target: { value: 'Prospector' } });
fireEvent.click(screen.getByRole('button', { name: 'Prospector' }));

expect(screen.getByText('Next, search and select your current job title')).toBeTruthy();
expect(dispatchMock).toHaveBeenCalledWith(expectedGoal);
expect(dispatchMock).toHaveBeenCalledWith(expectedStudent);
expect(dispatchMock).toHaveBeenCalledWith(expectedJobTitle);
expect(sendTrackEvent).toHaveBeenCalledWith(
'edx.skills_builder.goal.select',
Expand All @@ -68,13 +59,6 @@ describe('select-preferences', () => {
},
},
);
expect(sendTrackEvent).toHaveBeenCalledWith(
'edx.skills_builder.current_job.student',
{
app_name: 'skills_builder',
category: 'skills_builder',
},
);
expect(sendTrackEvent).toHaveBeenCalledWith(
'edx.skills_builder.current_job.select',
{
Expand Down

0 comments on commit 54a3b29

Please sign in to comment.