Skip to content

Commit

Permalink
fix conflicts that did not resolve correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
silvalaura committed Dec 20, 2024
1 parent 1dcd478 commit 9b12559
Show file tree
Hide file tree
Showing 8 changed files with 4,105 additions and 6,319 deletions.
12 changes: 9 additions & 3 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
{
"packages": ["website/*", "packages/*", "patterns/*"],
"packages": [
"website/*",
"packages/*",
"patterns/*"
],
"command": {
"bootstrap": {
"hoist": true
},
"publish": {
"allowBranch": ["dev", "hotfix/*", "main"],
"preDistTag": "next",
Expand All @@ -12,6 +19,5 @@
"conventionalCommits": true
}
},
"version": "independent",
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
"version": "independent"
}
10,176 changes: 4,093 additions & 6,083 deletions package-lock.json

Large diffs are not rendered by default.

13 changes: 3 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,14 @@
"npm": ">=^7.3.0",
"node": ">=^14.21.3"
},
"workspaces": [
"website/*",
"packages/*",
"patterns/*"
],
"scripts": {
"pkg": "manypkg run",
"check:pkgs": "manypkg check",
"fix:pkgs": "manypkg fix",
"upgrade:pkgs": "manypkg upgrade",
"getAlias": "node ./packages/react-magma-dom/scripts/getAlias.js",
"getVersion": "node ./packages/react-magma-dom/scripts/getVersion.js",
"postinstall": "npm run build:lite",
"postinstall": "npm run bootstrap && npm run build:lite",
"test": "jest",
"test-watch": "jest --watch",
"test-dom": "lerna run test --scope react-magma-dom -- --watch --coverage=false",
Expand All @@ -37,9 +32,8 @@
"bootstrap": "lerna bootstrap",
"lint": "lerna run lint",
"develop": "npm run docs",
"docs": "lerna run --scope react-magma-docs develop",
"docs": "lerna run --stream --scope react-magma-docs develop",
"clean": "lerna exec --scope react-magma-docs 'gatsby clean' && lerna clean --yes && rimraf node_modules",
"clean:docs": "lerna exec --scope react-magma-docs 'gatsby clean' && lerna clean --yes --scope react-magma-docs ",
"cm": "git-cz",
"cm-retry": "git-cz --retry",
"check:spelling": "cspell --config=.cspell.json packages/**/*.{md,ts,js,mdx,tsx,jsx}",
Expand All @@ -65,7 +59,6 @@
"@babel/plugin-proposal-export-default-from": "^7.0.0",
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
"@babel/plugin-proposal-object-rest-spread": "^7.11.0",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/plugin-proposal-throw-expressions": "^7.0.0",
"@babel/plugin-syntax-import-meta": "^7.0.0",
"@babel/preset-env": "^7.0.0",
Expand Down Expand Up @@ -136,7 +129,7 @@
"jest-emotion": "^10.0.32",
"jest-extended": "^0.11.5",
"jest-watch-typeahead": "^0.6.1",
"lerna": "^8.1.8",
"lerna": "^5.5.4",
"lint-staged": "^10.5.4",
"lodash": "^4.17.21",
"microbundle": "^0.13.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,11 +520,6 @@ Complex.args = {
checkedStatus: IndeterminateCheckboxStatus.unchecked,
isDisabled: true,
},
{
itemId: 'pt2ch5.1.2',
checkedStatus: IndeterminateCheckboxStatus.unchecked,
isDisabled: true,
},
{ itemId: 'pt2ch5.2', checkedStatus: IndeterminateCheckboxStatus.checked },
{ itemId: 'pt2ch5.3', checkedStatus: IndeterminateCheckboxStatus.checked },
{
Expand Down
184 changes: 0 additions & 184 deletions packages/react-magma-dom/src/components/TreeView/TreeView.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2199,190 +2199,6 @@ describe('TreeView', () => {
});
});

describe('when controlled outside', () => {
it('should be able to select all enabled items outside of TreeView', () => {
const onSelectedItemChange = jest.fn();
const { getByTestId, debug } = render(
<TreeItemsMultiLevelControlledOutside onSelectedItemChange={onSelectedItemChange} />
);

expect(onSelectedItemChange).not.toHaveBeenCalled();

userEvent.click(getByTestId('select-all'));

expect(onSelectedItemChange).toHaveBeenCalledWith([
{
itemId: "item0",
checkedStatus: IndeterminateCheckboxStatus.checked,
},
{
itemId: "item1",
checkedStatus: IndeterminateCheckboxStatus.checked,
},
{
itemId: "item-child1",
checkedStatus: IndeterminateCheckboxStatus.checked,
},
{
itemId: "item2",
checkedStatus: IndeterminateCheckboxStatus.indeterminate,
},
{
itemId: "item-child2.1",
checkedStatus: IndeterminateCheckboxStatus.indeterminate,
},
{
itemId: "item-gchild2",
checkedStatus: IndeterminateCheckboxStatus.indeterminate,
},
{
itemId: "item-ggchild2",
checkedStatus: IndeterminateCheckboxStatus.checked,
},
{
itemId: "item-ggchild3",
checkedStatus: IndeterminateCheckboxStatus.checked,
},
{
itemId: "item3",
checkedStatus: IndeterminateCheckboxStatus.checked,
},
{
itemId: "item-child3",
checkedStatus: IndeterminateCheckboxStatus.checked,
},
]);
});

it('should not select root parent if it initially unselected and disabled during select all', () => {
const onSelectedItemChange = jest.fn();
const { getByTestId, debug } = render(
<TreeItemsMultiLevelControlledOutside
onSelectedItemChange={onSelectedItemChange}
preselectedItems={[
{ itemId: 'item1', checkedStatus: IndeterminateCheckboxStatus.unchecked, isDisabled: true }
]}
/>
);

expect(onSelectedItemChange).toHaveBeenCalledTimes(0);

userEvent.click(getByTestId('select-all'));

expect(onSelectedItemChange).toHaveBeenCalledTimes(1);
expect(onSelectedItemChange).toHaveBeenCalledWith([
{ itemId: "item0", checkedStatus: IndeterminateCheckboxStatus.checked },
{ itemId: "item2", checkedStatus: IndeterminateCheckboxStatus.indeterminate },
{ itemId: "item-child2.1", checkedStatus: IndeterminateCheckboxStatus.indeterminate },
{ itemId: "item-gchild2", checkedStatus: IndeterminateCheckboxStatus.indeterminate },
{ itemId: "item-ggchild2", checkedStatus: IndeterminateCheckboxStatus.checked },
{ itemId: "item-ggchild3", checkedStatus: IndeterminateCheckboxStatus.checked },
{ itemId: "item3", checkedStatus: IndeterminateCheckboxStatus.checked },
{ itemId: "item-child3", checkedStatus: IndeterminateCheckboxStatus.checked },
]);
});

it('should be able to clear all enabled items outside of TreeView', () => {
const disabledItemId = 'item-ggchild1';

const onSelectedItemChange = jest.fn();
const { getByTestId, debug } = render(
<TreeItemsMultiLevelControlledOutside
onSelectedItemChange={onSelectedItemChange}
preselectedItems={[
{ itemId: disabledItemId, checkedStatus: IndeterminateCheckboxStatus.checked },
{ itemId: 'item-ggchild2', checkedStatus: IndeterminateCheckboxStatus.checked }
]}
/>
);

expect(onSelectedItemChange).toHaveBeenCalledTimes(1);
expect(onSelectedItemChange).toHaveBeenCalledWith([
{ itemId: 'item2', checkedStatus: IndeterminateCheckboxStatus.indeterminate },
{ itemId: 'item-child2.1', checkedStatus: IndeterminateCheckboxStatus.indeterminate },
{ itemId: 'item-gchild2', checkedStatus: IndeterminateCheckboxStatus.indeterminate },
{ itemId: "item-ggchild1", checkedStatus: IndeterminateCheckboxStatus.checked },
{ itemId: "item-ggchild2", checkedStatus: IndeterminateCheckboxStatus.checked },
]);

userEvent.click(getByTestId('clear-all'));

expect(onSelectedItemChange).toHaveBeenCalledTimes(2);
expect(onSelectedItemChange).toHaveBeenCalledWith([
{ itemId: 'item2', checkedStatus: IndeterminateCheckboxStatus.indeterminate },
{ itemId: 'item-child2.1', checkedStatus: IndeterminateCheckboxStatus.indeterminate },
{ itemId: 'item-gchild2', checkedStatus: IndeterminateCheckboxStatus.indeterminate },
{ itemId: 'item-ggchild1', checkedStatus: IndeterminateCheckboxStatus.checked }

]);
});

it('should not unselect root parent if it initially selected and disabled during clear all', () => {
const onSelectedItemChange = jest.fn();
const { getByTestId, debug } = render(
<TreeItemsMultiLevelControlledOutside
onSelectedItemChange={onSelectedItemChange}
preselectedItems={[
{ itemId: 'item0', checkedStatus: IndeterminateCheckboxStatus.checked },
{ itemId: 'item1', checkedStatus: IndeterminateCheckboxStatus.checked, isDisabled: true },
]}
/>
);

expect(onSelectedItemChange).toHaveBeenCalledTimes(1);
expect(onSelectedItemChange).toHaveBeenCalledWith([
{ itemId: "item0", checkedStatus: IndeterminateCheckboxStatus.checked },
{ itemId: "item1", checkedStatus: IndeterminateCheckboxStatus.checked },
{ itemId: "item-child1", checkedStatus: IndeterminateCheckboxStatus.checked },
]);

userEvent.click(getByTestId('clear-all'));

expect(onSelectedItemChange).toHaveBeenCalledTimes(2);
expect(onSelectedItemChange).toHaveBeenCalledWith([
{ itemId: "item1", checkedStatus: IndeterminateCheckboxStatus.checked },
{ itemId: "item-child1", checkedStatus: IndeterminateCheckboxStatus.checked },
]);
});

it('should be able to unselect enabled item outside of TreeView', () => {
const disabledItemId = 'item-ggchild1';

const onSelectedItemChange = jest.fn();
const { getByTestId } = render(
<TreeItemsMultiLevelControlledOutside
onSelectedItemChange={onSelectedItemChange}
preselectedItems={[
{ itemId: disabledItemId, checkedStatus: IndeterminateCheckboxStatus.checked },
{ itemId: 'item-ggchild2', checkedStatus: IndeterminateCheckboxStatus.checked }
]}
/>
);

expect(onSelectedItemChange).toHaveBeenCalledTimes(1);
expect(onSelectedItemChange).toHaveBeenCalledWith([
{ itemId: 'item2', checkedStatus: IndeterminateCheckboxStatus.indeterminate },
{ itemId: 'item-child2.1', checkedStatus: IndeterminateCheckboxStatus.indeterminate },
{ itemId: 'item-gchild2', checkedStatus: IndeterminateCheckboxStatus.indeterminate },
{ itemId: 'item-ggchild1', checkedStatus: IndeterminateCheckboxStatus.checked },
{ itemId: 'item-ggchild2', checkedStatus: IndeterminateCheckboxStatus.checked }
]);

userEvent.click(getByTestId(`${disabledItemId}-tag`));
expect(onSelectedItemChange).toHaveBeenCalledTimes(1);

userEvent.click(getByTestId('item-ggchild2-tag'));

expect(onSelectedItemChange).toHaveBeenCalledTimes(2);
expect(onSelectedItemChange).toHaveBeenCalledWith([
{ itemId: 'item2', checkedStatus: IndeterminateCheckboxStatus.indeterminate },
{ itemId: 'item-child2.1', checkedStatus: IndeterminateCheckboxStatus.indeterminate },
{ itemId: 'item-gchild2', checkedStatus: IndeterminateCheckboxStatus.indeterminate },
{ itemId: 'item-ggchild1', checkedStatus: IndeterminateCheckboxStatus.checked }
]);
});
});

