diff --git a/cypress/integration/item/copy/gridCopyItem.spec.js b/cypress/integration/item/copy/gridCopyItem.spec.js
index 0d04bf54b..c225f3127 100644
--- a/cypress/integration/item/copy/gridCopyItem.spec.js
+++ b/cypress/integration/item/copy/gridCopyItem.spec.js
@@ -4,13 +4,13 @@ import { buildItemPath, HOME_PATH } from '../../../../src/config/paths';
import {
buildItemCard,
buildItemMenu,
- ITEM_MENU_BUTTON_CLASS,
+ buildItemMenuButtonId,
ITEM_MENU_COPY_BUTTON_CLASS,
} from '../../../../src/config/selectors';
import { SAMPLE_ITEMS } from '../../../fixtures/items';
const copyItem = ({ id, toItemPath }) => {
- const menuSelector = `#${buildItemCard(id)} .${ITEM_MENU_BUTTON_CLASS}`;
+ const menuSelector = `#${buildItemMenuButtonId(id)}`;
cy.get(menuSelector).click();
cy.get(`#${buildItemMenu(id)} .${ITEM_MENU_COPY_BUTTON_CLASS}`).click();
cy.fillTreeModal(toItemPath);
diff --git a/cypress/integration/item/copy/listCopyItem.spec.js b/cypress/integration/item/copy/listCopyItem.spec.js
index 710219ebb..725ef8053 100644
--- a/cypress/integration/item/copy/listCopyItem.spec.js
+++ b/cypress/integration/item/copy/listCopyItem.spec.js
@@ -6,18 +6,16 @@ import { ITEM_LAYOUT_MODES } from '../../../../src/enums';
import { buildItemPath, HOME_PATH } from '../../../../src/config/paths';
import {
- buildItemsTableRowId,
+ buildItemsTableRowIdAttribute,
buildItemMenu,
- ITEM_MENU_BUTTON_CLASS,
ITEM_MENU_COPY_BUTTON_CLASS,
+ buildItemMenuButtonId,
} from '../../../../src/config/selectors';
import { SAMPLE_ITEMS } from '../../../fixtures/items';
import { TABLE_ITEM_RENDER_TIME } from '../../../support/constants';
const copyItem = ({ id, toItemPath }) => {
- const menuSelector = `#${buildItemsTableRowId(
- id,
- )} .${ITEM_MENU_BUTTON_CLASS}`;
+ const menuSelector = `#${buildItemMenuButtonId(id)}`;
cy.wait(TABLE_ITEM_RENDER_TIME);
cy.get(menuSelector).click();
cy.get(`#${buildItemMenu(id)} .${ITEM_MENU_COPY_BUTTON_CLASS}`).click();
@@ -38,11 +36,11 @@ describe('Copy Item in List', () => {
copyItem({ id: copyItemId, toItemPath });
cy.wait('@copyItems').then(({ response: { body } }) => {
- cy.get(`#${buildItemsTableRowId(copyItemId)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(copyItemId)).should('exist');
// check in new parent
cy.goToItemInList(toItem);
- cy.get(`#${buildItemsTableRowId(body[0].id)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(body[0].id)).should('exist');
});
});
@@ -62,11 +60,11 @@ describe('Copy Item in List', () => {
copyItem({ id: copyItemId, toItemPath });
cy.wait('@copyItems').then(({ response: { body } }) => {
- cy.get(`#${buildItemsTableRowId(copyItemId)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(copyItemId)).should('exist');
// check in new parent
cy.goToItemInList(toItem);
- cy.get(`#${buildItemsTableRowId(body[0].id)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(body[0].id)).should('exist');
});
});
@@ -85,11 +83,11 @@ describe('Copy Item in List', () => {
copyItem({ id: copyItemId, toItemPath: ROOT_ID });
cy.wait('@copyItems').then(({ response: { body } }) => {
- cy.get(`#${buildItemsTableRowId(copyItemId)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(copyItemId)).should('exist');
// check in new parent
cy.goToHome();
- cy.get(`#${buildItemsTableRowId(body[0].id)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(body[0].id)).should('exist');
});
});
@@ -111,8 +109,8 @@ describe('Copy Item in List', () => {
cy.wait('@copyItems').then(({ response: { body } }) => {
// check item is still existing in parent
- cy.get(`#${buildItemsTableRowId(copyItemId)}`).should('exist');
- cy.get(`#${buildItemsTableRowId(body[0].id)}`).should('not.exist');
+ cy.get(buildItemsTableRowIdAttribute(copyItemId)).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(body[0].id)).should('not.exist');
});
});
});
diff --git a/cypress/integration/item/copy/listCopyMultiple.spec.js b/cypress/integration/item/copy/listCopyMultiple.spec.js
index 759b1446d..260c04eaf 100644
--- a/cypress/integration/item/copy/listCopyMultiple.spec.js
+++ b/cypress/integration/item/copy/listCopyMultiple.spec.js
@@ -6,27 +6,23 @@ import { ITEM_LAYOUT_MODES } from '../../../../src/enums';
import { buildItemPath, HOME_PATH } from '../../../../src/config/paths';
import {
- buildItemsTableRowId,
- ITEMS_TABLE_ROW_CHECKBOX_CLASS,
+ buildItemsTableRowIdAttribute,
ITEMS_TABLE_COPY_SELECTED_ITEMS_ID,
} from '../../../../src/config/selectors';
import { SAMPLE_ITEMS } from '../../../fixtures/items';
import { TABLE_ITEM_RENDER_TIME } from '../../../support/constants';
-
-
+
const copyItems = ({ itemIds, toItemPath }) => {
// check selected ids
itemIds.forEach((id) => {
cy.wait(TABLE_ITEM_RENDER_TIME);
- cy.get(
- `#${buildItemsTableRowId(id)} .${ITEMS_TABLE_ROW_CHECKBOX_CLASS}`,
- ).click();
+ cy.get(`${buildItemsTableRowIdAttribute(id)} input`).click();
});
cy.wait(TABLE_ITEM_RENDER_TIME);
cy.get(`#${ITEMS_TABLE_COPY_SELECTED_ITEMS_ID}`).click();
cy.fillTreeModal(toItemPath);
-};
+};
describe('Copy items in List', () => {
it('Copy items on Home', () => {
@@ -34,7 +30,7 @@ describe('Copy items in List', () => {
cy.visit(HOME_PATH);
if (DEFAULT_ITEM_LAYOUT_MODE !== ITEM_LAYOUT_MODES.LIST) {
- cy.switchMode(ITEM_LAYOUT_MODES.LIST);
+ cy.switchMode(ITEM_LAYOUT_MODES.LIST);
}
const itemIds = [SAMPLE_ITEMS.items[0].id, SAMPLE_ITEMS.items[5].id];
@@ -42,14 +38,14 @@ describe('Copy items in List', () => {
copyItems({ itemIds, toItemPath });
cy.wait('@copyItems').then(({ response: { body } }) => {
- itemIds.forEach(id =>{
- cy.get(`#${buildItemsTableRowId(id)}`).should('exist');
+ itemIds.forEach((id) => {
+ cy.get(`${buildItemsTableRowIdAttribute(id)}`).should('exist');
});
// check in new parent
cy.goToItemInList(toItem);
- body.forEach(item => {
- cy.get(`#${buildItemsTableRowId(item.id)}`).should('exist');
+ body.forEach((item) => {
+ cy.get(`${buildItemsTableRowIdAttribute(item.id)}`).should('exist');
});
});
});
@@ -70,14 +66,14 @@ describe('Copy items in List', () => {
copyItems({ itemIds, toItemPath });
cy.wait('@copyItems').then(({ response: { body } }) => {
- itemIds.forEach(id => {
- cy.get(`#${buildItemsTableRowId(id)}`).should('exist');
+ itemIds.forEach((id) => {
+ cy.get(`${buildItemsTableRowIdAttribute(id)}`).should('exist');
});
// check in new parent
cy.goToItemInList(toItem);
- body.forEach(item => {
- cy.get(`#${buildItemsTableRowId(item.id)}`).should('exist');
+ body.forEach((item) => {
+ cy.get(`${buildItemsTableRowIdAttribute(item.id)}`).should('exist');
});
});
});
@@ -94,17 +90,17 @@ describe('Copy items in List', () => {
// copy
const itemIds = [SAMPLE_ITEMS.items[2].id, SAMPLE_ITEMS.items[4].id];
- copyItems({itemIds, toItemPath: ROOT_ID });
+ copyItems({ itemIds, toItemPath: ROOT_ID });
cy.wait('@copyItems').then(({ response: { body } }) => {
- itemIds.forEach(id => {
- cy.get(`#${buildItemsTableRowId(id)}`).should('exist');
+ itemIds.forEach((id) => {
+ cy.get(`${buildItemsTableRowIdAttribute(id)}`).should('exist');
});
// check in new parent
cy.goToHome();
- body.forEach(item => {
- cy.get(`#${buildItemsTableRowId(item.id)}`).should('exist');
+ body.forEach((item) => {
+ cy.get(`${buildItemsTableRowIdAttribute(item.id)}`).should('exist');
});
});
});
@@ -112,7 +108,7 @@ describe('Copy items in List', () => {
describe('Error handling', () => {
it('error while copying item does not create in interface', () => {
cy.setUpApi({ ...SAMPLE_ITEMS, copyItemError: true });
- const { id :start } = SAMPLE_ITEMS.items[0];
+ const { id: start } = SAMPLE_ITEMS.items[0];
// go to children item
cy.visit(buildItemPath(start));
@@ -127,11 +123,13 @@ describe('Copy items in List', () => {
cy.wait('@copyItems').then(({ response: { body } }) => {
// check item is still existing in parent
- itemIds.forEach(id => {
- cy.get(`#${buildItemsTableRowId(id)}`).should('exist');
+ itemIds.forEach((id) => {
+ cy.get(`${buildItemsTableRowIdAttribute(id)}`).should('exist');
});
- body.forEach(item => {
- cy.get(`#${buildItemsTableRowId(item.id)}`).should('not.exist');
+ body.forEach((item) => {
+ cy.get(`${buildItemsTableRowIdAttribute(item.id)}`).should(
+ 'not.exist',
+ );
});
});
});
diff --git a/cypress/integration/item/create/createFolder.spec.js b/cypress/integration/item/create/createFolder.spec.js
index e568dc917..a0ac6ccdb 100644
--- a/cypress/integration/item/create/createFolder.spec.js
+++ b/cypress/integration/item/create/createFolder.spec.js
@@ -1,7 +1,7 @@
import { DEFAULT_ITEM_LAYOUT_MODE } from '../../../../src/config/constants';
import { ITEM_LAYOUT_MODES } from '../../../../src/enums';
import { buildItemPath, HOME_PATH } from '../../../../src/config/paths';
-import { buildItemsTableRowId } from '../../../../src/config/selectors';
+import { buildItemsTableRowIdAttribute } from '../../../../src/config/selectors';
import { CREATED_ITEM, SAMPLE_ITEMS } from '../../../fixtures/items';
import { CREATE_ITEM_PAUSE } from '../../../support/constants';
import { createItem } from './utils';
@@ -95,7 +95,7 @@ describe('Create Folder', () => {
cy.wait('@postItem').then(({ response: { body } }) => {
// check item is created and displayed
- cy.get(`#${buildItemsTableRowId(body.id)}`).should('not.exist');
+ cy.get(buildItemsTableRowIdAttribute(body.id)).should('not.exist');
});
});
});
diff --git a/cypress/integration/item/create/createShortcut.spec.js b/cypress/integration/item/create/createShortcut.spec.js
index a100ffe83..53ca7aaf6 100644
--- a/cypress/integration/item/create/createShortcut.spec.js
+++ b/cypress/integration/item/create/createShortcut.spec.js
@@ -3,10 +3,8 @@ import { ITEM_LAYOUT_MODES, ITEM_TYPES } from '../../../../src/enums';
import { ROOT_ID } from '../../../../src/config/constants';
import { HOME_PATH } from '../../../../src/config/paths';
import {
- buildItemCard,
buildItemMenu,
- buildItemsTableRowId,
- ITEM_MENU_BUTTON_CLASS,
+ buildItemMenuButtonId,
ITEM_MENU_SHORTCUT_BUTTON_CLASS,
} from '../../../../src/config/selectors';
import { buildShortcutExtra } from '../../../../src/utils/itemExtra';
@@ -19,15 +17,13 @@ const createShortcut = ({ id, toItemPath }) => {
};
const createShortcutInGrid = ({ id, toItemPath }) => {
- const menuSelector = `#${buildItemCard(id)} .${ITEM_MENU_BUTTON_CLASS}`;
+ const menuSelector = `#${buildItemMenuButtonId(id)}`;
cy.get(menuSelector).click();
createShortcut({ id, toItemPath });
};
const createShortcutInList = ({ id, toItemPath }) => {
- const menuSelector = `#${buildItemsTableRowId(
- id,
- )} .${ITEM_MENU_BUTTON_CLASS}`;
+ const menuSelector = `#${buildItemMenuButtonId(id)}`;
cy.get(menuSelector).click();
createShortcut({ id, toItemPath });
};
diff --git a/cypress/integration/item/delete/listDeleteItem.spec.js b/cypress/integration/item/delete/listDeleteItem.spec.js
index 1cce1b731..8a05ae1c4 100644
--- a/cypress/integration/item/delete/listDeleteItem.spec.js
+++ b/cypress/integration/item/delete/listDeleteItem.spec.js
@@ -2,16 +2,16 @@ import { DEFAULT_ITEM_LAYOUT_MODE } from '../../../../src/config/constants';
import { ITEM_LAYOUT_MODES } from '../../../../src/enums';
import { RECYCLE_BIN_PATH } from '../../../../src/config/paths';
import {
- buildItemsTableRowId,
+ buildDeleteButtonId,
+ buildItemsTableRowIdAttribute,
CONFIRM_DELETE_BUTTON_ID,
- ITEM_DELETE_BUTTON_CLASS,
} from '../../../../src/config/selectors';
import { DATABASE_WITH_RECYCLE_BIN } from '../../../fixtures/recycleBin';
import { TABLE_ITEM_RENDER_TIME } from '../../../support/constants';
const deleteItem = (id) => {
cy.wait(TABLE_ITEM_RENDER_TIME);
- cy.get(`#${buildItemsTableRowId(id)} .${ITEM_DELETE_BUTTON_CLASS}`).click();
+ cy.get(`#${buildDeleteButtonId(id)}`).click();
cy.get(`#${CONFIRM_DELETE_BUTTON_ID}`).click();
};
@@ -51,7 +51,7 @@ describe('Delete Item in List', () => {
cy.wait('@deleteItem').then(() => {
// check item is still displayed
- cy.get(`#${buildItemsTableRowId(id)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(id)).should('exist');
});
});
});
diff --git a/cypress/integration/item/delete/listDeleteItems.spec.js b/cypress/integration/item/delete/listDeleteItems.spec.js
index 7cb8e148c..9fe23f284 100644
--- a/cypress/integration/item/delete/listDeleteItems.spec.js
+++ b/cypress/integration/item/delete/listDeleteItems.spec.js
@@ -2,10 +2,9 @@ import { DEFAULT_ITEM_LAYOUT_MODE } from '../../../../src/config/constants';
import { ITEM_LAYOUT_MODES } from '../../../../src/enums';
import { RECYCLE_BIN_PATH } from '../../../../src/config/paths';
import {
- buildItemsTableRowId,
+ buildItemsTableRowIdAttribute,
CONFIRM_DELETE_BUTTON_ID,
ITEMS_TABLE_DELETE_SELECTED_ITEMS_ID,
- ITEMS_TABLE_ROW_CHECKBOX_CLASS,
} from '../../../../src/config/selectors';
import { DATABASE_WITH_RECYCLE_BIN } from '../../../fixtures/recycleBin';
import { TABLE_ITEM_RENDER_TIME } from '../../../support/constants';
@@ -14,9 +13,7 @@ const deleteItems = (itemIds) => {
// check selected ids
itemIds.forEach((id) => {
cy.wait(TABLE_ITEM_RENDER_TIME);
- cy.get(
- `#${buildItemsTableRowId(id)} .${ITEMS_TABLE_ROW_CHECKBOX_CLASS}`,
- ).click();
+ cy.get(`${buildItemsTableRowIdAttribute(id)} .ag-checkbox-input`).click();
});
cy.get(`#${ITEMS_TABLE_DELETE_SELECTED_ITEMS_ID}`).click();
@@ -63,7 +60,7 @@ describe('Delete Items in List', () => {
cy.wait('@deleteItems').then(() => {
// check items are still displayed
for (const id of itemIds) {
- cy.get(`#${buildItemsTableRowId(id)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(id)).should('exist');
}
});
});
diff --git a/cypress/integration/item/edit/utils.js b/cypress/integration/item/edit/utils.js
index a230427c4..4944c0482 100644
--- a/cypress/integration/item/edit/utils.js
+++ b/cypress/integration/item/edit/utils.js
@@ -1,9 +1,6 @@
import { ITEM_TYPES, ITEM_LAYOUT_MODES } from '../../../../src/enums';
import { DEFAULT_ITEM_LAYOUT_MODE } from '../../../../src/config/constants';
import {
- buildItemCard,
- buildItemsTableRowId,
- EDIT_ITEM_BUTTON_CLASS,
TEXT_EDITOR_CLASS,
buildSaveButtonId,
buildEditButtonId,
@@ -15,13 +12,13 @@ export const editItem = (payload, mode = DEFAULT_ITEM_LAYOUT_MODE) => {
const { id, type } = payload;
switch (mode) {
case ITEM_LAYOUT_MODES.GRID: {
- const button = `#${buildItemCard(id)} .${EDIT_ITEM_BUTTON_CLASS}`;
+ const button = `#${buildEditButtonId(id)}`;
cy.get(button).click();
break;
}
case ITEM_LAYOUT_MODES.LIST:
default: {
- cy.get(`#${buildItemsTableRowId(id)} .${EDIT_ITEM_BUTTON_CLASS}`).click();
+ cy.get(`#${buildEditButtonId(id)}`).click();
}
}
diff --git a/cypress/integration/item/favorite/favoriteItem.spec.js b/cypress/integration/item/favorite/favoriteItem.spec.js
index 1b3417527..aca75985c 100644
--- a/cypress/integration/item/favorite/favoriteItem.spec.js
+++ b/cypress/integration/item/favorite/favoriteItem.spec.js
@@ -1,7 +1,7 @@
import { SAMPLE_ITEMS } from '../../../fixtures/items';
import { FAVORITE_ITEMS_PATH, HOME_PATH } from '../../../../src/config/paths';
import {
- buildItemsTableRowId,
+ buildItemsTableRowIdAttribute,
FAVORITE_ITEM_BUTTON_CLASS,
FAVORITE_ITEMS_ERROR_ALERT_ID,
CREATE_ITEM_BUTTON_ID,
@@ -12,7 +12,7 @@ import { TABLE_ITEM_RENDER_TIME } from '../../../support/constants';
const toggleFavoriteButton = (itemId) => {
cy.wait(TABLE_ITEM_RENDER_TIME);
cy.get(
- `#${buildItemsTableRowId(itemId)} .${FAVORITE_ITEM_BUTTON_CLASS}`,
+ `${buildItemsTableRowIdAttribute(itemId)} .${FAVORITE_ITEM_BUTTON_CLASS}`,
).click();
};
@@ -70,7 +70,7 @@ describe('Favorite Item', () => {
const itemId = favoriteItems[0];
- cy.get(`#${buildItemsTableRowId(itemId)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(itemId)).should('exist');
});
});
diff --git a/cypress/integration/item/flag/flagItem.spec.js b/cypress/integration/item/flag/flagItem.spec.js
index c172410f9..7f489cbd0 100644
--- a/cypress/integration/item/flag/flagItem.spec.js
+++ b/cypress/integration/item/flag/flagItem.spec.js
@@ -3,18 +3,16 @@ import { HOME_PATH } from '../../../../src/config/paths';
import {
buildFlagListItemId,
buildItemMenu,
- buildItemsTableRowId,
+ buildItemMenuButtonId,
FLAG_ITEM_BUTTON_ID,
- ITEM_MENU_BUTTON_CLASS,
ITEM_MENU_FLAG_BUTTON_CLASS,
} from '../../../../src/config/selectors';
import { SAMPLE_FLAGS } from '../../../fixtures/flags';
+import { TABLE_ITEM_RENDER_TIME } from '../../../support/constants';
const openFlagItemModal = (itemId) => {
- const menuSelector = `#${buildItemsTableRowId(
- itemId,
- )} .${ITEM_MENU_BUTTON_CLASS}`;
-
+ const menuSelector = `#${buildItemMenuButtonId(itemId)}`;
+ cy.wait(TABLE_ITEM_RENDER_TIME);
cy.get(menuSelector).click();
const menuFlagButton = cy.get(
diff --git a/cypress/integration/item/move/gridMoveItem.spec.js b/cypress/integration/item/move/gridMoveItem.spec.js
index c2355e864..3f1ee33ba 100644
--- a/cypress/integration/item/move/gridMoveItem.spec.js
+++ b/cypress/integration/item/move/gridMoveItem.spec.js
@@ -4,15 +4,13 @@ import { buildItemPath, HOME_PATH } from '../../../../src/config/paths';
import {
buildItemCard,
buildItemMenu,
- ITEM_MENU_BUTTON_CLASS,
+ buildItemMenuButtonId,
ITEM_MENU_MOVE_BUTTON_CLASS,
} from '../../../../src/config/selectors';
import { SAMPLE_ITEMS } from '../../../fixtures/items';
const moveItem = ({ id: movedItemId, toItemPath }) => {
- const menuSelector = `#${buildItemCard(
- movedItemId,
- )} .${ITEM_MENU_BUTTON_CLASS}`;
+ const menuSelector = `#${buildItemMenuButtonId(movedItemId)}`;
cy.get(menuSelector).click();
cy.get(
`#${buildItemMenu(movedItemId)} .${ITEM_MENU_MOVE_BUTTON_CLASS}`,
diff --git a/cypress/integration/item/move/listMoveItem.spec.js b/cypress/integration/item/move/listMoveItem.spec.js
index a37339b87..fefe8497d 100644
--- a/cypress/integration/item/move/listMoveItem.spec.js
+++ b/cypress/integration/item/move/listMoveItem.spec.js
@@ -5,18 +5,16 @@ import {
import { ITEM_LAYOUT_MODES } from '../../../../src/enums';
import { buildItemPath, HOME_PATH } from '../../../../src/config/paths';
import {
- buildItemsTableRowId,
+ buildItemsTableRowIdAttribute,
buildItemMenu,
- ITEM_MENU_BUTTON_CLASS,
ITEM_MENU_MOVE_BUTTON_CLASS,
+ buildItemMenuButtonId,
} from '../../../../src/config/selectors';
import { SAMPLE_ITEMS } from '../../../fixtures/items';
import { TABLE_ITEM_RENDER_TIME } from '../../../support/constants';
const moveItem = ({ id: movedItemId, toItemPath }) => {
- const menuSelector = `#${buildItemsTableRowId(
- movedItemId,
- )} .${ITEM_MENU_BUTTON_CLASS}`;
+ const menuSelector = `#${buildItemMenuButtonId(movedItemId)}`;
cy.wait(TABLE_ITEM_RENDER_TIME);
cy.get(menuSelector).click();
cy.get(
@@ -109,7 +107,7 @@ describe('Move Item in List', () => {
cy.wait('@moveItems').then(() => {
// check item is still there
- cy.get(`#${buildItemsTableRowId(movedItem)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(movedItem)).should('exist');
});
});
});
diff --git a/cypress/integration/item/move/listMoveMultiple.spec.js b/cypress/integration/item/move/listMoveMultiple.spec.js
index 042e3ef90..01247683e 100644
--- a/cypress/integration/item/move/listMoveMultiple.spec.js
+++ b/cypress/integration/item/move/listMoveMultiple.spec.js
@@ -1,31 +1,28 @@
import {
- ROOT_ID,
- DEFAULT_ITEM_LAYOUT_MODE,
- } from '../../../../src/config/constants';
- import { ITEM_LAYOUT_MODES } from '../../../../src/enums';
- import { buildItemPath, HOME_PATH } from '../../../../src/config/paths';
- import {
- buildItemsTableRowId,
- ITEMS_TABLE_ROW_CHECKBOX_CLASS,
- ITEMS_TABLE_MOVE_SELECTED_ITEMS_ID
- } from '../../../../src/config/selectors';
- import { SAMPLE_ITEMS } from '../../../fixtures/items';
- import { TABLE_ITEM_RENDER_TIME } from '../../../support/constants';
-
+ ROOT_ID,
+ DEFAULT_ITEM_LAYOUT_MODE,
+} from '../../../../src/config/constants';
+import { ITEM_LAYOUT_MODES } from '../../../../src/enums';
+import { buildItemPath, HOME_PATH } from '../../../../src/config/paths';
+import {
+ buildItemsTableRowIdAttribute,
+ ITEMS_TABLE_MOVE_SELECTED_ITEMS_ID,
+} from '../../../../src/config/selectors';
+import { SAMPLE_ITEMS } from '../../../fixtures/items';
+import { TABLE_ITEM_RENDER_TIME } from '../../../support/constants';
+
const moveItems = ({ itemIds, toItemPath }) => {
// check selected ids
itemIds.forEach((id) => {
cy.wait(TABLE_ITEM_RENDER_TIME);
- cy.get(
- `#${buildItemsTableRowId(id)} .${ITEMS_TABLE_ROW_CHECKBOX_CLASS}`,
- ).click();
+ cy.get(`${buildItemsTableRowIdAttribute(id)} input`).click();
});
cy.wait(TABLE_ITEM_RENDER_TIME);
cy.get(`#${ITEMS_TABLE_MOVE_SELECTED_ITEMS_ID}`).click();
cy.fillTreeModal(toItemPath);
};
-
+
describe('Move Items in List', () => {
it('Move items on Home', () => {
cy.setUpApi(SAMPLE_ITEMS);
@@ -34,22 +31,22 @@ describe('Move Items in List', () => {
if (DEFAULT_ITEM_LAYOUT_MODE !== ITEM_LAYOUT_MODES.LIST) {
cy.switchMode(ITEM_LAYOUT_MODES.LIST);
}
-
+
// move
const itemIds = [SAMPLE_ITEMS.items[0].id, SAMPLE_ITEMS.items[5].id];
const { id: toItem, path: toItemPath } = SAMPLE_ITEMS.items[1];
moveItems({ itemIds, toItemPath });
-
+
cy.wait('@moveItems').then(({ request: { url, body } }) => {
- expect(body.parentId).to.equal(toItem);
- itemIds.forEach(movedItem => expect(url).to.contain(movedItem));
+ expect(body.parentId).to.equal(toItem);
+ itemIds.forEach((movedItem) => expect(url).to.contain(movedItem));
- itemIds.forEach(id => {
- cy.get(`#${buildItemsTableRowId(id)}`).should('not.exist');
- });
+ itemIds.forEach((id) => {
+ cy.get(`${buildItemsTableRowIdAttribute(id)}`).should('not.exist');
+ });
});
});
-
+
it('Move items in item', () => {
cy.setUpApi(SAMPLE_ITEMS);
const { id: start } = SAMPLE_ITEMS.items[0];
@@ -68,9 +65,9 @@ describe('Move Items in List', () => {
cy.wait('@moveItems').then(({ request: { body, url } }) => {
expect(body.parentId).to.equal(toItem);
- itemIds.forEach(movedItem => expect(url).to.contain(movedItem));
- itemIds.forEach(id => {
- cy.get(`#${buildItemsTableRowId(id)}`).should('not.exist');
+ itemIds.forEach((movedItem) => expect(url).to.contain(movedItem));
+ itemIds.forEach((id) => {
+ cy.get(`${buildItemsTableRowIdAttribute(id)}`).should('not.exist');
});
});
});
@@ -93,14 +90,14 @@ describe('Move Items in List', () => {
cy.wait('@moveItems').then(({ request: { body, url } }) => {
expect(body.parentId).to.equal(undefined);
- itemIds.forEach(movedItem => expect(url).to.contain(movedItem));
-
- itemIds.forEach(id => {
- cy.get(`#${buildItemsTableRowId(id)}`).should('not.exist');
+ itemIds.forEach((movedItem) => expect(url).to.contain(movedItem));
+
+ itemIds.forEach((id) => {
+ cy.get(`${buildItemsTableRowIdAttribute(id)}`).should('not.exist');
});
});
});
-
+
describe('Error handling', () => {
it('error while moving items does not create in interface', () => {
cy.setUpApi({ ...SAMPLE_ITEMS, moveItemsError: true });
@@ -120,11 +117,10 @@ describe('Move Items in List', () => {
cy.wait('@moveItems').then(() => {
// check item is still there
- itemIds.forEach(id => {
- cy.get(`#${buildItemsTableRowId(id)}`).should('exist');
+ itemIds.forEach((id) => {
+ cy.get(`${buildItemsTableRowIdAttribute(id)}`).should('exist');
});
});
});
});
});
-
\ No newline at end of file
diff --git a/cypress/integration/item/order/reorderItems.spec.js b/cypress/integration/item/order/reorderItems.spec.js
index 6563a3d97..ab2f1b9e9 100644
--- a/cypress/integration/item/order/reorderItems.spec.js
+++ b/cypress/integration/item/order/reorderItems.spec.js
@@ -1,16 +1,13 @@
import { buildItemPath } from '../../../../src/config/paths';
-import { ITEM_REORDER_ITEMS, ORDERED_ITEMS } from '../../../fixtures/items';
-import {
- buildItemsTableRowId,
- ITEMS_TABLE_BODY,
-} from '../../../../src/config/selectors';
+import { ITEM_REORDER_ITEMS } from '../../../fixtures/items';
+import { buildRowDraggerId } from '../../../../src/config/selectors';
import { TABLE_ITEM_RENDER_TIME, ROW_HEIGHT } from '../../../support/constants';
const reorderAndCheckItem = (id, currentPosition, newPosition) => {
- const childEl = `#${buildItemsTableRowId(id)}`;
+ const dragIcon = `#${buildRowDraggerId(id)}`;
cy.wait(TABLE_ITEM_RENDER_TIME);
- cy.dragAndDrop(childEl, 0, (newPosition - currentPosition) * ROW_HEIGHT);
+ cy.dragAndDrop(dragIcon, 0, (newPosition - currentPosition) * ROW_HEIGHT);
cy.wait('@editItem').then(
({
@@ -59,23 +56,4 @@ describe('Order Items', () => {
reorderAndCheckItem(childId, currentPosition, newPosition);
});
});
-
- describe('Check Order', () => {
- it('check item order in folder with non-existing item in ordering', () => {
- cy.setUpApi({
- items: [ORDERED_ITEMS.parent, ...ORDERED_ITEMS.children],
- });
-
- cy.visit(buildItemPath(ORDERED_ITEMS.parent.id));
-
- const tableBody = `#${ITEMS_TABLE_BODY}`;
-
- ORDERED_ITEMS.existingChildrenOrder.forEach((id, index) => {
- cy.get(tableBody)
- .children()
- .eq(index)
- .should('have.id', buildItemsTableRowId(id));
- });
- });
- });
});
diff --git a/cypress/integration/item/search/listItemSearch.spec.js b/cypress/integration/item/search/listItemSearch.spec.js
index 97bfb767f..f51026dc5 100644
--- a/cypress/integration/item/search/listItemSearch.spec.js
+++ b/cypress/integration/item/search/listItemSearch.spec.js
@@ -1,6 +1,6 @@
import { buildItemPath } from '../../../../src/config/paths';
import {
- buildItemsTableRowId,
+ buildItemsTableRowIdAttribute,
ITEM_SEARCH_INPUT_ID,
} from '../../../../src/config/selectors';
import { SAMPLE_ITEMS } from '../../../fixtures/items';
@@ -22,7 +22,7 @@ describe('Search Item in Table', () => {
cy.wait('@getChildren').then(({ response: { body } }) => {
// check item is created and displayed
for (const item of body) {
- cy.get(`#${buildItemsTableRowId(item.id)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(item.id)).should('exist');
}
});
@@ -31,8 +31,8 @@ describe('Search Item in Table', () => {
.type(child3.name)
.then(() => {
// should find child3 but not child4
- cy.get(`#${buildItemsTableRowId(child3.id)}`).should('exist');
- cy.get(`#${buildItemsTableRowId(child4.id)}`).should('not.exist');
+ cy.get(buildItemsTableRowIdAttribute(child3.id)).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(child4.id)).should('not.exist');
});
// erase search
@@ -40,8 +40,8 @@ describe('Search Item in Table', () => {
.clear()
.then(() => {
// should find all children again
- cy.get(`#${buildItemsTableRowId(child3.id)}`).should('exist');
- cy.get(`#${buildItemsTableRowId(child4.id)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(child3.id)).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(child4.id)).should('exist');
});
});
});
diff --git a/cypress/integration/item/view/viewFile.spec.js b/cypress/integration/item/view/viewFile.spec.js
index a4c153e1f..5510857ea 100644
--- a/cypress/integration/item/view/viewFile.spec.js
+++ b/cypress/integration/item/view/viewFile.spec.js
@@ -1,7 +1,7 @@
import { DEFAULT_ITEM_LAYOUT_MODE } from '../../../../src/config/constants';
import { ITEM_LAYOUT_MODES } from '../../../../src/enums';
import { HOME_PATH } from '../../../../src/config/paths';
-import { buildItemsTableRowId } from '../../../../src/config/selectors';
+import { buildItemsTableRowIdAttribute } from '../../../../src/config/selectors';
import {
IMAGE_ITEM_DEFAULT,
IMAGE_ITEM_S3,
@@ -25,7 +25,9 @@ describe('Files', () => {
});
it('image', () => {
// item is displayed in table
- cy.get(`#${buildItemsTableRowId(IMAGE_ITEM_DEFAULT.id)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(IMAGE_ITEM_DEFAULT.id)).should(
+ 'exist',
+ );
// item metadata
cy.goToItemInList(IMAGE_ITEM_DEFAULT.id);
@@ -34,7 +36,9 @@ describe('Files', () => {
it('video', () => {
// item is displayed in table
- cy.get(`#${buildItemsTableRowId(VIDEO_ITEM_DEFAULT.id)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(VIDEO_ITEM_DEFAULT.id)).should(
+ 'exist',
+ );
// item metadata
cy.goToItemInList(VIDEO_ITEM_DEFAULT.id);
@@ -43,7 +47,9 @@ describe('Files', () => {
it('pdf', () => {
// item is displayed in table
- cy.get(`#${buildItemsTableRowId(PDF_ITEM_DEFAULT.id)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(PDF_ITEM_DEFAULT.id)).should(
+ 'exist',
+ );
// item metadata
cy.goToItemInList(PDF_ITEM_DEFAULT.id);
@@ -63,7 +69,7 @@ describe('Files', () => {
});
it('image', () => {
// item is displayed in table
- cy.get(`#${buildItemsTableRowId(IMAGE_ITEM_S3.id)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(IMAGE_ITEM_S3.id)).should('exist');
// item metadata
cy.goToItemInList(IMAGE_ITEM_S3.id);
@@ -72,7 +78,7 @@ describe('Files', () => {
it('video', () => {
// item is displayed in table
- cy.get(`#${buildItemsTableRowId(VIDEO_ITEM_S3.id)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(VIDEO_ITEM_S3.id)).should('exist');
// item metadata
cy.goToItemInList(VIDEO_ITEM_S3.id);
@@ -81,7 +87,7 @@ describe('Files', () => {
it('pdf', () => {
// item is displayed in table
- cy.get(`#${buildItemsTableRowId(PDF_ITEM_S3.id)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(PDF_ITEM_S3.id)).should('exist');
// item metadata
cy.goToItemInList(PDF_ITEM_S3.id);
diff --git a/cypress/integration/item/view/viewFolder.spec.js b/cypress/integration/item/view/viewFolder.spec.js
index 5fc195e7f..1b3821f89 100644
--- a/cypress/integration/item/view/viewFolder.spec.js
+++ b/cypress/integration/item/view/viewFolder.spec.js
@@ -5,14 +5,14 @@ import {
import { buildItemPath, HOME_PATH } from '../../../../src/config/paths';
import {
buildItemCard,
- buildItemsTableRowId,
+ buildItemsTableRowIdAttribute,
ITEMS_GRID_ITEMS_PER_PAGE_SELECT_ID,
ITEMS_GRID_ITEMS_PER_PAGE_SELECT_LABEL_ID,
ITEMS_GRID_NO_ITEM_ID,
ITEMS_GRID_PAGINATION_ID,
- ITEMS_TABLE_EMPTY_ROW_ID,
ITEM_SCREEN_ERROR_ALERT_ID,
NAVIGATION_HOME_LINK_ID,
+ ITEMS_TABLE_ROW,
} from '../../../../src/config/selectors';
import { ITEM_LAYOUT_MODES } from '../../../../src/enums';
import { IMAGE_ITEM_DEFAULT, VIDEO_ITEM_S3 } from '../../../fixtures/files';
@@ -195,7 +195,7 @@ describe('View Folder', () => {
cy.wait('@getOwnItems').then(({ response: { body } }) => {
// check item is created and displayed
for (const item of body) {
- cy.get(`#${buildItemsTableRowId(item.id)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(item.id)).should('exist');
}
});
@@ -207,7 +207,7 @@ describe('View Folder', () => {
cy.wait('@getChildren').then(({ response: { body } }) => {
// check item is created and displayed
for (const item of body) {
- cy.get(`#${buildItemsTableRowId(item.id)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(item.id)).should('exist');
}
});
@@ -216,7 +216,7 @@ describe('View Folder', () => {
cy.goToItemInList(childChildId);
// expect no children
- cy.get(`#${ITEMS_TABLE_EMPTY_ROW_ID}`).should('exist');
+ cy.get(ITEMS_TABLE_ROW).should('not.exist');
// return parent with navigation and should display children
cy.goToItemWithNavigation(childId);
@@ -224,7 +224,7 @@ describe('View Folder', () => {
cy.wait('@getChildren').then(({ response: { body } }) => {
// check item is created and displayed
for (const item of body) {
- cy.get(`#${buildItemsTableRowId(item.id)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(item.id)).should('exist');
}
});
});
@@ -247,7 +247,7 @@ describe('View Folder', () => {
cy.wait('@getChildren').then(({ response: { body } }) => {
// check item is created and displayed
for (const item of body) {
- cy.get(`#${buildItemsTableRowId(item.id)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(item.id)).should('exist');
}
});
@@ -258,7 +258,7 @@ describe('View Folder', () => {
cy.wait('@getOwnItems').then(({ response: { body } }) => {
// check item is created and displayed
for (const item of body) {
- cy.get(`#${buildItemsTableRowId(item.id)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(item.id)).should('exist');
}
});
});
diff --git a/cypress/integration/ws/item.spec.js b/cypress/integration/ws/item.spec.js
index 2f939d480..91a1f4869 100644
--- a/cypress/integration/ws/item.spec.js
+++ b/cypress/integration/ws/item.spec.js
@@ -1,6 +1,6 @@
import { WebSocket } from '@graasp/websockets/test/mock-client';
import { buildItemPath, SHARED_ITEMS_PATH } from '../../../src/config/paths';
-import { buildItemsTableRowId } from '../../../src/config/selectors';
+import { buildItemsTableRowIdAttribute } from '../../../src/config/selectors';
import { SAMPLE_ITEMS } from '../../fixtures/items';
import { CURRENT_USER } from '../../fixtures/members';
import { WEBSOCKETS_DELAY_TIME } from '../../support/constants';
@@ -47,7 +47,7 @@ describe('Websocket interactions', () => {
cy.wait(WEBSOCKETS_DELAY_TIME);
// assert item is in list
- cy.get(`#${buildItemsTableRowId(item.id)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(item.id)).should('exist');
});
it('displays sharedWith delete update', () => {
@@ -59,7 +59,7 @@ describe('Websocket interactions', () => {
const item = items[0];
beforeWs(SHARED_ITEMS_PATH, { items }, client);
- cy.get(`#${buildItemsTableRowId(item.id)}`).then(() => {
+ cy.get(buildItemsTableRowIdAttribute(item.id)).then(() => {
// send mock sharedItem delete update
client.receive({
realm: 'notif',
@@ -76,7 +76,7 @@ describe('Websocket interactions', () => {
cy.wait(WEBSOCKETS_DELAY_TIME);
// assert item is not in list anymore
- cy.get(`#${buildItemsTableRowId(item.id)}`).should('not.exist');
+ cy.get(buildItemsTableRowIdAttribute(item.id)).should('not.exist');
});
});
@@ -90,7 +90,7 @@ describe('Websocket interactions', () => {
cy.wait('@getChildren').then(({ response: { body } }) => {
// check item is created and displayed
for (const item of body) {
- cy.get(`#${buildItemsTableRowId(item.id)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(item.id)).should('exist');
}
});
});
@@ -112,7 +112,7 @@ describe('Websocket interactions', () => {
cy.wait(WEBSOCKETS_DELAY_TIME);
// assert item is in list
- cy.get(`#${buildItemsTableRowId(item.id)}`).should('exist');
+ cy.get(buildItemsTableRowIdAttribute(item.id)).should('exist');
});
it('displays childItem delete update', () => {
@@ -133,7 +133,7 @@ describe('Websocket interactions', () => {
cy.wait(WEBSOCKETS_DELAY_TIME);
// assert item is not in list
- cy.get(`#${buildItemsTableRowId(item.id)}`).should('not.exist');
+ cy.get(buildItemsTableRowIdAttribute(item.id)).should('not.exist');
});
});
});
diff --git a/cypress/support/commands/navigation.js b/cypress/support/commands/navigation.js
index 8f473fdf0..454f556dd 100644
--- a/cypress/support/commands/navigation.js
+++ b/cypress/support/commands/navigation.js
@@ -1,6 +1,6 @@
import {
buildItemLink,
- buildItemsTableRowId,
+ buildItemsTableRowIdAttribute,
buildNavigationLink,
NAVIGATION_HIDDEN_PARENTS_ID,
NAVIGATION_HOME_LINK_ID,
@@ -14,7 +14,7 @@ Cypress.Commands.add('goToItemInGrid', (id) => {
Cypress.Commands.add('goToItemInList', (id) => {
cy.wait(NAVIGATE_PAUSE);
- cy.get(`#${buildItemsTableRowId(id)}`, {
+ cy.get(buildItemsTableRowIdAttribute(id), {
timeout: WAIT_FOR_ITEM_TABLE_ROW_TIME,
}).click();
});
diff --git a/cypress/support/constants.js b/cypress/support/constants.js
index 766fc9798..204529e66 100644
--- a/cypress/support/constants.js
+++ b/cypress/support/constants.js
@@ -1,7 +1,7 @@
export const CREATE_ITEM_PAUSE = 1000;
export const EDIT_ITEM_PAUSE = 1000;
export const ITEM_LOGIN_PAUSE = 1000;
-export const NAVIGATE_PAUSE = 500;
+export const NAVIGATE_PAUSE = 1000;
export const PAGE_LOAD_WAITING_PAUSE = 3000;
export const REQUEST_FAILURE_LOADING_TIME = 1500;
export const TREE_VIEW_PAUSE = 2000;
@@ -14,5 +14,5 @@ export const REQUEST_FAILURE_TIME = 2500;
export const REDIRECTION_TIME = 500;
export const CAPTION_EDIT_PAUSE = 2000;
-export const ROW_HEIGHT = 93;
+export const ROW_HEIGHT = 48;
export const TABLE_ITEM_RENDER_TIME = 2000;
diff --git a/package.json b/package.json
index 8d0df1e83..0a0ea5782 100644
--- a/package.json
+++ b/package.json
@@ -17,6 +17,8 @@
"@uppy/react": "1.11.3",
"@uppy/tus": "1.8.5",
"@uppy/xhr-upload": "1.7.0",
+ "ag-grid-community": "25.3.0",
+ "ag-grid-react": "25.3.0",
"clsx": "1.1.1",
"connected-react-router": "6.8.0",
"dexie": "3.0.3",
diff --git a/src/components/common/DraggableTableRow.js b/src/components/common/DraggableTableRow.js
deleted file mode 100644
index d01653ec2..000000000
--- a/src/components/common/DraggableTableRow.js
+++ /dev/null
@@ -1,42 +0,0 @@
-import { Draggable } from 'react-beautiful-dnd';
-import { TableRow } from '@material-ui/core';
-import React from 'react';
-
-const getItemStyle = (isDragging, draggableStyle) => ({
- ...draggableStyle,
-
- ...(isDragging && {
- background: 'rgb(235,235,235)',
- }),
-});
-
-const getVisibleChildren = (props, isDragging) => {
- if (isDragging) {
- // On drag, only the checkbox and item name will be shown in the row
- const checkbox = props.children[0];
- const name = props.children[1][0];
- return [checkbox, name];
- }
- return props.children;
-};
-
-const DraggableTableRow = (id, index) => (props) => (
-
- {(provided, snapshot) => (
-
- {getVisibleChildren(props, snapshot.isDragging)}
-
- )}
-
-);
-
-export default DraggableTableRow;
diff --git a/src/components/common/DroppableTableBody.js b/src/components/common/DroppableTableBody.js
deleted file mode 100644
index 10d72d808..000000000
--- a/src/components/common/DroppableTableBody.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import { DragDropContext, Droppable } from 'react-beautiful-dnd';
-import { TableBody } from '@material-ui/core';
-import React from 'react';
-
-const DroppableTableBody = (onDragEnd) => (props) => (
-
-
- {(provided) => (
-
- {/* eslint-disable-next-line react/prop-types */}
- {props.children}
- {provided.placeholder}
-
- )}
-
-
-);
-
-export default DroppableTableBody;
diff --git a/src/components/common/EditButton.js b/src/components/common/EditButton.js
index 2d372d6e2..72ece049d 100644
--- a/src/components/common/EditButton.js
+++ b/src/components/common/EditButton.js
@@ -4,7 +4,10 @@ import IconButton from '@material-ui/core/IconButton';
import EditIcon from '@material-ui/icons/Edit';
import { useTranslation } from 'react-i18next';
import Tooltip from '@material-ui/core/Tooltip';
-import { EDIT_ITEM_BUTTON_CLASS } from '../../config/selectors';
+import {
+ buildEditButtonId,
+ EDIT_ITEM_BUTTON_CLASS,
+} from '../../config/selectors';
import { EditItemModalContext } from '../context/EditItemModalContext';
const EditButton = ({ item }) => {
@@ -18,6 +21,7 @@ const EditButton = ({ item }) => {
return (
{
};
EditButton.propTypes = {
- item: PropTypes.shape({}).isRequired,
+ item: PropTypes.shape({ id: PropTypes.string.isRequired }).isRequired,
};
export default EditButton;
diff --git a/src/components/item/ItemContent.js b/src/components/item/ItemContent.js
index 067348f64..b2991d3cd 100644
--- a/src/components/item/ItemContent.js
+++ b/src/components/item/ItemContent.js
@@ -54,7 +54,9 @@ const ItemContent = ({ item, enableEdition }) => {
const { data: user, isLoading: isLoadingUser } = useCurrentMember();
// display children
- const { data: children, isLoading: isLoadingChildren } = useChildren(itemId);
+ const { data: children, isLoading: isLoadingChildren } = useChildren(itemId, {
+ ordered: true,
+ });
const id = item?.get(ITEM_KEYS.ID);
const { data: content, isLoading: isLoadingFileContent } = useFileContent(
diff --git a/src/components/item/ItemSearch.js b/src/components/item/ItemSearch.js
index 98136a882..96251424c 100644
--- a/src/components/item/ItemSearch.js
+++ b/src/components/item/ItemSearch.js
@@ -107,7 +107,7 @@ const useItemSearch = (items) => {
};
const results = items.filter((it) =>
- it.name.toLowerCase().includes(searchText),
+ it?.name?.toLowerCase().includes(searchText),
);
const itemSearchInput = (
diff --git a/src/components/main/Item.js b/src/components/main/Item.js
index af1ad37ac..89f3b02cc 100644
--- a/src/components/main/Item.js
+++ b/src/components/main/Item.js
@@ -9,7 +9,7 @@ import CardActions from '@material-ui/core/CardActions';
import Typography from '@material-ui/core/Typography';
import CustomCardHeader from './CustomCardHeader';
import { DESCRIPTION_MAX_LENGTH } from '../../config/constants';
-import { buildItemCard } from '../../config/selectors';
+import { buildDeleteButtonId, buildItemCard } from '../../config/selectors';
import EditButton from '../common/EditButton';
import DeleteButton from '../common/DeleteButton';
import { getItemImage } from '../../utils/item';
@@ -48,7 +48,7 @@ const Item = ({ item }) => {
-
+
);
diff --git a/src/components/main/ItemMenu.js b/src/components/main/ItemMenu.js
index d6d26e41a..4cce38aa8 100644
--- a/src/components/main/ItemMenu.js
+++ b/src/components/main/ItemMenu.js
@@ -7,6 +7,7 @@ import React, { useContext } from 'react';
import { useTranslation } from 'react-i18next';
import {
buildItemMenu,
+ buildItemMenuButtonId,
ITEM_MENU_BUTTON_CLASS,
ITEM_MENU_COPY_BUTTON_CLASS,
ITEM_MENU_FLAG_BUTTON_CLASS,
@@ -58,7 +59,11 @@ const ItemMenu = ({ item }) => {
return (
<>
-
+