-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AD-200 Added testId props for React elements. Added names of ids.
- Loading branch information
Showing
5 changed files
with
78 additions
and
24 deletions.
There are no files selected for viewing
19 changes: 16 additions & 3 deletions
19
...webroot/_ui/responsive/common/js/adyen-checkout/src/components/controls/InputCheckbox.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 16 additions & 3 deletions
19
...web/webroot/_ui/responsive/common/js/adyen-checkout/src/components/controls/InputText.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,34 @@ | ||
import React from "react"; | ||
import {isNotEmpty} from "../../util/stringUtil"; | ||
|
||
|
||
interface InputTextProps { | ||
testId?: string | ||
fieldName: string | ||
value?: string | ||
onChange: (value: string) => void | ||
} | ||
|
||
export class InputText extends React.Component<InputTextProps, null> { | ||
|
||
private renderInput(): React.JSX.Element { | ||
if (isNotEmpty(this.props.testId)) { | ||
return <input id={this.props.testId} | ||
className={"form-input_input form-control"} type={"text"} | ||
onChange={(event) => this.props.onChange(event.target.value)} value={this.props.value}/> | ||
} | ||
|
||
return <input className={"form-input_input form-control"} type={"text"} | ||
onChange={(event) => this.props.onChange(event.target.value)} value={this.props.value}/> | ||
|
||
} | ||
|
||
render() { | ||
return ( | ||
<div className={"form-group"}> | ||
<label className={"form-input_name control-label"}>{this.props.fieldName}</label> | ||
<input className={"form-input_input form-control"} type={"text"} | ||
onChange={(event) => this.props.onChange(event.target.value)} value={this.props.value} /> | ||
</div> | ||
{this.renderInput()} | ||
</div> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters