From ce93384b82384cf682cf5783636b0f972e71750c Mon Sep 17 00:00:00 2001 From: Priyang <=> Date: Wed, 16 Mar 2022 00:52:32 +0530 Subject: [PATCH 01/11] E2E Test 1130 Added Test for moving the selected cell with arrow keys inside test_records.py file in test folder --- mathesar/tests/integration/test_records.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mathesar/tests/integration/test_records.py b/mathesar/tests/integration/test_records.py index add3d61baf..e70b0b62ff 100644 --- a/mathesar/tests/integration/test_records.py +++ b/mathesar/tests/integration/test_records.py @@ -47,3 +47,13 @@ def test_delete_multiple_rows(page, go_to_patents_data_table): page.click("button:has-text('Delete 2 records')") expect(page.locator("text=ARC-14281-1")).not_to_be_visible() expect(page.locator("text=ARC-14512-1")).not_to_be_visible() + +def test_keyboard_Cell_Moving(page, go_to_patents_data_table): + cell = page.locator(".cell:has-text('ARC-14512-1') .cell-wrapper") + cell.click() + expect(cell).to_have_class(re.compile("is-active")) + page.keyboard.press('ArrowDown') + page.keyboard.press('ArrowLeft') + page.keyboard.press('ArrowUp') + page.keyboard.press('ArrowRight') + expect(cell).to_have_class(re.compile("is-active")) \ No newline at end of file From a0d862d164a7426db5e1ab562aa6d6a1247952b3 Mon Sep 17 00:00:00 2001 From: Priyang <=> Date: Wed, 16 Mar 2022 11:02:21 +0530 Subject: [PATCH 02/11] Fixed Lint Python code --- mathesar/tests/integration/test_records.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mathesar/tests/integration/test_records.py b/mathesar/tests/integration/test_records.py index e70b0b62ff..fc2ab99d84 100644 --- a/mathesar/tests/integration/test_records.py +++ b/mathesar/tests/integration/test_records.py @@ -48,6 +48,7 @@ def test_delete_multiple_rows(page, go_to_patents_data_table): expect(page.locator("text=ARC-14281-1")).not_to_be_visible() expect(page.locator("text=ARC-14512-1")).not_to_be_visible() + def test_keyboard_Cell_Moving(page, go_to_patents_data_table): cell = page.locator(".cell:has-text('ARC-14512-1') .cell-wrapper") cell.click() @@ -56,4 +57,4 @@ def test_keyboard_Cell_Moving(page, go_to_patents_data_table): page.keyboard.press('ArrowLeft') page.keyboard.press('ArrowUp') page.keyboard.press('ArrowRight') - expect(cell).to_have_class(re.compile("is-active")) \ No newline at end of file + expect(cell).to_have_class(re.compile("is-active")) From 6fed7aa16d4829339ed0120fe0da2b31282cee40 Mon Sep 17 00:00:00 2001 From: Priyang <=> Date: Fri, 18 Mar 2022 00:54:57 +0530 Subject: [PATCH 03/11] better assert --- mathesar/tests/integration/test_records.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/mathesar/tests/integration/test_records.py b/mathesar/tests/integration/test_records.py index fc2ab99d84..e90a9994a3 100644 --- a/mathesar/tests/integration/test_records.py +++ b/mathesar/tests/integration/test_records.py @@ -50,11 +50,20 @@ def test_delete_multiple_rows(page, go_to_patents_data_table): def test_keyboard_Cell_Moving(page, go_to_patents_data_table): - cell = page.locator(".cell:has-text('ARC-14512-1') .cell-wrapper") - cell.click() - expect(cell).to_have_class(re.compile("is-active")) - page.keyboard.press('ArrowDown') + cell1 = page.locator(".cell:has-text('6445390') .cell-wrapper") + cell2 = page.locator(".cell:has-text('ARC-14275-1') .cell-wrapper") + cell3 = page.locator(".cell:has-text('6606612') .cell-wrapper") + cell1.click() + expect(cell1).to_have_class(re.compile("is-active")) page.keyboard.press('ArrowLeft') - page.keyboard.press('ArrowUp') + expect(cell1).not_to_have_class(re.compile("is-active")) + expect(cell2).to_have_class(re.compile("is-active")) page.keyboard.press('ArrowRight') - expect(cell).to_have_class(re.compile("is-active")) + expect(cell1).to_have_class(re.compile("is-active")) + expect(cell2).not_to_have_class(re.compile("is-active")) + page.keyboard.press('ArrowDown') + expect(cell1).not_to_have_class(re.compile("is-active")) + expect(cell3).to_have_class(re.compile("is-active")) + page.keyboard.press('ArrowUp') + expect(cell1).to_have_class(re.compile("is-active")) + expect(cell3).not_to_have_class(re.compile("is-active")) From 10c39b65106edde07e62108aa30963d8dae82032 Mon Sep 17 00:00:00 2001 From: Priyang Date: Sun, 20 Mar 2022 01:23:16 +0530 Subject: [PATCH 04/11] Add ESLint rule to prohibit explicitly marking class members as public --- mathesar_ui/.eslintrc.cjs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mathesar_ui/.eslintrc.cjs b/mathesar_ui/.eslintrc.cjs index c95b21bae5..2491d6b3da 100644 --- a/mathesar_ui/.eslintrc.cjs +++ b/mathesar_ui/.eslintrc.cjs @@ -21,6 +21,7 @@ module.exports = { rules: { 'import/no-extraneous-dependencies': ['error', { devDependencies: true }], 'no-console': ['warn', { allow: ['error'] }], + '@typescript-eslint/explicit-member-accessibility': 'off', '@typescript-eslint/ban-ts-comment': [ 'error', { @@ -106,6 +107,15 @@ module.exports = { '@typescript-eslint/require-await': 'off', }, }, + { + files: ['*.ts', '*.tsx'], + rules: { + '@typescript-eslint/explicit-member-accessibility': [ + 'error', + { accessibility: 'no-public' }, + ], + }, + }, ], env: { es6: true, From 07085f26b663fc30a4dd73791abada3af37533df Mon Sep 17 00:00:00 2001 From: Priyang Date: Sun, 20 Mar 2022 01:32:40 +0530 Subject: [PATCH 05/11] Removed Public in contextValidation for removing lint error --- .../common/utils/contextValidationUtil.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mathesar_ui/src/component-library/common/utils/contextValidationUtil.ts b/mathesar_ui/src/component-library/common/utils/contextValidationUtil.ts index 84281a10b6..bdc7421aa8 100644 --- a/mathesar_ui/src/component-library/common/utils/contextValidationUtil.ts +++ b/mathesar_ui/src/component-library/common/utils/contextValidationUtil.ts @@ -8,11 +8,11 @@ export type ValidationResultStore = Writable; const VALIDATION_CONTEXT_KEY = 'validationContext'; class ContextBasedValidator { - public validationResult: Writable = writable(true); + validationResult: Writable = writable(true); - public validationFunctionMap: Map = new Map(); + validationFunctionMap: Map = new Map(); - public validate(): boolean { + validate(): boolean { let isValid = true; // eslint-disable-next-line no-restricted-syntax for (const validationFn of this.validationFunctionMap.values()) { @@ -22,7 +22,7 @@ class ContextBasedValidator { return isValid; } - public addValidator(key: string, fn: ValidationFunction) { + addValidator(key: string, fn: ValidationFunction) { this.validationFunctionMap.set(key, fn); onDestroy(() => { From 02089d21762e0bb6a83f8c3bf808923e7b4a7eb9 Mon Sep 17 00:00:00 2001 From: Priyang Date: Tue, 22 Mar 2022 14:01:07 +0530 Subject: [PATCH 06/11] Focus state being reset --- .../pagination/Pagination.svelte | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/mathesar_ui/src/component-library/pagination/Pagination.svelte b/mathesar_ui/src/component-library/pagination/Pagination.svelte index dab7d9868b..8dc03261aa 100644 --- a/mathesar_ui/src/component-library/pagination/Pagination.svelte +++ b/mathesar_ui/src/component-library/pagination/Pagination.svelte @@ -1,5 +1,5 @@ From cd6dcce7b5c88657f6704012a419108d09a214ce Mon Sep 17 00:00:00 2001 From: Pavish Kumar Date: Tue, 22 Mar 2022 23:36:19 +0530 Subject: [PATCH 11/11] Remove pagebutton variable from higher scope --- .../src/component-library/pagination/Pagination.svelte | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mathesar_ui/src/component-library/pagination/Pagination.svelte b/mathesar_ui/src/component-library/pagination/Pagination.svelte index 3b8885ab04..b2fa189426 100644 --- a/mathesar_ui/src/component-library/pagination/Pagination.svelte +++ b/mathesar_ui/src/component-library/pagination/Pagination.svelte @@ -45,7 +45,6 @@ $: pageCount = Math.ceil(total / pageSize); $: pageInfo = calculatePages(currentPage, pageCount); - let pagebutton: HTMLElement | null = null; async function setPage(e: Event, _page: number) { if (_page > 0 && _page <= pageCount && currentPage !== _page) { @@ -56,8 +55,8 @@ }); } await tick(); - pagebutton = document.querySelector(`[data-page="${currentPage}"]`); - pagebutton?.focus(); + const pagebutton = document.querySelector(`[data-page="${currentPage}"]`); + (pagebutton as HTMLElement)?.focus(); }