-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Core] Add option to grow text area with input (#3398)
- Loading branch information
1 parent
6c394e6
commit f396d57
Showing
4 changed files
with
80 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright 2017 Palantir Technologies, Inc. All rights reserved. | ||
* | ||
* Licensed under the terms of the LICENSE file distributed with this project. | ||
*/ | ||
|
||
import { assert } from "chai"; | ||
import { mount } from "enzyme"; | ||
import * as React from "react"; | ||
|
||
import { TextArea } from "../../src/index"; | ||
|
||
describe("<TextArea>", () => { | ||
it("can resize automatically", () => { | ||
const wrapper = mount(<TextArea growVertically={true} />); | ||
const textarea = wrapper.find("textarea"); | ||
|
||
textarea.simulate("change", { | ||
target: { | ||
scrollHeight: 500, | ||
}, | ||
}); | ||
|
||
assert.equal((textarea.getDOMNode() as HTMLElement).style.height, "500px"); | ||
}); | ||
|
||
it("doesn't resize by default", () => { | ||
const wrapper = mount(<TextArea />); | ||
const textarea = wrapper.find("textarea"); | ||
|
||
textarea.simulate("change", { | ||
target: { | ||
scrollHeight: textarea.getDOMNode().scrollHeight, | ||
}, | ||
}); | ||
|
||
assert.equal((textarea.getDOMNode() as HTMLElement).style.height, ""); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f396d57
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Core] Add option to grow text area with input (#3398)
Previews: documentation | landing | table