/src/test/setup.tsx"
- ],
- "testURL": "http://localhost:8065"
- },
"devDependencies": {
"@babel/cli": "7.17.6",
"@babel/core": "7.17.8",
@@ -130,33 +78,34 @@
"@babel/runtime": "7.17.8",
"@formatjs/cli": "^4.8.2",
"@formatjs/ts-transformer": "^3.9.2",
- "@swc/jest": "^0.2.24",
- "@testing-library/dom": "^8.11.4",
- "@testing-library/jest-dom": "^5.16.3",
- "@testing-library/react": "^11.2.5",
- "@testing-library/user-event": "^13.5.0",
+ "@swc/core": "1.3.40",
+ "@swc/jest": "0.2.24",
+ "@testing-library/dom": "8.20.0",
+ "@testing-library/jest-dom": "5.16.5",
+ "@testing-library/react": "12.1.5",
+ "@testing-library/user-event": "14.4.3",
"@types/color": "^3.0.3",
"@types/draft-js": "^0.11.9",
"@types/emoji-mart": "^3.0.9",
"@types/enzyme": "3.10.11",
- "@types/jest": "27.4.1",
+ "@types/jest": "29.4.2",
"@types/lodash": "4.14.182",
"@types/marked": "^4.0.3",
"@types/nanoevents": "^1.0.0",
- "@types/node": "17.0.23",
- "@types/react": "^17.0.43",
+ "@types/node": "16.11.7",
+ "@types/react": "17.0.53",
"@types/react-beautiful-dnd": "^13.1.2",
- "@types/react-dom": "^17.0.14",
+ "@types/react-day-picker": "5.3.0",
+ "@types/react-dom": "17.0.19",
"@types/react-redux": "^7.1.23",
"@types/react-router-dom": "^5.3.3",
"@types/react-transition-group": "4.4.4",
"@types/redux-mock-store": "1.0.3",
- "@typescript-eslint/eslint-plugin": "5.16.0",
- "@typescript-eslint/parser": "5.16.0",
- "babel-eslint": "10.1.0",
+ "@typescript-eslint/eslint-plugin": "5.57.1",
+ "@typescript-eslint/parser": "5.57.1",
+ "babel-eslint": "10.1.0",
"cross-env": "^7.0.3",
"css-loader": "6.7.1",
- "eslint": "^8.11.0",
"eslint-import-resolver-webpack": "0.13.2",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-formatjs": "4.9.0",
@@ -168,7 +117,7 @@
"eslint-plugin-react": "7.29.4",
"eslint-plugin-react-hooks": "4.3.0",
"eslint-plugin-unused-imports": "2.0.0",
- "fetch-mock-jest": "^1.5.1",
+ "fetch-mock-jest": "1.5.1",
"identity-obj-proxy": "3.0.0",
"image-webpack-loader": "8.1.0",
"imagemin-gifsicle": "^7.0.0",
@@ -178,10 +127,12 @@
"imagemin-svgo": "^10.0.1",
"imagemin-webp": "7.0.0",
"isomorphic-fetch": "3.0.0",
- "jest": "27.5.1",
- "jest-canvas-mock": "2.3.1",
- "jest-junit": "13.0.0",
- "jest-mock": "27.5.1",
+ "jest": "29.5.0",
+ "jest-canvas-mock": "2.4.0",
+ "jest-environment-jsdom": "29.5.0",
+ "jest-fail-on-console": "3.0.2",
+ "jest-junit": "15.0.0",
+ "jest-mock": "29.4.3",
"prettier": "^2.6.1",
"redux-mock-store": "^1.5.4",
"sass": "1.49.9",
diff --git a/webapp/boards/src/blocks/__snapshots__/block.test.ts.snap b/webapp/boards/src/blocks/__snapshots__/block.test.ts.snap
index 0250dae8d2..ed6cd80e54 100644
--- a/webapp/boards/src/blocks/__snapshots__/block.test.ts.snap
+++ b/webapp/boards/src/blocks/__snapshots__/block.test.ts.snap
@@ -1,46 +1,46 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`block tests correctly generate patches from two blocks should add fields on the new fields added and remove it in the undo 1`] = `
-Array [
- Object {
- "deletedFields": Array [],
- "updatedFields": Object {
+[
+ {
+ "deletedFields": [],
+ "updatedFields": {
"newField": "new field",
},
},
- Object {
- "deletedFields": Array [
+ {
+ "deletedFields": [
"newField",
],
- "updatedFields": Object {},
+ "updatedFields": {},
},
]
`;
exports[`block tests correctly generate patches from two blocks should generate two empty patches for the same block 1`] = `
-Array [
- Object {
- "deletedFields": Array [],
- "updatedFields": Object {},
+[
+ {
+ "deletedFields": [],
+ "updatedFields": {},
},
- Object {
- "deletedFields": Array [],
- "updatedFields": Object {},
+ {
+ "deletedFields": [],
+ "updatedFields": {},
},
]
`;
exports[`block tests correctly generate patches from two blocks should remove field on the new block added and add it again in the undo 1`] = `
-Array [
- Object {
- "deletedFields": Array [
+[
+ {
+ "deletedFields": [
"test",
],
- "updatedFields": Object {},
+ "updatedFields": {},
},
- Object {
- "deletedFields": Array [],
- "updatedFields": Object {
+ {
+ "deletedFields": [],
+ "updatedFields": {
"test": "test",
},
},
@@ -48,16 +48,16 @@ Array [
`;
exports[`block tests correctly generate patches from two blocks should update propertie on the main object and revert it back on the undo 1`] = `
-Array [
- Object {
- "deletedFields": Array [],
+[
+ {
+ "deletedFields": [],
"parentId": "new-parent-id",
- "updatedFields": Object {},
+ "updatedFields": {},
},
- Object {
- "deletedFields": Array [],
+ {
+ "deletedFields": [],
"parentId": "old-parent-id",
- "updatedFields": Object {},
+ "updatedFields": {},
},
]
`;
diff --git a/webapp/boards/src/blocks/__snapshots__/board.test.ts.snap b/webapp/boards/src/blocks/__snapshots__/board.test.ts.snap
index 65c113819a..c5042946da 100644
--- a/webapp/boards/src/blocks/__snapshots__/board.test.ts.snap
+++ b/webapp/boards/src/blocks/__snapshots__/board.test.ts.snap
@@ -1,52 +1,52 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`board tests correctly generate patches for boards and blocks should add fields on update and remove it in the undo 1`] = `
-Array [
- Object {
- "blockIDs": Array [
+[
+ {
+ "blockIDs": [
"test-old-block-id",
],
- "blockPatches": Array [
- Object {
- "deletedFields": Array [],
- "updatedFields": Object {
+ "blockPatches": [
+ {
+ "deletedFields": [],
+ "updatedFields": {
"newField": "new field",
},
},
],
- "boardIDs": Array [
+ "boardIDs": [
"test-board-id",
],
- "boardPatches": Array [
- Object {
- "deletedCardProperties": Array [],
- "deletedProperties": Array [],
- "updatedCardProperties": Array [],
- "updatedProperties": Object {},
+ "boardPatches": [
+ {
+ "deletedCardProperties": [],
+ "deletedProperties": [],
+ "updatedCardProperties": [],
+ "updatedProperties": {},
},
],
},
- Object {
- "blockIDs": Array [
+ {
+ "blockIDs": [
"test-old-block-id",
],
- "blockPatches": Array [
- Object {
- "deletedFields": Array [
+ "blockPatches": [
+ {
+ "deletedFields": [
"newField",
],
- "updatedFields": Object {},
+ "updatedFields": {},
},
],
- "boardIDs": Array [
+ "boardIDs": [
"test-board-id",
],
- "boardPatches": Array [
- Object {
- "deletedCardProperties": Array [],
- "deletedProperties": Array [],
- "updatedCardProperties": Array [],
- "updatedProperties": Object {},
+ "boardPatches": [
+ {
+ "deletedCardProperties": [],
+ "deletedProperties": [],
+ "updatedCardProperties": [],
+ "updatedProperties": {},
},
],
},
@@ -54,48 +54,48 @@ Array [
`;
exports[`board tests correctly generate patches for boards and blocks should generate two empty patches for the same board and block 1`] = `
-Array [
- Object {
- "blockIDs": Array [
+[
+ {
+ "blockIDs": [
"test-card-id",
],
- "blockPatches": Array [
- Object {
- "deletedFields": Array [],
- "updatedFields": Object {},
+ "blockPatches": [
+ {
+ "deletedFields": [],
+ "updatedFields": {},
},
],
- "boardIDs": Array [
+ "boardIDs": [
"test-board-id",
],
- "boardPatches": Array [
- Object {
- "deletedCardProperties": Array [],
- "deletedProperties": Array [],
- "updatedCardProperties": Array [],
- "updatedProperties": Object {},
+ "boardPatches": [
+ {
+ "deletedCardProperties": [],
+ "deletedProperties": [],
+ "updatedCardProperties": [],
+ "updatedProperties": {},
},
],
},
- Object {
- "blockIDs": Array [
+ {
+ "blockIDs": [
"test-card-id",
],
- "blockPatches": Array [
- Object {
- "deletedFields": Array [],
- "updatedFields": Object {},
+ "blockPatches": [
+ {
+ "deletedFields": [],
+ "updatedFields": {},
},
],
- "boardIDs": Array [
+ "boardIDs": [
"test-board-id",
],
- "boardPatches": Array [
- Object {
- "deletedCardProperties": Array [],
- "deletedProperties": Array [],
- "updatedCardProperties": Array [],
- "updatedProperties": Object {},
+ "boardPatches": [
+ {
+ "deletedCardProperties": [],
+ "deletedProperties": [],
+ "updatedCardProperties": [],
+ "updatedProperties": {},
},
],
},
@@ -103,16 +103,16 @@ Array [
`;
exports[`board tests correctly generate patches from two boards should add card properties on the redo and remove them on the undo 1`] = `
-Array [
- Object {
- "deletedCardProperties": Array [],
- "deletedProperties": Array [],
- "updatedCardProperties": Array [
- Object {
+[
+ {
+ "deletedCardProperties": [],
+ "deletedProperties": [],
+ "updatedCardProperties": [
+ {
"id": "new-property-id",
"name": "property-name",
- "options": Array [
- Object {
+ "options": [
+ {
"color": "propColorYellow",
"id": "opt",
"value": "val",
@@ -121,30 +121,30 @@ Array [
"type": "select",
},
],
- "updatedProperties": Object {},
+ "updatedProperties": {},
},
- Object {
- "deletedCardProperties": Array [
+ {
+ "deletedCardProperties": [
"new-property-id",
],
- "deletedProperties": Array [],
- "updatedCardProperties": Array [],
- "updatedProperties": Object {},
+ "deletedProperties": [],
+ "updatedCardProperties": [],
+ "updatedProperties": {},
},
]
`;
exports[`board tests correctly generate patches from two boards should add card properties on the redo and undo if they exists in both, but differ 1`] = `
-Array [
- Object {
- "deletedCardProperties": Array [],
- "deletedProperties": Array [],
- "updatedCardProperties": Array [
- Object {
+[
+ {
+ "deletedCardProperties": [],
+ "deletedProperties": [],
+ "updatedCardProperties": [
+ {
"id": "new-property-id",
"name": "property-name",
- "options": Array [
- Object {
+ "options": [
+ {
"color": "propColorYellow",
"id": "opt",
"value": "val",
@@ -153,17 +153,17 @@ Array [
"type": "select",
},
],
- "updatedProperties": Object {},
+ "updatedProperties": {},
},
- Object {
- "deletedCardProperties": Array [],
- "deletedProperties": Array [],
- "updatedCardProperties": Array [
- Object {
+ {
+ "deletedCardProperties": [],
+ "deletedProperties": [],
+ "updatedCardProperties": [
+ {
"id": "new-property-id",
"name": "a-different-name",
- "options": Array [
- Object {
+ "options": [
+ {
"color": "propColorYellow",
"id": "opt",
"value": "val",
@@ -172,22 +172,22 @@ Array [
"type": "select",
},
],
- "updatedProperties": Object {},
+ "updatedProperties": {},
},
]
`;
exports[`board tests correctly generate patches from two boards should add card properties on the redo and undo if they exists in both, but their options are different 1`] = `
-Array [
- Object {
- "deletedCardProperties": Array [],
- "deletedProperties": Array [],
- "updatedCardProperties": Array [
- Object {
+[
+ {
+ "deletedCardProperties": [],
+ "deletedProperties": [],
+ "updatedCardProperties": [
+ {
"id": "new-property-id",
"name": "property-name",
- "options": Array [
- Object {
+ "options": [
+ {
"color": "propColorYellow",
"id": "opt",
"value": "val",
@@ -196,17 +196,17 @@ Array [
"type": "select",
},
],
- "updatedProperties": Object {},
+ "updatedProperties": {},
},
- Object {
- "deletedCardProperties": Array [],
- "deletedProperties": Array [],
- "updatedCardProperties": Array [
- Object {
+ {
+ "deletedCardProperties": [],
+ "deletedProperties": [],
+ "updatedCardProperties": [
+ {
"id": "new-property-id",
"name": "property-name",
- "options": Array [
- Object {
+ "options": [
+ {
"color": "propColorBrown",
"id": "another-opt",
"value": "val",
@@ -215,45 +215,45 @@ Array [
"type": "select",
},
],
- "updatedProperties": Object {},
+ "updatedProperties": {},
},
]
`;
exports[`board tests correctly generate patches from two boards should add properties on the update patch and remove them on the undo 1`] = `
-Array [
- Object {
- "deletedCardProperties": Array [],
- "deletedProperties": Array [],
- "updatedCardProperties": Array [],
- "updatedProperties": Object {
+[
+ {
+ "deletedCardProperties": [],
+ "deletedProperties": [],
+ "updatedCardProperties": [],
+ "updatedProperties": {
"prop1": "val1",
},
},
- Object {
- "deletedCardProperties": Array [],
- "deletedProperties": Array [
+ {
+ "deletedCardProperties": [],
+ "deletedProperties": [
"prop1",
],
- "updatedCardProperties": Array [],
- "updatedProperties": Object {},
+ "updatedCardProperties": [],
+ "updatedProperties": {},
},
]
`;
exports[`board tests correctly generate patches from two boards should generate two empty patches for the same board 1`] = `
-Array [
- Object {
- "deletedCardProperties": Array [],
- "deletedProperties": Array [],
- "updatedCardProperties": Array [],
- "updatedProperties": Object {},
+[
+ {
+ "deletedCardProperties": [],
+ "deletedProperties": [],
+ "updatedCardProperties": [],
+ "updatedProperties": {},
},
- Object {
- "deletedCardProperties": Array [],
- "deletedProperties": Array [],
- "updatedCardProperties": Array [],
- "updatedProperties": Object {},
+ {
+ "deletedCardProperties": [],
+ "deletedProperties": [],
+ "updatedCardProperties": [],
+ "updatedProperties": {},
},
]
`;
diff --git a/webapp/boards/src/cardFilter.test.ts b/webapp/boards/src/cardFilter.test.ts
index 2bb0037982..4a2f89e695 100644
--- a/webapp/boards/src/cardFilter.test.ts
+++ b/webapp/boards/src/cardFilter.test.ts
@@ -12,7 +12,7 @@ import {Utils} from './utils'
import {IPropertyTemplate} from './blocks/board'
jest.mock('./utils')
-const mockedUtils = mocked(Utils, true)
+const mockedUtils = mocked(Utils)
const dayMillis = 24 * 60 * 60 * 1000
diff --git a/webapp/boards/src/components/__snapshots__/cardDialog.test.tsx.snap b/webapp/boards/src/components/__snapshots__/cardDialog.test.tsx.snap
index defa8ebfd9..a776379da7 100644
--- a/webapp/boards/src/components/__snapshots__/cardDialog.test.tsx.snap
+++ b/webapp/boards/src/components/__snapshots__/cardDialog.test.tsx.snap
@@ -434,7 +434,7 @@ exports[`components/cardDialog limited card shows hidden view (no toolbar) 1`] =
- Upgrade to our Professional or Enterprise plan to view archived cards, have unlimited views per boards, unlimited cards and more.
+ Upgrade to our Professional or Enterprise plan.
No name
@@ -982,7 +982,7 @@ exports[`components/centerPanel return centerPanel and click on card to show car
>
No name
@@ -1580,7 +1580,7 @@ exports[`components/centerPanel return centerPanel and click on new card to edit
No name
@@ -2102,7 +2102,7 @@ exports[`components/centerPanel return centerPanel and press touch 1 with readon
No name
@@ -2639,7 +2639,7 @@ exports[`components/centerPanel return centerPanel and press touch ctrl+d for on
No name
@@ -3298,7 +3298,7 @@ exports[`components/centerPanel return centerPanel and press touch del for one c
No name
@@ -3957,7 +3957,7 @@ exports[`components/centerPanel return centerPanel and press touch esc for one c
No name
@@ -4616,7 +4616,7 @@ exports[`components/centerPanel return centerPanel and press touch esc for one c
No name
@@ -5275,7 +5275,7 @@ exports[`components/centerPanel return centerPanel and press touch esc for two c
No name
@@ -5934,7 +5934,7 @@ exports[`components/centerPanel return centerPanel and press touch esc for two c
No name
@@ -6593,7 +6593,7 @@ exports[`components/centerPanel return centerPanel and press touch esc for two c
No name
@@ -7252,7 +7252,7 @@ exports[`components/centerPanel return centerPanel and select one card and click
No name
@@ -7911,7 +7911,7 @@ exports[`components/centerPanel return centerPanel and select one card and click
No name
@@ -8802,7 +8802,7 @@ exports[`components/centerPanel should match snapshot for Kanban 1`] = `
>
No name
@@ -9322,7 +9322,7 @@ exports[`components/centerPanel should match snapshot for Kanban, not shared 1`]
>
No name
@@ -9886,7 +9886,7 @@ exports[`components/centerPanel should match snapshot for Table 1`] = `
No name
diff --git a/webapp/boards/src/components/__snapshots__/confirmAddUserForNotifications.test.tsx.snap b/webapp/boards/src/components/__snapshots__/confirmAddUserForNotifications.test.tsx.snap
index 57e2675f46..300af43e75 100644
--- a/webapp/boards/src/components/__snapshots__/confirmAddUserForNotifications.test.tsx.snap
+++ b/webapp/boards/src/components/__snapshots__/confirmAddUserForNotifications.test.tsx.snap
@@ -54,7 +54,7 @@ exports[`/components/confirmAddUserForNotifications should match snapshot 1`] =
class="ConfirmAddUserForNotifications"
>
- fake-username is not a member of the board, and will not receive any notifications about it.
+ fake-username isn't a member of the board, and won't receive any notifications about it.
Do you want to add fake-username to the board?
diff --git a/webapp/boards/src/components/__snapshots__/personSelector.test.tsx.snap b/webapp/boards/src/components/__snapshots__/personSelector.test.tsx.snap
index 99d3590a01..5504446e64 100644
--- a/webapp/boards/src/components/__snapshots__/personSelector.test.tsx.snap
+++ b/webapp/boards/src/components/__snapshots__/personSelector.test.tsx.snap
@@ -1041,7 +1041,7 @@ exports[`properties/person show multiple, display modal 2`] = `
- option username-3 focused, 3 of 3. 1 result available. Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu, press Tab to select the option and exit the menu.
+ option username-3 focused, 1 of 1. 1 result available. Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu, press Tab to select the option and exit the menu.
`;
diff --git a/webapp/boards/src/components/__snapshots__/rhsChannelBoardItem.test.tsx.snap b/webapp/boards/src/components/__snapshots__/rhsChannelBoardItem.test.tsx.snap
index a66cf4de53..0687d6155e 100644
--- a/webapp/boards/src/components/__snapshots__/rhsChannelBoardItem.test.tsx.snap
+++ b/webapp/boards/src/components/__snapshots__/rhsChannelBoardItem.test.tsx.snap
@@ -110,7 +110,7 @@ exports[`components/rhsChannelBoardItem render board with menu open 1`] = `
@@ -530,7 +530,7 @@ Object {
`;
exports[`/components/viewMenu should match snapshot, read only 1`] = `
-Object {
+{
"asFragment": [Function],
"baseElement":
diff --git a/webapp/boards/src/components/__snapshots__/workspace.test.tsx.snap b/webapp/boards/src/components/__snapshots__/workspace.test.tsx.snap
index 7046615718..70c70b823c 100644
--- a/webapp/boards/src/components/__snapshots__/workspace.test.tsx.snap
+++ b/webapp/boards/src/components/__snapshots__/workspace.test.tsx.snap
@@ -46,7 +46,7 @@ exports[`src/components/workspace return workspace and showcard 1`] = `
/>
- Find Boards
+ Find boards
@@ -73,6 +73,7 @@ exports[`src/components/workspace return workspace and showcard 1`] = `
>
- Everyone at Test Team Team
+ Everyone at Test Team team
@@ -1937,11 +1937,11 @@ exports[`src/components/shareBoard/shareBoard return shareBoard and click Select
>
- http://localhost/undefined/team/team-id/1/1
+ http://localhost:8065/undefined/team/team-id/1/1
- option username_1 focused, 0 of 2. 8 results available. Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu, press Tab to select the option and exit the menu.
+ option username_1 focused, 1 of 8. 8 results available. Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu, press Tab to select the option and exit the menu.
- Everyone at Test Team Team
+ Everyone at Test Team team
@@ -2423,11 +2423,11 @@ exports[`src/components/shareBoard/shareBoard return shareBoard and click Select
>
- http://localhost/undefined/team/team-id/1/1
+ http://localhost:8065/undefined/team/team-id/1/1
- Share Template
+ Share template
- Everyone at Test Team Team
+ Everyone at Test Team team
@@ -2656,7 +2656,7 @@ exports[`src/components/shareBoard/shareBoard return shareBoard template and cli
- Share Template
+ Share template
- option username_1 focused, 0 of 1. 4 results available. Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu, press Tab to select the option and exit the menu.
+ option username_1 focused, 1 of 4. 4 results available. Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu, press Tab to select the option and exit the menu.
- Everyone at Test Team Team
+ Everyone at Test Team team
@@ -3074,7 +3074,7 @@ exports[`src/components/shareBoard/shareBoard return shareBoard, and click switc
class="ml-3"
>
- Everyone at Test Team Team
+ Everyone at Test Team team
@@ -3188,11 +3188,11 @@ exports[`src/components/shareBoard/shareBoard return shareBoard, and click switc
>
- http://localhost/team/team-id/shared/1/1?r=oneToken
+ http://localhost:8065/boards/public/team/team-id/shared/1/1?r=oneToken
- Everyone at Test Team Team
+ Everyone at Test Team team
@@ -3461,11 +3461,11 @@ exports[`src/components/shareBoard/shareBoard return shareBoardComponent and cli
>
- http://localhost/team/team-id/shared/1/1?r=aToken
+ http://localhost:8065/boards/public/team/team-id/shared/1/1?r=aToken
- Everyone at Test Team Team
+ Everyone at Test Team team
@@ -3725,11 +3725,11 @@ exports[`src/components/shareBoard/shareBoard should match snapshot 1`] = `
>
- http://localhost/undefined/team/team-id/1/1
+ http://localhost:8065/undefined/team/team-id/1/1
- Everyone at Test Team Team
+ Everyone at Test Team team
@@ -3975,11 +3975,11 @@ exports[`src/components/shareBoard/shareBoard should match snapshot with sharing
>
- http://localhost/undefined/team/team-id/1/1
+ http://localhost:8065/undefined/team/team-id/1/1
- Everyone at Test Team Team
+ Everyone at Test Team team
@@ -4225,11 +4225,11 @@ exports[`src/components/shareBoard/shareBoard should match snapshot with sharing
>
- http://localhost/undefined/team/team-id/1/1
+ http://localhost:8065/undefined/team/team-id/1/1
- Share Template
+ Share template
- Everyone at Test Team Team
+ Everyone at Test Team team
diff --git a/webapp/boards/src/components/shareBoard/__snapshots__/teamPermissionsRow.test.tsx.snap b/webapp/boards/src/components/shareBoard/__snapshots__/teamPermissionsRow.test.tsx.snap
index 44592e8442..c72be1b7de 100644
--- a/webapp/boards/src/components/shareBoard/__snapshots__/teamPermissionsRow.test.tsx.snap
+++ b/webapp/boards/src/components/shareBoard/__snapshots__/teamPermissionsRow.test.tsx.snap
@@ -15,7 +15,7 @@ exports[`src/components/shareBoard/teamPermissionsRow should match snapshot in p
class="ml-3"
>
- Everyone at Test Team Team
+ Everyone at Test Team team
@@ -228,7 +228,7 @@ exports[`src/components/shareBoard/teamPermissionsRow should match snapshot in t
class="ml-3"
>
- Everyone at Test Team Team
+ Everyone at Test Team team
diff --git a/webapp/boards/src/components/shareBoard/channelPermissionsRow.test.tsx b/webapp/boards/src/components/shareBoard/channelPermissionsRow.test.tsx
index 645ed36464..9d6e7bf2b7 100644
--- a/webapp/boards/src/components/shareBoard/channelPermissionsRow.test.tsx
+++ b/webapp/boards/src/components/shareBoard/channelPermissionsRow.test.tsx
@@ -17,13 +17,11 @@ import client from 'src/octoClient'
import ChannelPermissionsRow from './channelPermissionsRow'
-jest.useFakeTimers()
-
const boardId = '1'
jest.mock('src/octoClient')
-const mockedOctoClient = mocked(client, true)
+const mockedOctoClient = mocked(client)
const board = TestBlockFactory.createBoard()
board.id = boardId
@@ -126,7 +124,7 @@ describe('src/components/shareBoard/channelPermissionsRow', () => {
const buttonElement = container?.querySelector('.user-item__button')
expect(buttonElement).toBeDefined()
- userEvent.click(buttonElement!)
+ await userEvent.click(buttonElement!)
expect(container).toMatchSnapshot()
})
@@ -173,7 +171,7 @@ describe('src/components/shareBoard/channelPermissionsRow', () => {
const buttonElement = container?.querySelector('.user-item__button')
expect(buttonElement).toBeDefined()
- userEvent.click(buttonElement!)
+ await userEvent.click(buttonElement!)
expect(container).toMatchSnapshot()
})
@@ -204,7 +202,7 @@ describe('src/components/shareBoard/channelPermissionsRow', () => {
const buttonElement = container?.querySelector('.user-item__button')
expect(buttonElement).toBeDefined()
- userEvent.click(buttonElement!)
+ await userEvent.click(buttonElement!)
expect(container).toMatchSnapshot()
})
diff --git a/webapp/boards/src/components/shareBoard/shareBoard.test.tsx b/webapp/boards/src/components/shareBoard/shareBoard.test.tsx
index 86c466e115..29fb0a47d3 100644
--- a/webapp/boards/src/components/shareBoard/shareBoard.test.tsx
+++ b/webapp/boards/src/components/shareBoard/shareBoard.test.tsx
@@ -19,8 +19,6 @@ import {Utils} from 'src/utils'
import ShareBoard from './shareBoard'
-jest.useFakeTimers()
-
const boardId = '1'
const workspaceId: string|undefined = boardId
const viewId = boardId
@@ -29,8 +27,8 @@ const teamId = 'team-id'
jest.mock('src/octoClient')
jest.mock('src/utils')
-const mockedOctoClient = mocked(client, true)
-const mockedUtils = mocked(Utils, true)
+const mockedOctoClient = mocked(client)
+const mockedUtils = mocked(Utils)
let params = {}
jest.mock('react-router', () => {
@@ -40,7 +38,7 @@ jest.mock('react-router', () => {
...originalModule,
useRouteMatch: jest.fn(() => {
return {
- url: 'http://localhost/',
+ url: 'http://localhost:8065/',
path: '/',
params,
isExact: true,
@@ -49,145 +47,149 @@ jest.mock('react-router', () => {
}
})
-const board = TestBlockFactory.createBoard()
-board.id = boardId
-board.teamId = teamId
-board.cardProperties = [
- {
- id: 'property1',
- name: 'Property 1',
- type: 'text',
- options: [
- {
- id: 'value1',
- value: 'value 1',
- color: 'propColorBrown',
- },
- ],
- },
- {
- id: 'property2',
- name: 'Property 2',
- type: 'select',
- options: [
- {
- id: 'value2',
- value: 'value 2',
- color: 'propColorBlue',
- },
- ],
- },
-]
-board.channelId = 'channel_1'
-
-const activeView = TestBlockFactory.createBoardView(board)
-activeView.id = 'view1'
-activeView.fields.hiddenOptionIds = []
-activeView.fields.visiblePropertyIds = ['property1']
-activeView.fields.visibleOptionIds = ['value1']
-
-const fakeBoard = {id: board.id}
-activeView.boardId = fakeBoard.id
-
-const card1 = TestBlockFactory.createCard(board)
-card1.id = 'card1'
-card1.title = 'card-1'
-card1.boardId = fakeBoard.id
-
-const card2 = TestBlockFactory.createCard(board)
-card2.id = 'card2'
-card2.title = 'card-2'
-card2.boardId = fakeBoard.id
-
-const card3 = TestBlockFactory.createCard(board)
-card3.id = 'card3'
-card3.title = 'card-3'
-card3.boardId = fakeBoard.id
-
-const me: IUser = {
- id: 'user-id-1',
- username: 'username_1',
- email: '',
- nickname: '',
- firstname: '',
- lastname: '',
- props: {},
- create_at: 0,
- update_at: 0,
- is_bot: false,
- is_guest: false,
- roles: 'system_user',
-}
-
-const categoryAttribute1 = TestBlockFactory.createCategoryBoards()
-categoryAttribute1.name = 'Category 1'
-categoryAttribute1.boardMetadata = [{boardID: board.id, hidden: false}]
-
describe('src/components/shareBoard/shareBoard', () => {
const w = (window as any)
const oldBaseURL = w.baseURL
- const state = {
- teams: {
- current: {id: teamId, title: 'Test Team'},
- },
- users: {
- me,
- boardUsers: {[me.id]: me},
- blockSubscriptions: [],
- },
- boards: {
- current: board.id,
- boards: {
- [board.id]: board,
- },
- templates: [],
- membersInBoards: {
- [board.id]: {},
- },
- myBoardMemberships: {
- [board.id]: {userId: me.id, schemeAdmin: true},
- },
- },
- globalTemplates: {
- value: [],
- },
- views: {
- views: {
- [activeView.id]: activeView,
- },
- current: activeView.id,
- },
- cards: {
- templates: [],
- cards: [card1, card2, card3],
- },
- searchText: {},
- clientConfig: {
- value: {
- telemetry: true,
- telemetryid: 'telemetry',
- enablePublicSharedBoards: true,
- teammateNameDisplay: 'username',
- featureFlags: {},
- },
- },
- contents: {
- contents: {},
- },
- comments: {
- comments: {},
- },
- sidebar: {
- categoryAttributes: [
- categoryAttribute1,
+ const board = TestBlockFactory.createBoard()
+ board.id = boardId
+ board.teamId = teamId
+ board.cardProperties = [
+ {
+ id: 'property1',
+ name: 'Property 1',
+ type: 'text',
+ options: [
+ {
+ id: 'value1',
+ value: 'value 1',
+ color: 'propColorBrown',
+ },
],
},
+ {
+ id: 'property2',
+ name: 'Property 2',
+ type: 'select',
+ options: [
+ {
+ id: 'value2',
+ value: 'value 2',
+ color: 'propColorBlue',
+ },
+ ],
+ },
+ ]
+ board.channelId = 'channel_1'
+
+ const activeView = TestBlockFactory.createBoardView(board)
+ activeView.id = 'view1'
+ activeView.fields.hiddenOptionIds = []
+ activeView.fields.visiblePropertyIds = ['property1']
+ activeView.fields.visibleOptionIds = ['value1']
+
+ const fakeBoard = {id: board.id}
+ activeView.boardId = fakeBoard.id
+
+ const card1 = TestBlockFactory.createCard(board)
+ card1.id = 'card1'
+ card1.title = 'card-1'
+ card1.boardId = fakeBoard.id
+
+ const card2 = TestBlockFactory.createCard(board)
+ card2.id = 'card2'
+ card2.title = 'card-2'
+ card2.boardId = fakeBoard.id
+
+ const card3 = TestBlockFactory.createCard(board)
+ card3.id = 'card3'
+ card3.title = 'card-3'
+ card3.boardId = fakeBoard.id
+
+ const me: IUser = {
+ id: 'user-id-1',
+ username: 'username_1',
+ email: '',
+ nickname: '',
+ firstname: '',
+ lastname: '',
+ props: {},
+ create_at: 0,
+ update_at: 0,
+ is_bot: false,
+ is_guest: false,
+ roles: 'system_user',
}
- const store = mockStateStore([thunk], state)
+ const categoryAttribute1 = TestBlockFactory.createCategoryBoards()
+ categoryAttribute1.name = 'Category 1'
+ categoryAttribute1.boardMetadata = [{boardID: board.id, hidden: false}]
+
+ let state: Parameters[1]
+ let store: ReturnType
+
beforeEach(() => {
- jest.clearAllMocks()
+
+ state = {
+ teams: {
+ current: {id: teamId, title: 'Test Team'},
+ },
+ users: {
+ me,
+ boardUsers: {[me.id]: me},
+ blockSubscriptions: [],
+ },
+ boards: {
+ current: board.id,
+ boards: {
+ [board.id]: board,
+ },
+ templates: [],
+ membersInBoards: {
+ [board.id]: {},
+ },
+ myBoardMemberships: {
+ [board.id]: {userId: me.id, schemeAdmin: true},
+ },
+ },
+ globalTemplates: {
+ value: [],
+ },
+ views: {
+ views: {
+ [activeView.id]: activeView,
+ },
+ current: activeView.id,
+ },
+ cards: {
+ templates: [],
+ cards: [card1, card2, card3],
+ },
+ searchText: {},
+ clientConfig: {
+ value: {
+ telemetry: true,
+ telemetryid: 'telemetry',
+ enablePublicSharedBoards: true,
+ teammateNameDisplay: 'username',
+ featureFlags: {},
+ },
+ },
+ contents: {
+ contents: {},
+ },
+ comments: {
+ comments: {},
+ },
+ sidebar: {
+ categoryAttributes: [
+ categoryAttribute1,
+ ],
+ },
+ }
+
+
+ store = mockStateStore([thunk], state)
// mockedUtils.buildURL.mockImplementation((path) => (w.baseURL || '') + path)
@@ -290,8 +292,8 @@ describe('src/components/shareBoard/shareBoard', () => {
const copyLinkElement = screen.getByTitle('Copy link')
expect(copyLinkElement).toBeDefined()
- act(() => {
- userEvent.click(copyLinkElement!)
+ await act(async () => {
+ await userEvent.click(copyLinkElement!)
})
expect(mockedUtils.copyTextToClipboard).toBeCalledTimes(1)
@@ -312,20 +314,14 @@ describe('src/components/shareBoard/shareBoard', () => {
}
mockedOctoClient.getSharing.mockResolvedValue(sharing)
- let container
- await act(async () => {
- const result = render(
- wrapDNDIntl(
-
-
- ),
- {wrapper: MemoryRouter},
- )
- container = result.container
- })
+ const {container} = render(wrapDNDIntl(
+
+
+
+ ), {wrapper: MemoryRouter})
sharing.token = 'anotherToken'
mockedUtils.createGuid.mockReturnValue('anotherToken')
@@ -334,17 +330,12 @@ describe('src/components/shareBoard/shareBoard', () => {
const publishButton = screen.getByRole('button', {name: 'Publish'})
expect(publishButton).toBeDefined()
- userEvent.click(publishButton)
- await act(async () => {
- jest.runOnlyPendingTimers()
- })
+ await act(() => userEvent.click(publishButton))
const regenerateTokenElement = screen.getByRole('button', {name: 'Regenerate token'})
expect(regenerateTokenElement).toBeDefined()
- userEvent.click(regenerateTokenElement)
- await act(async () => {
- jest.runOnlyPendingTimers()
- })
+ await act(() => userEvent.click(regenerateTokenElement))
+
expect(mockedOctoClient.setSharing).toBeCalledTimes(1)
expect(container).toMatchSnapshot()
})
@@ -373,15 +364,12 @@ describe('src/components/shareBoard/shareBoard', () => {
const publishButton = screen.getByRole('button', {name: 'Publish'})
expect(publishButton).toBeDefined()
- userEvent.click(publishButton)
- await act(async () => {
- jest.runOnlyPendingTimers()
- })
+ await userEvent.click(publishButton)
const switchElement = container?.querySelector('.Switch')
expect(switchElement).toBeDefined()
await act(async () => {
- userEvent.click(switchElement!)
+ await userEvent.click(switchElement!)
})
expect(mockedOctoClient.setSharing).toBeCalledTimes(1)
@@ -397,48 +385,41 @@ describe('src/components/shareBoard/shareBoard', () => {
}
mockedOctoClient.getSharing.mockResolvedValue(sharing)
mockedUtils.createGuid.mockReturnValue('aToken')
- let container: Element | undefined
- await act(async () => {
- const result = render(
- wrapDNDIntl(
-
-
- ),
- {wrapper: MemoryRouter},
- )
- container = result.container
- mockedOctoClient.getSharing.mockResolvedValue({
- id: boardId,
- enabled: true,
- token: 'aToken',
- })
-
- const publishButton = screen.getByRole('button', {name: 'Publish'})
- expect(publishButton).toBeDefined()
- userEvent.click(publishButton)
- jest.runOnlyPendingTimers()
-
- const switchElement = container?.querySelector('.Switch')
- expect(switchElement).toBeDefined()
- userEvent.click(switchElement!)
- jest.runOnlyPendingTimers()
- result.rerender(
- wrapDNDIntl(
-
-
- ))
+ const result = render(wrapDNDIntl(
+
+
+
+ ),{wrapper: MemoryRouter})
+
+ mockedOctoClient.getSharing.mockResolvedValue({
+ id: boardId,
+ enabled: true,
+ token: 'aToken',
})
+ const publishButton = screen.getByRole('button', {name: 'Publish'})
+ expect(publishButton).toBeDefined()
+ await act(() => userEvent.click(publishButton))
+
+ const switchElement = result.container?.querySelector('.Switch')
+ expect(switchElement).toBeDefined()
+ await act(() => userEvent.click(switchElement!))
+
+ result.rerender(wrapDNDIntl(
+
+
+
+ ))
+
expect(mockedOctoClient.setSharing).toBeCalledTimes(1)
expect(mockedOctoClient.getSharing).toBeCalledTimes(2)
- expect(mockedUtils.createGuid).toBeCalledTimes(1)
- expect(container).toMatchSnapshot()
+ expect(result.container).toMatchSnapshot()
})
test('should match snapshot with sharing and subpath', async () => {
@@ -509,7 +490,7 @@ describe('src/components/shareBoard/shareBoard', () => {
expect(selectElement).toBeDefined()
await act(async () => {
- userEvent.click(selectElement!)
+ await userEvent.click(selectElement!)
})
expect(container).toMatchSnapshot()
@@ -558,7 +539,7 @@ describe('src/components/shareBoard/shareBoard', () => {
expect(selectElement).toBeDefined()
await act(async () => {
- userEvent.click(selectElement!)
+ await userEvent.click(selectElement!)
})
expect(container).toMatchSnapshot()
@@ -591,15 +572,15 @@ describe('src/components/shareBoard/shareBoard', () => {
const channelMenuBtn = container!.querySelector('.user-item.channel-item .MenuWrapper')
expect(channelMenuBtn).not.toBeNull()
- userEvent.click(channelMenuBtn as Element)
+ await userEvent.click(channelMenuBtn as Element)
const unlinkOption = screen.getByText('Unlink')
expect(unlinkOption).not.toBeNull()
- userEvent.click(unlinkOption)
+ await userEvent.click(unlinkOption)
const unlinkConfirmationBtn = screen.getByText('Unlink channel')
expect(unlinkConfirmationBtn).not.toBeNull()
- userEvent.click(unlinkConfirmationBtn)
+ await userEvent.click(unlinkConfirmationBtn)
expect(mockedOctoClient.patchBoard).toBeCalled()
@@ -685,9 +666,7 @@ describe('src/components/shareBoard/shareBoard', () => {
const selectElement = screen.getByText('Search for people')
expect(selectElement).toBeDefined()
- await act(async () => {
- userEvent.click(selectElement!)
- })
+ await act(() => userEvent.click(selectElement!))
expect(mockedOctoClient.searchUserChannels).not.toBeCalled()
expect(container).toMatchSnapshot()
diff --git a/webapp/boards/src/components/shareBoard/shareBoard.tsx b/webapp/boards/src/components/shareBoard/shareBoard.tsx
index 97ef19215d..c5d040f6f2 100644
--- a/webapp/boards/src/components/shareBoard/shareBoard.tsx
+++ b/webapp/boards/src/components/shareBoard/shareBoard.tsx
@@ -6,7 +6,7 @@ import React, {useState, useEffect} from 'react'
import {useIntl, FormattedMessage} from 'react-intl'
import {generatePath, useRouteMatch} from 'react-router-dom'
import Select from 'react-select/async'
-import {CSSObject} from '@emotion/serialize'
+import {StylesConfig} from 'react-select'
import {useAppSelector} from 'src/store/hooks'
import {getCurrentBoard, getCurrentBoardMembers} from 'src/store/boards'
@@ -26,7 +26,7 @@ import {BoardMember, createBoard, MemberRole} from 'src/blocks/board'
import client from 'src/octoClient'
import Dialog from 'src/components/dialog'
import ConfirmationDialog from 'src/components/confirmationDialogBox'
-import {IUser} from 'src/user'
+import {IUser, isUser} from 'src/user'
import Switch from 'src/widgets/switch'
import Button from 'src/widgets/buttons/button'
import {sendFlashMessage} from 'src/components/flashMessages'
@@ -58,11 +58,11 @@ type Props = {
enableSharedBoards: boolean
}
-const baseStyles = getSelectBaseStyle()
+const baseStyles = getSelectBaseStyle()
-const styles = {
+const styles: StylesConfig = {
...baseStyles,
- control: (): CSSObject => ({
+ control: () => ({
border: 0,
width: '100%',
height: '100%',
@@ -70,7 +70,7 @@ const styles = {
display: 'flex',
flexDirection: 'row',
}),
- menu: (provided: CSSObject): CSSObject => ({
+ menu: (provided) => ({
...provided,
minWidth: '100%',
width: 'max-content',
@@ -78,8 +78,8 @@ const styles = {
left: '0',
marginBottom: '0',
}),
- singleValue: (provided: CSSObject): CSSObject => ({
- ...baseStyles.singleValue(provided),
+ singleValue: (...props) => ({
+ ...baseStyles.singleValue?.(...props),
opacity: '0.8',
fontSize: '12px',
right: '0',
@@ -259,7 +259,7 @@ export default function ShareBoardDialog(props: Props): JSX.Element {
viewId: match.params.viewId,
teamId: match.params.teamId,
})
- shareUrl.pathname = newPath
+ shareUrl.pathname = `/boards/public${newPath}`
const boardPath = generatePath('/team/:teamId/:boardId/:viewId', {
boardId: match.params.boardId,
@@ -278,7 +278,7 @@ export default function ShareBoardDialog(props: Props): JSX.Element {
const shareTemplateTitle = (
)
@@ -344,7 +344,7 @@ export default function ShareBoardDialog(props: Props): JSX.Element {
-
styles={styles}
value={selectedUser}
className={'userSearchInput'}
@@ -377,19 +377,19 @@ export default function ShareBoardDialog(props: Props): JSX.Element {
components={{DropdownIndicator: () => null, IndicatorSeparator: () => null}}
defaultOptions={true}
formatOptionLabel={formatOptionLabel}
- getOptionValue={(u) => u.id}
- getOptionLabel={(u: IUser|Channel) => (u as IUser).username || (u as Channel).display_name}
+ getOptionValue={({id}) => id}
+ getOptionLabel={(x) => isUser(x) ? x.username : x.display_name}
isMulti={false}
placeholder={board.isTemplate ?
intl.formatMessage({id: 'ShareTemplate.searchPlaceholder', defaultMessage: 'Search for people'}) :
intl.formatMessage({id: 'ShareBoard.searchPlaceholder', defaultMessage: 'Search for people and channels'})
}
onChange={(newValue) => {
- if (newValue && (newValue as IUser).username) {
- addUser(newValue as IUser)
+ if (newValue && isUser(newValue)) {
+ addUser(newValue)
setSelectedUser(null)
} else if (newValue) {
- onLinkBoard(newValue as Channel)
+ onLinkBoard(newValue)
}
}}
/>
diff --git a/webapp/boards/src/components/shareBoard/shareBoardLoginButton.test.tsx b/webapp/boards/src/components/shareBoard/shareBoardLoginButton.test.tsx
index e4a0792807..da2e597647 100644
--- a/webapp/boards/src/components/shareBoard/shareBoardLoginButton.test.tsx
+++ b/webapp/boards/src/components/shareBoard/shareBoardLoginButton.test.tsx
@@ -21,10 +21,12 @@ jest.mock('react-router-dom', () => {
...originalModule,
useRouteMatch: jest.fn(() => {
return {
- teamId: 'team1',
- boardId: 'boardId1',
- viewId: 'viewId1',
- cardId: 'cardId1',
+ params: {
+ teamId: 'team1',
+ boardId: 'boardId1',
+ viewId: 'viewId1',
+ cardId: 'cardId1',
+ },
}
}),
}
diff --git a/webapp/boards/src/components/shareBoard/shareBoardLoginButton.tsx b/webapp/boards/src/components/shareBoard/shareBoardLoginButton.tsx
index 18b7a13e91..a0dbe94d04 100644
--- a/webapp/boards/src/components/shareBoard/shareBoardLoginButton.tsx
+++ b/webapp/boards/src/components/shareBoard/shareBoardLoginButton.tsx
@@ -3,7 +3,7 @@
import React, {useCallback} from 'react'
import {FormattedMessage} from 'react-intl'
-import {generatePath, useRouteMatch, useHistory} from 'react-router-dom'
+import {generatePath, useRouteMatch} from 'react-router-dom'
import Button from 'src/widgets/buttons/button'
import TelemetryClient, {TelemetryActions, TelemetryCategory} from 'src/telemetry/telemetryClient'
@@ -12,14 +12,17 @@ import './shareBoardLoginButton.scss'
const ShareBoardLoginButton = () => {
const match = useRouteMatch<{teamId: string, boardId: string, viewId?: string, cardId?: string}>()
- const history = useHistory()
- const redirectQueryParam = 'r=' + encodeURIComponent(generatePath('/:boardId?/:viewId?/:cardId?', match.params))
- const loginPath = '/login?' + redirectQueryParam
+ // Mattermost login doesn't respect the redirect query parameter
+ // if the user is already logged in, so we send the user to the
+ // board and if they are not logged in, the webapp will take care
+ // of the redirection
+ const baseURL = window.location.href.split('/boards/public')[0]
+ const loginPath = `${baseURL}/${generatePath('/boards/team/:teamId/:boardId?/:viewId?/:cardId?', match.params)}`
const onLoginClick = useCallback(() => {
TelemetryClient.trackEvent(TelemetryCategory, TelemetryActions.ShareBoardLogin)
- history.push(loginPath)
+ location.assign(loginPath)
}, [])
return (
diff --git a/webapp/boards/src/components/shareBoard/teamPermissionsRow.test.tsx b/webapp/boards/src/components/shareBoard/teamPermissionsRow.test.tsx
index 967057e295..56f025b803 100644
--- a/webapp/boards/src/components/shareBoard/teamPermissionsRow.test.tsx
+++ b/webapp/boards/src/components/shareBoard/teamPermissionsRow.test.tsx
@@ -1,6 +1,6 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
-import {act, render} from '@testing-library/react'
+import {render} from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import {Provider as ReduxProvider} from 'react-redux'
import thunk from 'redux-thunk'
@@ -16,8 +16,6 @@ import {MemberRole} from 'src/blocks/board'
import TeamPermissionsRow from './teamPermissionsRow'
-jest.useFakeTimers()
-
const boardId = '1'
jest.mock('src/utils')
@@ -73,28 +71,23 @@ describe('src/components/shareBoard/teamPermissionsRow', () => {
})
test('should match snapshot in plugin mode', async () => {
- let container: Element | undefined
const store = mockStateStore([thunk], state)
- await act(async () => {
- const result = render(
- wrapDNDIntl(
-
-
- ),
- {wrapper: MemoryRouter},
- )
- container = result.container
- })
+ const {container} = render(
+ wrapDNDIntl(
+
+
+ ),
+ {wrapper: MemoryRouter},
+ )
const buttonElement = container?.querySelector('.user-item__button')
expect(buttonElement).toBeDefined()
- userEvent.click(buttonElement!)
+ await userEvent.click(buttonElement!)
expect(container).toMatchSnapshot()
})
test('should match snapshot in template', async () => {
- let container: Element | undefined
const testState = {
...state,
boards: {
@@ -106,20 +99,17 @@ describe('src/components/shareBoard/teamPermissionsRow', () => {
},
}
const store = mockStateStore([thunk], testState)
- await act(async () => {
- const result = render(
- wrapDNDIntl(
-
-
- ),
- {wrapper: MemoryRouter},
- )
- container = result.container
- })
+ const {container} = render(
+ wrapDNDIntl(
+
+
+ ),
+ {wrapper: MemoryRouter},
+ )
const buttonElement = container?.querySelector('.user-item__button')
expect(buttonElement).toBeDefined()
- userEvent.click(buttonElement!)
+ await userEvent.click(buttonElement!)
expect(container).toMatchSnapshot()
})
diff --git a/webapp/boards/src/components/shareBoard/teamPermissionsRow.tsx b/webapp/boards/src/components/shareBoard/teamPermissionsRow.tsx
index e104f55863..1f7c1a5822 100644
--- a/webapp/boards/src/components/shareBoard/teamPermissionsRow.tsx
+++ b/webapp/boards/src/components/shareBoard/teamPermissionsRow.tsx
@@ -52,19 +52,22 @@ const TeamPermissionsRow = (): JSX.Element => {
}
}
- let currentRoleName = intl.formatMessage({id: 'BoardMember.schemeNone', defaultMessage: 'None'})
- if (board.type === BoardTypeOpen && board.minimumRole === MemberRole.Admin) {
- currentRoleName = intl.formatMessage({id: 'BoardMember.schemeAdmin', defaultMessage: 'Admin'})
- } else if (board.type === BoardTypeOpen && board.minimumRole === MemberRole.Editor) {
- if (board.isTemplate) {
+ let currentRoleName = intl.formatMessage({id: 'BoardMember.schemeAdmin', defaultMessage: 'Admin'})
+ if (board.type === BoardTypeOpen) {
+ currentRoleName = intl.formatMessage({id: 'BoardMember.schemeEditor', defaultMessage: 'Editor'})
+ if (board.minimumRole === MemberRole.Editor) {
+ if (board.isTemplate) {
+ currentRoleName = intl.formatMessage({id: 'BoardMember.schemeViewer', defaultMessage: 'Viewer'})
+ } else {
+ currentRoleName = intl.formatMessage({id: 'BoardMember.schemeEditor', defaultMessage: 'Editor'})
+ }
+ } else if (board.minimumRole === MemberRole.Commenter) {
+ currentRoleName = intl.formatMessage({id: 'BoardMember.schemeCommenter', defaultMessage: 'Commenter'})
+ } else if (board.minimumRole === MemberRole.Viewer) {
currentRoleName = intl.formatMessage({id: 'BoardMember.schemeViewer', defaultMessage: 'Viewer'})
- } else {
- currentRoleName = intl.formatMessage({id: 'BoardMember.schemeEditor', defaultMessage: 'Editor'})
}
- } else if (board.type === BoardTypeOpen && board.minimumRole === MemberRole.Commenter) {
- currentRoleName = intl.formatMessage({id: 'BoardMember.schemeCommenter', defaultMessage: 'Commenter'})
- } else if (board.type === BoardTypeOpen && board.minimumRole === MemberRole.Viewer) {
- currentRoleName = intl.formatMessage({id: 'BoardMember.schemeViewer', defaultMessage: 'Viewer'})
+ } else {
+ currentRoleName = intl.formatMessage({id: 'BoardMember.schemeNone', defaultMessage: 'None'})
}
const confirmationDialog = (
@@ -99,7 +102,7 @@ const TeamPermissionsRow = (): JSX.Element => {
icon='mattermost'
className='user-item__img'
/>
- {intl.formatMessage({id: 'ShareBoard.teamPermissionsText', defaultMessage: 'Everyone at {teamName} Team'}, {teamName: team?.title})}
+ {intl.formatMessage({id: 'ShareBoard.teamPermissionsText', defaultMessage: 'Everyone at {teamName} team'}, {teamName: team?.title})}
diff --git a/webapp/boards/src/components/shareBoard/userPermissionsRow.test.tsx b/webapp/boards/src/components/shareBoard/userPermissionsRow.test.tsx
index d3e1786bce..08138ec87b 100644
--- a/webapp/boards/src/components/shareBoard/userPermissionsRow.test.tsx
+++ b/webapp/boards/src/components/shareBoard/userPermissionsRow.test.tsx
@@ -16,8 +16,6 @@ import {mockStateStore, wrapDNDIntl} from 'src/testUtils'
import UserPermissionsRow from './userPermissionsRow'
-jest.useFakeTimers()
-
const boardId = '1'
jest.mock('src/utils')
@@ -94,7 +92,7 @@ describe('src/components/shareBoard/userPermissionsRow', () => {
const buttonElement = container?.querySelector('.user-item__button')
expect(buttonElement).toBeDefined()
- userEvent.click(buttonElement!)
+ await userEvent.click(buttonElement!)
expect(container).toMatchSnapshot()
})
@@ -132,7 +130,7 @@ describe('src/components/shareBoard/userPermissionsRow', () => {
const buttonElement = container?.querySelector('.user-item__button')
expect(buttonElement).toBeDefined()
- userEvent.click(buttonElement!)
+ await userEvent.click(buttonElement!)
expect(container).toMatchSnapshot()
})
diff --git a/webapp/boards/src/components/sidebar/__snapshots__/registrationLink.test.tsx.snap b/webapp/boards/src/components/sidebar/__snapshots__/registrationLink.test.tsx.snap
index 6f1b587b4e..142b6dfdc2 100644
--- a/webapp/boards/src/components/sidebar/__snapshots__/registrationLink.test.tsx.snap
+++ b/webapp/boards/src/components/sidebar/__snapshots__/registrationLink.test.tsx.snap
@@ -32,11 +32,11 @@ exports[`components/sidebar/RegistrationLink renders with signupToken in URL que
>
- http://localhost/register?t=abc123
+ http://localhost:8065/register?t=abc123
- Find Boards
+ Find boards
@@ -184,7 +184,7 @@ exports[`components/sidebarSidebar should assign default category if current boa
/>
- Find Boards
+ Find boards
@@ -379,7 +379,7 @@ exports[`components/sidebarSidebar shouldnt do any category assignment is board
/>
- Find Boards
+ Find boards
@@ -729,7 +729,7 @@ exports[`components/sidebarSidebar sidebar hidden 1`] = `
/>
- Find Boards
+ Find boards
@@ -962,7 +962,7 @@ exports[`components/sidebarSidebar some categories hidden 1`] = `
/>
- Find Boards
+ Find boards
diff --git a/webapp/boards/src/components/sidebar/sidebar.test.tsx b/webapp/boards/src/components/sidebar/sidebar.test.tsx
index 2771a35f1a..53341e4fb9 100644
--- a/webapp/boards/src/components/sidebar/sidebar.test.tsx
+++ b/webapp/boards/src/components/sidebar/sidebar.test.tsx
@@ -22,7 +22,7 @@ import octoClient from 'src/octoClient'
import Sidebar from './sidebar'
jest.mock('src/octoClient')
-const mockedOctoClient = mocked(octoClient, true)
+const mockedOctoClient = mocked(octoClient)
beforeAll(() => {
mockMatchMedia({matches: true})
@@ -48,7 +48,7 @@ describe('components/sidebarSidebar', () => {
defaultCategory.name = 'Boards'
defaultCategory.boardMetadata = []
- test('sidebar hidden', () => {
+ test('sidebar hidden', async () => {
const store = mockStore({
teams: {
current: {id: 'team-id'},
@@ -101,7 +101,7 @@ describe('components/sidebarSidebar', () => {
const hideSidebar = container.querySelector('button > .HideSidebarIcon')
expect(hideSidebar).toBeDefined()
- userEvent.click(hideSidebar as Element)
+ await userEvent.click(hideSidebar as Element)
expect(container).toMatchSnapshot()
const showSidebar = container.querySelector('button > .ShowSidebarIcon')
diff --git a/webapp/boards/src/components/sidebar/sidebarBoardItem.test.tsx b/webapp/boards/src/components/sidebar/sidebarBoardItem.test.tsx
index c2547f0aad..244fcc34c7 100644
--- a/webapp/boards/src/components/sidebar/sidebarBoardItem.test.tsx
+++ b/webapp/boards/src/components/sidebar/sidebarBoardItem.test.tsx
@@ -70,7 +70,7 @@ describe('components/sidebarBoardItem', () => {
},
}
- test('sidebar board item', () => {
+ test('sidebar board item', async () => {
const mockStore = configureStore([])
const store = mockStore(state)
@@ -93,7 +93,7 @@ describe('components/sidebarBoardItem', () => {
const {container} = render(component)
const elementMenuWrapper = container.querySelector('.SidebarBoardItem div.MenuWrapper')
expect(elementMenuWrapper).not.toBeNull()
- userEvent.click(elementMenuWrapper!)
+ await userEvent.click(elementMenuWrapper!)
expect(container).toMatchSnapshot()
})
@@ -122,7 +122,7 @@ describe('components/sidebarBoardItem', () => {
expect(container).toMatchSnapshot()
})
- test('sidebar board item for guest', () => {
+ test('sidebar board item for guest', async () => {
const mockStore = configureStore([])
const store = mockStore({...state, users: {me: {is_guest: true}}})
@@ -145,7 +145,7 @@ describe('components/sidebarBoardItem', () => {
const {container} = render(component)
const elementMenuWrapper = container.querySelector('.SidebarBoardItem div.MenuWrapper')
expect(elementMenuWrapper).not.toBeNull()
- userEvent.click(elementMenuWrapper!)
+ await userEvent.click(elementMenuWrapper!)
expect(container).toMatchSnapshot()
})
})
diff --git a/webapp/boards/src/components/sidebar/sidebarCategory.scss b/webapp/boards/src/components/sidebar/sidebarCategory.scss
index 62eb4fb3ea..24bdde2307 100644
--- a/webapp/boards/src/components/sidebar/sidebarCategory.scss
+++ b/webapp/boards/src/components/sidebar/sidebarCategory.scss
@@ -6,6 +6,10 @@
margin-top: 0;
}
+ .dialog {
+ color: rgba(var(--center-channel-color-rgb));
+ }
+
.octo-sidebar-item {
display: flex;
flex-direction: row;
diff --git a/webapp/boards/src/components/sidebar/sidebarCategory.test.tsx b/webapp/boards/src/components/sidebar/sidebarCategory.test.tsx
index ef7eaba25c..5b97525b25 100644
--- a/webapp/boards/src/components/sidebar/sidebarCategory.test.tsx
+++ b/webapp/boards/src/components/sidebar/sidebarCategory.test.tsx
@@ -84,7 +84,7 @@ describe('components/sidebarCategory', () => {
},
}
- test('sidebar call hideSidebar', () => {
+ test('sidebar call hideSidebar', async () => {
const mockStore = configureStore([])
const store = mockStore(state)
@@ -107,11 +107,11 @@ describe('components/sidebarCategory', () => {
// testing collapsed state of category
const subItems = container.querySelectorAll('.category')
expect(subItems).toBeDefined()
- userEvent.click(subItems[0] as Element)
+ await userEvent.click(subItems[0] as Element)
expect(container).toMatchSnapshot()
})
- test('sidebar collapsed without active board', () => {
+ test('sidebar collapsed without active board', async () => {
const mockStore = configureStore([])
const store = mockStore(state)
@@ -132,11 +132,11 @@ describe('components/sidebarCategory', () => {
const subItems = container.querySelectorAll('.category-title')
expect(subItems).toBeDefined()
- userEvent.click(subItems[0] as Element)
+ await userEvent.click(subItems[0] as Element)
expect(container).toMatchSnapshot()
})
- test('sidebar collapsed with active board in it', () => {
+ test('sidebar collapsed with active board in it', async () => {
const mockStore = configureStore([])
const store = mockStore(state)
@@ -158,11 +158,11 @@ describe('components/sidebarCategory', () => {
const subItems = container.querySelectorAll('.category-title')
expect(subItems).toBeDefined()
- userEvent.click(subItems[0] as Element)
+ await userEvent.click(subItems[0] as Element)
expect(container).toMatchSnapshot()
})
- test('sidebar template close self', () => {
+ test('sidebar template close self', async () => {
const mockStore = configureStore([])
const store = mockStore(state)
@@ -189,11 +189,11 @@ describe('components/sidebarCategory', () => {
// testing collapsed state of category
const subItems = container.querySelectorAll('.subitem')
expect(subItems).toBeDefined()
- userEvent.click(subItems[0] as Element)
+ await userEvent.click(subItems[0] as Element)
expect(mockTemplateClose).toBeCalled()
})
- test('sidebar template close other', () => {
+ test('sidebar template close other', async () => {
const mockStore = configureStore([])
const store = mockStore(state)
@@ -220,7 +220,7 @@ describe('components/sidebarCategory', () => {
// testing collapsed state of category
const subItems = container.querySelectorAll('.category-title')
expect(subItems).toBeDefined()
- userEvent.click(subItems[0] as Element)
+ await userEvent.click(subItems[0] as Element)
expect(mockTemplateClose).not.toBeCalled()
})
})
diff --git a/webapp/boards/src/components/sidebar/sidebarSettingsMenu.test.tsx b/webapp/boards/src/components/sidebar/sidebarSettingsMenu.test.tsx
index 5a63a2f56a..e5f5bb81ba 100644
--- a/webapp/boards/src/components/sidebar/sidebarSettingsMenu.test.tsx
+++ b/webapp/boards/src/components/sidebar/sidebarSettingsMenu.test.tsx
@@ -20,7 +20,7 @@ import TelemetryClient, {TelemetryCategory, TelemetryActions} from 'src/telemetr
import SidebarSettingsMenu from './sidebarSettingsMenu'
jest.mock('src/telemetry/telemetryClient')
-const mockedTelemetry = mocked(TelemetryClient, true)
+const mockedTelemetry = mocked(TelemetryClient)
describe('components/sidebar/SidebarSettingsMenu', () => {
const mockStore = configureStore([])
@@ -53,7 +53,7 @@ describe('components/sidebar/SidebarSettingsMenu', () => {
expect(container).toMatchSnapshot()
})
- test('settings menu open should match snapshot', () => {
+ test('settings menu open should match snapshot', async () => {
const component = wrapIntl(
@@ -61,11 +61,11 @@ describe('components/sidebar/SidebarSettingsMenu', () => {
)
const {container} = render(component)
- userEvent.click(container.querySelector('.menu-entry') as Element)
+ await userEvent.click(container.querySelector('.menu-entry') as Element)
expect(container).toMatchSnapshot()
})
- test('theme menu open should match snapshot', () => {
+ test('theme menu open should match snapshot', async () => {
const component = wrapIntl(
@@ -73,16 +73,12 @@ describe('components/sidebar/SidebarSettingsMenu', () => {
)
const {container} = render(component)
- act(() => {
- userEvent.click(container.querySelector('.menu-entry') as Element)
- })
- act(() => {
- userEvent.hover(container.querySelector('#theme') as Element)
- })
+ await act(() => userEvent.click(container.querySelector('.menu-entry') as Element))
+ await act(() => userEvent.hover(container.querySelector('#theme') as Element))
expect(container).toMatchSnapshot()
})
- test('languages menu open should match snapshot', () => {
+ test('languages menu open should match snapshot', async () => {
const component = wrapIntl(
@@ -90,16 +86,12 @@ describe('components/sidebar/SidebarSettingsMenu', () => {
)
const {container} = render(component)
- act(() => {
- userEvent.click(container.querySelector('.menu-entry') as Element)
- })
- act(() => {
- userEvent.hover(container.querySelector('#lang') as Element)
- })
+ await act(() => userEvent.click(container.querySelector('.menu-entry') as Element))
+ await act(() => userEvent.hover(container.querySelector('#lang') as Element))
expect(container).toMatchSnapshot()
})
- test('imports menu open should match snapshot', () => {
+ test('imports menu open should match snapshot', async () => {
window.open = jest.fn()
const component = wrapIntl(
@@ -108,15 +100,11 @@ describe('components/sidebar/SidebarSettingsMenu', () => {
)
const {container} = render(component)
- act(() => {
- userEvent.click(container.querySelector('.menu-entry') as Element)
- })
- act(() => {
- userEvent.hover(container.querySelector('#import') as Element)
- })
+ await act(() => userEvent.click(container.querySelector('.menu-entry') as Element))
+ await act(() => userEvent.hover(container.querySelector('#import') as Element))
expect(container).toMatchSnapshot()
- userEvent.click(container.querySelector('[aria-label="Asana"]') as Element)
+ await userEvent.click(container.querySelector('[aria-label="Asana"]') as Element)
expect(mockedTelemetry.trackEvent).toBeCalledWith(TelemetryCategory, TelemetryActions.ImportAsana)
})
})
diff --git a/webapp/boards/src/components/table/__snapshots__/table.test.tsx.snap b/webapp/boards/src/components/table/__snapshots__/table.test.tsx.snap
index c6fdc5f290..4904293c01 100644
--- a/webapp/boards/src/components/table/__snapshots__/table.test.tsx.snap
+++ b/webapp/boards/src/components/table/__snapshots__/table.test.tsx.snap
@@ -117,7 +117,7 @@ exports[`components/table/Table extended should have Duplicate Button 1`] = `
- Status
+ Last Modified By
@@ -192,6 +194,7 @@ exports[`components/table/Table extended should have Duplicate Button 1`] = `
class="open-button"
>
@@ -243,18 +246,8 @@ exports[`components/table/Table extended should have Duplicate Button 1`] = `
style="width: 100px;"
>
-
-
-
-
+ class="Person octo-propertyvalue octo-propertyvalue--readonly"
+ />
@@ -318,6 +313,7 @@ exports[`components/table/Table extended should have Duplicate Button 1`] = `
class="open-button"
>
@@ -369,18 +365,8 @@ exports[`components/table/Table extended should have Duplicate Button 1`] = `
style="width: 100px;"
>
-
-
-
-
+ class="Person octo-propertyvalue octo-propertyvalue--readonly"
+ />
@@ -478,7 +464,7 @@ exports[`components/table/Table extended should match snapshot with CreatedAt 1`
>
@@ -1425,7 +1471,7 @@ exports[`components/table/Table extended should match snapshot with UpdatedAt 1`
- Status
+ Date Updated
@@ -1500,6 +1548,7 @@ exports[`components/table/Table extended should match snapshot with UpdatedAt 1`
class="open-button"
>
@@ -1551,17 +1600,9 @@ exports[`components/table/Table extended should match snapshot with UpdatedAt 1`
style="width: 100px;"
>
-
-
-
+ June 20, 2021, 12:22 PM
@@ -1574,6 +1615,7 @@ exports[`components/table/Table extended should match snapshot with UpdatedAt 1`
class="action-cell octo-table-cell-btn"
>
@@ -1626,6 +1669,7 @@ exports[`components/table/Table extended should match snapshot with UpdatedAt 1`
class="open-button"
>
@@ -1677,17 +1721,9 @@ exports[`components/table/Table extended should match snapshot with UpdatedAt 1`
style="width: 100px;"
>
-
-
-
+ June 22, 2021, 11:23 AM
@@ -1885,7 +1921,7 @@ exports[`components/table/Table extended should match snapshot with UpdatedBy 1`
- Status
+ Last Modified By
@@ -1960,6 +1998,7 @@ exports[`components/table/Table extended should match snapshot with UpdatedBy 1`
class="open-button"
>
@@ -2011,17 +2050,13 @@ exports[`components/table/Table extended should match snapshot with UpdatedBy 1`
style="width: 100px;"
>
-
-
-
+ username_4
+
@@ -2034,6 +2069,7 @@ exports[`components/table/Table extended should match snapshot with UpdatedBy 1`
class="action-cell octo-table-cell-btn"
>
@@ -2086,6 +2123,7 @@ exports[`components/table/Table extended should match snapshot with UpdatedBy 1`
class="open-button"
>
@@ -2137,17 +2175,13 @@ exports[`components/table/Table extended should match snapshot with UpdatedBy 1`
style="width: 100px;"
>
-
-
-
+ username_3
+
@@ -2361,6 +2395,7 @@ exports[`components/table/Table limited card in table view 1`] = `
class="open-button"
>
@@ -2442,6 +2477,7 @@ exports[`components/table/Table limited card in table view 1`] = `
class="open-button"
>
@@ -2551,6 +2587,7 @@ exports[`components/table/Table limited card in table view 1`] = `
Cards hidden
@@ -2581,7 +2618,7 @@ exports[`components/table/Table should match snapshot 1`] = `
>
{ newBlock.title = block.value.value newBlock.fields = {...newBlock.fields, value: block.value.checked} } - mutator.updateBlock(card.boardId, newBlock, originalContentBlock, intl.formatMessage({id: 'ContentBlock.editCardText', defaultMessage: 'edit card content'})) + mutator.updateBlock(card.boardId, newBlock, originalContentBlock, intl.formatMessage({id: 'ContentBlock.editCardText', defaultMessage: 'edit card text'})) return block }} onBlockMoved={async (block: BlockData, beforeBlock: BlockData|null, afterBlock: BlockData|null): Promise
- Confirm card delete! + Confirm card delete