Skip to content

Commit

Permalink
test(text-field): change test name
Browse files Browse the repository at this point in the history
  • Loading branch information
TroyTae committed Jun 18, 2019
1 parent 30270f2 commit c5ad27e
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions test/unit/text-field/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -420,25 +420,6 @@ test('#events.onKeyDown triggers #foundation.handleTextFieldInteraction', () =>
});
});

test('#foundation.setValue is triggered when value is changed programmatically', () => {
class TestComponent extends React.Component {
state = {value: ''};
render() {
return (
<TextField label='my label'>
<Input value={this.state.value} />
</TextField>
);
}
}
const wrapper = mount<TestComponent>(<TestComponent />);
const label = wrapper.find('.mdc-floating-label').getDOMNode();
const floatClass = 'mdc-floating-label--float-above';
assert.isFalse(label.className.includes(floatClass));
wrapper.setState({value: 'Test!'});
assert.isTrue(label.className.includes(floatClass));
});

test('renders leadingIcon if passed as prop', () => {
const wrapper = mount(
<TextField
Expand Down Expand Up @@ -789,3 +770,22 @@ test('Input component sync test in TextField', () => {
// and throw error because there is no inputComponent
assert.doesNotThrow(() => wrapper.instance().setState({disabled: true}));
});

test('FloatingLabel is floated even if value is changed programmatically', () => {
class TestComponent extends React.Component {
state = {value: ''};
render() {
return (
<TextField label='my label'>
<Input value={this.state.value} />
</TextField>
);
}
}
const wrapper = mount<TestComponent>(<TestComponent />);
const label = wrapper.find('.mdc-floating-label').getDOMNode();
const floatClass = 'mdc-floating-label--float-above';
assert.isFalse(label.className.includes(floatClass));
wrapper.setState({value: 'Test!'});
assert.isTrue(label.className.includes(floatClass));
});

0 comments on commit c5ad27e

Please sign in to comment.