describe('toggle expanded items', () => {
it('when selectable is TreeViewSelectable.off should expand/collapse nested items', () => {
const { getByTestId, queryByTestId } = render(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@ export interface TreeViewItemInterface {
isDisabled?: boolean;
}

export interface TreeViewItemInterface {
itemId?: string;
parentId?: string | null;
icon?: React.ReactNode;
checkedStatus: IndeterminateCheckboxStatus;
hasOwnTreeItems: boolean
isDisabled?: boolean
}

export interface TreeViewContextInterface {
children?: React.ReactNode[];
hasIcons: boolean;
Expand Down
18 changes: 0 additions & 18 deletions packages/react-magma-dom/src/components/TreeView/useTreeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,24 +217,6 @@ export function useTreeView(props: UseTreeViewProps) {
prevPreselectedItemsRef.current = preselectedItems;
}, [preselectedItems, checkParents, checkChildren, selectable, isDisabled]);

React.useEffect(() => {
if (isEqualArrays(prevPreselectedItemsRef.current, preselectedItems)) {
return;
}

setItems(
getInitialItems({
children,
preselectedItems,
checkParents,
checkChildren,
selectable,
isDisabled,
})
);
prevPreselectedItemsRef.current = preselectedItems;
}, [preselectedItems, checkParents, checkChildren, selectable, isDisabled]);

React.useEffect(() => {
if (initializationRef.current) {
return;
Expand Down
7 changes: 0 additions & 7 deletions packages/react-magma-dom/src/i18n/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,6 @@ export interface I18nInterface {
pagesLabel: string;
selectedLabel: string;
};
simplePagination: {
ofLabel: string;
pageNumberLabel: string;
pageLabel: string;
pagesLabel: string;
selectedLabel: string;
};
skipLink: {
buttonText: string;
};
Expand Down

0 comments on commit 9b12559

Please sign in to comment.