Skip to content

Commit

Permalink
fix(composer): Adding ability to deselect by click radio button (#351)
Browse files Browse the repository at this point in the history
Co-authored-by: Emily Dodds <dodemily@amazon.com>
  • Loading branch information
mumanity and mumanity committed Nov 10, 2022
1 parent 8458e50 commit 8c402b7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/scene-composer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
"lines": 77.49,
"statements": 76.63,
"functions": 77.01,
"branches": 63.31,
"branches": 63.2,
"branchesTrue": 100
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/scene-composer/src/components/Tree/TreeItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const TreeItemInner: FC<TreeItemInnerProps> = ({

const toggle = useCallback(
(e) => {
if (selected) setSelectedSceneNodeRef(undefined);
return (children) =>
children.every((child) => child === true) ? selectFromChildren() : onSelected(!selected, e);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,6 @@ jest.mock('react-dnd', () => ({
useDrop: jest.fn(() => [1, useRef(2)]),
}));

jest.mock('@awsui/components-react', () => ({
Button: 'button',
// eslint-disable-next-line react/prop-types
Checkbox: ({ children, ...props }) => (
<div>
<input type='checkbox' {...props} />
{children}
</div>
),
}));

describe('<TreeItem />', () => {
(
[
Expand Down Expand Up @@ -88,8 +77,9 @@ describe('<TreeItem />', () => {
type="radio"
value=""
/>
<button
<div
class="tm-tree-item-expand-btn"
data-mocked="Button"
iconname="treeview-collapse"
variant="inline-icon"
/>
Expand Down Expand Up @@ -140,8 +130,9 @@ describe('<TreeItem />', () => {
type="radio"
value=""
/>
<button
<div
class="tm-tree-item-expand-btn"
data-mocked="Button"
iconname="treeview-expand"
variant="inline-icon"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ exports[`<TreeItem /> should render appropriate configuration "{"labelText":"Lab
type="radio"
value=""
/>
<button
<div
class="tm-tree-item-expand-btn"
data-mocked="Button"
iconname="treeview-expand"
variant="inline-icon"
/>
Expand Down Expand Up @@ -104,8 +105,9 @@ exports[`<TreeItem /> should render appropriate configuration "{"labelText":"Lab
type="radio"
value=""
/>
<button
<div
class="tm-tree-item-expand-btn"
data-mocked="Button"
iconname="treeview-expand"
variant="inline-icon"
/>
Expand Down

0 comments on commit 8c402b7

Please sign in to comment.