Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/DateTimePickerHours.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default class DateTimePickerHours extends Component {
<tbody>
<tr>
<td>
<a onClick={this.props.onSwitch} data-action="togglePicker" title="Select Time">
<a className="togglePicker" onClick={this.props.onSwitch} data-action="togglePicker" title="Select Time">
<Glyphicon glyph="time" />
</a>
</td>
Expand Down
35 changes: 35 additions & 0 deletions src/DateTimePickerIcons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React, { Component, PropTypes } from "react";

export default class DateTimePickerIcons extends Component {
static defaultProps = {
defaultIcons: {
time: 'glyphicon glyphicon-time',
date: 'glyphicon glyphicon-calendar',
up: 'glyphicon glyphicon-chevron-up',
down: 'glyphicon glyphicon-chevron-down',
previous: 'glyphicon glyphicon-chevron-left',
next: 'glyphicon glyphicon-chevron-right',
today: 'glyphicon glyphicon-screenshot',
clear: 'glyphicon glyphicon-trash',
close: 'glyphicon glyphicon-remove'
}
}

getIcon = () => {
var ret = this.props.icons && this.props.icons[this.props.glyph] ? this.props.icons[this.props.glyph] : this.props.defaultIcons[this.props.glyph];
return ret;
}

getClasses = () => {
var ret = this.props.className ? "" + this.props.className + " " + this.getIcon() : this.getIcon();
return ret;
}

render() {
return (
<span {...this.props} className={this.getClasses()}>
{this.props.children}
</span>
);
}
}
2 changes: 1 addition & 1 deletion src/DateTimePickerMinutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default class DateTimePickerMinutes extends Component {
<tbody>
<tr>
<td>
<a onClick={this.props.onSwitch} data-action="togglePicker" title="Select Time">
<a className="togglePicker" onClick={this.props.onSwitch} data-action="togglePicker" title="Select Time">
<Glyphicon glyph="time" />
</a>
</td>
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/DateTimePickerHours-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe("DateTimePickerHours", function() {
});

it("calls onSwitch when clicking the switch", function() {
const switchIcon = TestUtils.findRenderedDOMComponentWithClass(hours, "picker-switch");
const switchIcon = TestUtils.findRenderedDOMComponentWithClass(hours, "togglePicker");
TestUtils.Simulate.click(switchIcon);
expect(onSwitchMock.mock.calls.length).toBe(1);
});
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/DateTimePickerMinutes-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe("DateTimePickerMinutes", function() {
});

it("calls onSwitch when clicking the switch", function() {
const switchIcon = TestUtils.findRenderedDOMComponentWithClass(minutes, "picker-switch");
const switchIcon = TestUtils.findRenderedDOMComponentWithClass(minutes, "togglePicker");
TestUtils.Simulate.click(switchIcon);
expect(onSwitchMock.mock.calls.length).toBe(1);
});
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/DateTimePickerMonths-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe("DateTimePickerMonths", function() {
});

it("calls showYears when clicking the year", function() {
const year = TestUtils.findRenderedDOMComponentWithClass(months, "switch");
const year = TestUtils.findRenderedDOMComponentWithClass(months, "picker-switch");
TestUtils.Simulate.click(year);
expect(showYearsMock.mock.calls.length).toBe(1);
});
Expand Down