Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing Value.js tests #609

Merged
merged 1 commit into from
Nov 22, 2015
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/Value.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const Value = React.createClass({
renderLabel () {
let className = 'Select-value-label';
return this.props.onClick || this.props.value.href ? (
<a className={className} href={this.props.value.href} target={this.props.value.target} onMouseDown={this.handleMouseDown} onTouchEnd={this.props.handleMouseDown}>
<a className={className} href={this.props.value.href} target={this.props.value.target} onMouseDown={this.handleMouseDown} onTouchEnd={this.handleMouseDown}>
{this.props.children}
</a>
) : (
Expand Down
10 changes: 2 additions & 8 deletions test/Value-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ describe('Value component', function() {
value: OPTION,
onRemove: sinon.spy()
};
value = TestUtils.renderIntoDocument(<Value {...props}/>);
value = TestUtils.renderIntoDocument(<Value {...props}>{OPTION.label}</Value>);
});

it('requests its own removal when the remove icon is clicked', function() {
var selectItemIcon = TestUtils.findRenderedDOMComponentWithClass(value, 'Select-value-icon');
TestUtils.Simulate.click(selectItemIcon);
TestUtils.Simulate.mouseDown(selectItemIcon);
expect(props.onRemove, 'was called');
});

Expand All @@ -47,12 +47,6 @@ describe('Value component', function() {
expect(props.onRemove, 'was called');
});

it('prevents event propagation, pt 1', function() {
var mockEvent = { stopPropagation: sinon.spy() };
value.blockEvent(mockEvent);
expect(mockEvent.stopPropagation, 'was called');
});

describe('without a custom click handler', function() {

it('presents the given label', function() {
Expand Down