-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #121 from aversini/fix(TextArea)-broken-animation-…
…when-scrollHeight-is-0 fix(TextArea): broken animation when scrollHeight is 0
- Loading branch information
Showing
3 changed files
with
110 additions
and
49 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
31 changes: 31 additions & 0 deletions
31
packages/ui-components/src/components/TextArea/__tests__/utilities.test.ts
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,31 @@ | ||
import { adjustLabelAndHelperText } from "../utilities"; | ||
|
||
describe("adjustLabelAndHelperText", () => { | ||
it("should return no offsets if scrollHeight is 0", () => { | ||
const res = adjustLabelAndHelperText({ | ||
scrollHeight: 0, | ||
currentHeight: 0, | ||
currentHelperTextOffset: 0, | ||
currentLabelOffset: 0, | ||
}); | ||
expect(res).toStrictEqual({ | ||
labelOffset: undefined, | ||
helperTextOffset: undefined, | ||
scrollHeight: 0, | ||
}); | ||
}); | ||
|
||
it("should return offsets if scrollHeight and currentHeight are different and positive", () => { | ||
const res = adjustLabelAndHelperText({ | ||
scrollHeight: 200, | ||
currentHeight: 400, | ||
currentHelperTextOffset: 0, | ||
currentLabelOffset: 0, | ||
}); | ||
expect(res).toStrictEqual({ | ||
labelOffset: 100, | ||
helperTextOffset: -100, | ||
scrollHeight: 200, | ||
}); | ||
}); | ||
}); |
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