-
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.
Add option to grow text area with input
- Loading branch information
Jonathan Roitgrund
committed
Mar 7, 2019
1 parent
a919718
commit c08d6b0
Showing
4 changed files
with
82 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