From 8b4c39fecd704f7c659ec75af012980bdcb6c670 Mon Sep 17 00:00:00 2001 From: Bojan Todorovic Date: Wed, 27 Dec 2017 17:33:10 +0100 Subject: [PATCH] data-automation everywhere --- DateTime.js | 2 +- src/DaysView.js | 10 ++++++---- src/MonthsView.js | 10 ++++++---- src/YearsView.js | 10 ++++++---- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/DateTime.js b/DateTime.js index 1ab602748..ad90e2528 100644 --- a/DateTime.js +++ b/DateTime.js @@ -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; }, diff --git a/src/DaysView.js b/src/DaysView.js index b10d3e3f4..3f21ecebe 100644 --- a/src/DaysView.js +++ b/src/DaysView.js @@ -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 ); }) ) ]), @@ -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 ) diff --git a/src/MonthsView.js b/src/MonthsView.js index 0666cbcd1..b7896487e 100644 --- a/src/MonthsView.js +++ b/src/MonthsView.js @@ -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') @@ -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 ) diff --git a/src/YearsView.js b/src/YearsView.js index ac050c992..5ba26beb6 100644 --- a/src/YearsView.js +++ b/src/YearsView.js @@ -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') @@ -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 )