fix(carbon-components-react) TileGroup's onChange signature: all arguments are mandatory (#42125)

* Updated TileGroup's onChange signature: all arguments are mandatory

* Added test for the onChange

* fix lint issues

* Fixed merge issues
This commit is contained in:
Sébastien
2020-02-07 13:48:50 -08:00
committed by GitHub
parent 946a98e60e
commit 565e8696e1
2 changed files with 16 additions and 1 deletions
@@ -12,6 +12,7 @@ import {
TableBatchActions,
TableHeader,
TableRow,
TileGroup,
TooltipDefinition,
TextArea,
TextInput,
@@ -268,6 +269,20 @@ const uisLinkT5 = (
<Link<TestCompPropsOverwrite> element={TestComp3} someProp="asdf">Testing Overwrite</Link>
);
// TileGroup
// Value nor name can be undefined
let value: string|number = 5;
let name = "old name";
const tileGroupA = (
<TileGroup
name="my-tile-group-name"
onChange={(newVal, newName, e) => {
value = newVal;
name = newName;
}}
/>
);
// TooltipDefinition
const tooltipDefHasAlign = (
<TooltipDefinition tooltipText="my text" align="end" />
@@ -12,7 +12,7 @@ interface InheritedProps {
export interface TileGroupProps extends InheritedProps {
defaultSelected?: TileGroupProps["valueSelected"],
legend?: string,
onChange?(value: TileGroupProps["valueSelected"], name: TileGroupProps["name"], event: RadioTileChangeEvent): void,
onChange?(value: NonNullable<TileGroupProps["valueSelected"]>, name: NonNullable<TileGroupProps["name"]>, event: RadioTileChangeEvent): void,
valueSelected?: string | number,
}