Skip to content

Commit

Permalink
Merge pull request #3 from bojant987/master
Browse files Browse the repository at this point in the history
Data-automation everywhere!
  • Loading branch information
MilosRasic authored Dec 28, 2017
2 parents 617c5cf + ce31680 commit 09186cd
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion DateTime.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ var Datetime = createClass({

return this.props.showTodayButton ? React.createElement(
'button',
{key: key, className: classes, onClick: isValid ? this.goToToday : undefined},
{key: key, className: classes, onClick: isValid ? this.goToToday : undefined, 'data-automation': 'actionSelectToday', 'data-status': isValid ? 'enabled' : 'disabled' },
'Today'
) : undefined;
},
Expand Down
10 changes: 6 additions & 4 deletions src/DaysView.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ var DateTimePickerDays = onClickOutside( createClass({
tableChildren = [
React.createElement('thead', { key: 'th' }, [
React.createElement('tr', { key: 'h' }, [
React.createElement('th', { key: 'p', className: 'rdtPrev', onClick: this.props.subtractTime( 1, 'months' )}, React.createElement('span', {}, '‹' )),
React.createElement('th', { key: 's', className: 'rdtSwitch', onClick: this.props.showView( 'months' ), colSpan: 5, 'data-value': this.props.viewDate.month() }, locale.months( date ) + ' ' + date.year() ),
React.createElement('th', { key: 'n', className: 'rdtNext', onClick: this.props.addTime( 1, 'months' )}, React.createElement('span', {}, '›' ))
React.createElement('th', { key: 'p', className: 'rdtPrev', onClick: this.props.subtractTime( 1, 'months' ), 'data-automation': 'actionPrevMonth'}, React.createElement('span', {}, '‹' )),
React.createElement('th', { key: 's', className: 'rdtSwitch', onClick: this.props.showView( 'months' ), 'data-automation': 'actionSwitchToMonthsView', colSpan: 5, 'data-value': this.props.viewDate.month() }, locale.months( date ) + ' ' + date.year() ),
React.createElement('th', { key: 'n', className: 'rdtNext', onClick: this.props.addTime( 1, 'months' ), 'data-automation': 'actionNextMonth'}, React.createElement('span', {}, '›' ))
]),
React.createElement('tr', { key: 'd'}, this.getDaysOfWeek( locale ).map( function( day, index ) { return React.createElement('th', { key: day + index, className: 'dow'}, day ); }) )
]),
Expand Down Expand Up @@ -92,7 +92,9 @@ var DateTimePickerDays = onClickOutside( createClass({
dayProps = {
key: prevMonth.format( 'M_D' ),
'data-value': prevMonth.date(),
className: classes
className: classes,
'data-automation': currentDate.year() + '_' + (currentDate.month() + 1) + '_' + currentDate.date(),
'data-status': classes.indexOf('rdtDisabled') === -1 ? 'enabled' : 'disabled'
};

if ( !isDisabled )
Expand Down
10 changes: 6 additions & 4 deletions src/MonthsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ var DateTimePickerMonths = onClickOutside( createClass({
render: function() {
return React.createElement('div', { className: 'rdtMonths' }, [
React.createElement('table', { key: 'a' }, React.createElement('thead', {}, React.createElement('tr', {}, [
React.createElement('th', { key: 'prev', className: 'rdtPrev', onClick: this.props.subtractTime( 1, 'years' )}, React.createElement('span', {}, '‹' )),
React.createElement('th', { key: 'year', className: 'rdtSwitch', onClick: this.props.showView( 'years' ), colSpan: 2, 'data-value': this.props.viewDate.year() }, this.props.viewDate.year() ),
React.createElement('th', { key: 'next', className: 'rdtNext', onClick: this.props.addTime( 1, 'years' )}, React.createElement('span', {}, '›' ))
React.createElement('th', { key: 'prev', className: 'rdtPrev', onClick: this.props.subtractTime( 1, 'years' ), 'data-automation': 'actionPrevYear'}, React.createElement('span', {}, '‹' )),
React.createElement('th', { key: 'year', className: 'rdtSwitch', onClick: this.props.showView( 'years' ), 'data-automation': 'actionSwitchToYearsView', colSpan: 2, 'data-value': this.props.viewDate.year() }, this.props.viewDate.year() ),
React.createElement('th', { key: 'next', className: 'rdtNext', onClick: this.props.addTime( 1, 'years' ), 'data-automation': 'actionNextYear'}, React.createElement('span', {}, '›' ))
]))),
React.createElement('table', { key: 'months' }, React.createElement('tbody', { key: 'b' }, this.renderMonths())),
this.props.renderTodayButton('todayMonths')
Expand Down Expand Up @@ -58,7 +58,9 @@ var DateTimePickerMonths = onClickOutside( createClass({
props = {
key: i,
'data-value': i,
className: classes
className: classes,
'data-automation': year + '_' + (i + 1),
'data-status': classes.indexOf('rdtDisabled') !== -1 ? 'enabled' : 'disabled'
};

if ( !isDisabled )
Expand Down
10 changes: 6 additions & 4 deletions src/YearsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ var DateTimePickerYears = onClickOutside( createClass({

return React.createElement('div', { className: 'rdtYears' }, [
React.createElement('table', { key: 'a' }, React.createElement('thead', {}, React.createElement('tr', {}, [
React.createElement('th', { key: 'prev', className: 'rdtPrev', onClick: this.props.subtractTime( 10, 'years' )}, React.createElement('span', {}, '‹' )),
React.createElement('th', { key: 'year', className: 'rdtSwitch', onClick: this.props.showView( 'years' ), colSpan: 2 }, year + '-' + ( year + 9 ) ),
React.createElement('th', { key: 'next', className: 'rdtNext', onClick: this.props.addTime( 10, 'years' )}, React.createElement('span', {}, '›' ))
React.createElement('th', { key: 'prev', className: 'rdtPrev', onClick: this.props.subtractTime( 10, 'years' ), 'data-automation': 'actionPrevDecade'}, React.createElement('span', {}, '‹' )),
React.createElement('th', { key: 'year', className: 'rdtSwitch', onClick: this.props.showView( 'years' ), 'data-automation': 'buttonTopView', colSpan: 2 }, year + '-' + ( year + 9 ) ),
React.createElement('th', { key: 'next', className: 'rdtNext', onClick: this.props.addTime( 10, 'years' ), 'data-automation': 'actionNextDecade'}, React.createElement('span', {}, '›' ))
]))),
React.createElement('table', { key: 'years' }, React.createElement('tbody', {}, this.renderYears( year ))),
this.props.renderTodayButton('todayYears')
Expand Down Expand Up @@ -65,7 +65,9 @@ var DateTimePickerYears = onClickOutside( createClass({
props = {
key: year,
'data-value': year,
className: classes
className: classes,
'data-automation': year,
'data-status': classes.indexOf('rdtDisabled') !== -1 ? 'enabled' : 'disabled'
};

if ( !isDisabled )
Expand Down

0 comments on commit 09186cd

Please sign in to comment.