Skip to content

Commit

Permalink
Removed UI validators from PrivacyTab validator callback
Browse files Browse the repository at this point in the history
This changes the privacy tab validation callback on only validation
profile fields, and not check UI state. This fixes a bug where default
values for the UI state could prevent the user from being able to save a
profile on the privacy tab.
  • Loading branch information
alicewriteswrongs committed Jun 24, 2016
1 parent fc56dd1 commit cdb2635
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
4 changes: 0 additions & 4 deletions static/js/components/PrivacyTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import {
combineValidators,
personalValidation,
educationValidation,
educationUiValidation,
employmentValidation,
employmentUiValidation,
privacyValidation,
} from '../util/validation';
import type { Profile } from '../flow/profileTypes';
Expand Down Expand Up @@ -50,9 +48,7 @@ class PrivacyTab extends ProfileFormFields {
combineValidators(
personalValidation,
educationValidation,
educationUiValidation,
employmentValidation,
employmentUiValidation,
privacyValidation
)
}
Expand Down
7 changes: 2 additions & 5 deletions static/js/containers/ProfilePage_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ describe("ProfilePage", function() {
});
});

it(`validates education and employment switches when saving the ${lastPage}`, () => {
it('does not validate education and employment switches when saving the privacy page', () => {
return renderComponent(lastPage).then(([, div]) => {
// close all switches and remove all education so we don't get validation errors
let receivedProfile = Object.assign({}, USER_PROFILE_RESPONSE, {
Expand All @@ -408,10 +408,7 @@ describe("ProfilePage", function() {
});

return confirmSaveButtonBehavior(updatedProfile, {button: button}, true).then(state => {
assert.deepEqual(state.profiles[SETTINGS.username].edit.errors, {
[`education_${HIGH_SCHOOL}_required`]: `High school is required if switch is set`,
work_history_required: "Work history is required if switch is set"
});
assert.deepEqual(state.profiles[SETTINGS.username].edit.errors, {});
});
});
});
Expand Down

0 comments on commit cdb2635

Please sign in to comment.