Update tests

pull/888/head
Rick Carlino 2018-06-15 08:59:59 -05:00
parent a2aca364dd
commit 36084c7012
2 changed files with 3 additions and 8 deletions

View File

@ -154,12 +154,6 @@ describe("<FrontPage />", () => {
}
}
}
const loginPassword = setField("loginPassword", spy)
const event1 = fakeEv({ defaultValue: "pw12" });
const expected1 = {loginPassword: event1.currentTarget.defaultValue};
loginPassword(event1);
expect(spy).toHaveBeenCalledWith(expected1);
jest.resetAllMocks();
const agreeToTerms = setField("agreeToTerms", spy)
const event2 = fakeEv({ checked: false });
@ -171,7 +165,7 @@ describe("<FrontPage />", () => {
const regName = setField("regName", spy)
const event3 = fakeEv({ value: "hello!" });
const expected3 = {regName: event3.currentTarget.value};
const expected3 = { regName: event3.currentTarget.value };
regName(event3);
expect(spy).toHaveBeenCalledWith(expected3);
jest.resetAllMocks();

View File

@ -44,7 +44,8 @@ export class BlurableInput extends React.Component<BIProps, Partial<BIState>> {
const shouldPassToParent = this.state.buffer || (this.props.allowEmpty);
shouldPassToParent && this.props.onCommit(e);
this.setState({ isEditing: false, buffer: "" });
e.currentTarget.setAttribute("value", ""); // Clear password fields
const isPw = (this.props.type === "password");
isPw && e.currentTarget.setAttribute("value", "");
}
focus = () => {