SwitchDateTestCase Class — react Architecture
Architecture documentation for the SwitchDateTestCase class in switch-date-test-case.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 236c3101_dd6d_7152_7afd_f0ae0f1d05a9["SwitchDateTestCase"] 595c8d7b_f848_6c78_07aa_cf8e45db9dd6["switch-date-test-case.js"] 236c3101_dd6d_7152_7afd_f0ae0f1d05a9 -->|defined in| 595c8d7b_f848_6c78_07aa_cf8e45db9dd6 8b610976_d7e3_8922_8102_25962696a919["render()"] 236c3101_dd6d_7152_7afd_f0ae0f1d05a9 -->|method| 8b610976_d7e3_8922_8102_25962696a919 b4eda0c4_31c9_5c95_1255_0a973f8a231b["inputAttrs()"] 236c3101_dd6d_7152_7afd_f0ae0f1d05a9 -->|method| b4eda0c4_31c9_5c95_1255_0a973f8a231b
Relationship Graph
Source Code
fixtures/dom/src/components/fixtures/date-inputs/switch-date-test-case.js lines 8–65
class SwitchDateTestCase extends React.Component {
state = {
fullDate: false,
date: startDate,
};
render() {
const attrs = this.inputAttrs();
return (
<div>
<p>
<b>{attrs.type}</b> input type ({attrs.value})
</p>
<p>
<input
type={attrs.type}
value={attrs.value}
onChange={this.onInputChange}
/>
<label>
<input
type="checkbox"
checked={this.state.fullDate}
onChange={this.updateFullDate}
/>{' '}
Switch type
</label>
</p>
</div>
);
}
inputAttrs() {
if (this.state.fullDate) {
return {
type: 'datetime-local',
value: this.state.date.toISOString().replace(/\..*Z/, ''),
};
} else {
return {
type: 'date',
value: this.state.date.toISOString().replace(/T.*/, ''),
};
}
}
onInputChange = ({target: {value}}) => {
const date = value ? new Date(Date.parse(value)) : startDate;
this.setState({date});
};
updateFullDate = () => {
this.setState({
fullDate: !this.state.fullDate,
});
};
}
Domain
Source
Frequently Asked Questions
What is the SwitchDateTestCase class?
SwitchDateTestCase is a class in the react codebase, defined in fixtures/dom/src/components/fixtures/date-inputs/switch-date-test-case.js.
Where is SwitchDateTestCase defined?
SwitchDateTestCase is defined in fixtures/dom/src/components/fixtures/date-inputs/switch-date-test-case.js at line 8.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free