From c5a4dd80f7953afcb52eb5bfc72efbd5f89ad82b Mon Sep 17 00:00:00 2001 From: kamre Date: Wed, 27 Oct 2021 14:04:15 +0700 Subject: [PATCH] [GH-705] Auto-name new property (#1408) * Open menu with property name and type when new property is added. * Adding new property asks for the type and sets initial name. * Component for property types menu items introduced. * Close property menu when enter is pressed in the input. * Unit test for `CardDetailProperties` fixed: - jest snapshot updated - switched from mocking `fetch` to mocking `mutator` * Unit tests for `CardDetailProperties` updated: - use the recommended way to get elements and trigger user events - test for properties menu when adding new property added * Unit tests for `CardDetailProperties` added: - delete existing property - add new property * Don't use debouncing for property type selection. * Fix unit test for deleting property. * Width of button `+ Add a property` is fixed. * Jest snapshot updated after merge with `main` --- .../__snapshots__/cardDialog.test.tsx.snap | 36 +- .../cardDetailProperties.test.tsx.snap | 378 +++++++++++++++++- .../src/components/cardDetail/cardDetail.scss | 5 - .../cardDetail/cardDetailProperties.test.tsx | 160 +++++--- .../cardDetail/cardDetailProperties.tsx | 57 ++- webapp/src/mutator.ts | 5 +- webapp/src/widgets/menuWrapper.tsx | 3 +- webapp/src/widgets/propertyMenu.tsx | 99 +++-- 8 files changed, 599 insertions(+), 144 deletions(-) diff --git a/webapp/src/components/__snapshots__/cardDialog.test.tsx.snap b/webapp/src/components/__snapshots__/cardDialog.test.tsx.snap index 9ef9c5c4e..437ed9577 100644 --- a/webapp/src/components/__snapshots__/cardDialog.test.tsx.snap +++ b/webapp/src/components/__snapshots__/cardDialog.test.tsx.snap @@ -287,13 +287,19 @@ exports[`components/cardDialog return cardDialog menu content 1`] = `
- + +

@@ -693,13 +699,19 @@ exports[`components/cardDialog should match snapshot 1`] = `
- + +

diff --git a/webapp/src/components/cardDetail/__snapshots__/cardDetailProperties.test.tsx.snap b/webapp/src/components/cardDetail/__snapshots__/cardDetailProperties.test.tsx.snap index cbb3e60e5..814a4f13f 100644 --- a/webapp/src/components/cardDetail/__snapshots__/cardDetailProperties.test.tsx.snap +++ b/webapp/src/components/cardDetail/__snapshots__/cardDetailProperties.test.tsx.snap @@ -45,14 +45,378 @@ exports[`components/cardDetail/CardDetailProperties should match snapshot 1`] =
- + +
+ + + +`; + +exports[`components/cardDetail/CardDetailProperties should show property types menu 1`] = ` +
+
+
+ +
+ + + Jean-Luc Picard + + +
+
+
+