-
Notifications
You must be signed in to change notification settings - Fork 93
Feat: placeOfEvent #11246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Feat: placeOfEvent #11246
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2ac7034
placeOfEvent configuration
tareq89 08aa8b9
placeOfEvent test
tareq89 d5c2aec
placeOfEvent test reindexing
tareq89 f8d5b48
test code for placeOfEvent fallback value
tareq89 5ae212a
Refactor placeOfEvent to use single HIDDEN field instead of array of …
tareq89 05b43e0
Added experimental ALPHA_HIDDEN form field type, allowing configurabl…
tareq89 a030649
ALPHA_HIDDEN field is added in FieldTypesToHideInReview
tareq89 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
...ges/client/src/v2-events/features/events/registered-fields/Hidden.interaction.stories.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| /* | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
| * | ||
| * OpenCRVS is also distributed under the terms of the Civil Registration | ||
| * & Healthcare Disclaimer located at http://opencrvs.org/license. | ||
| * | ||
| * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. | ||
| */ | ||
| import type { Meta, StoryObj } from '@storybook/react' | ||
| import React from 'react' | ||
| import styled from 'styled-components' | ||
| import { expect, within } from '@storybook/test' | ||
| import { TRPCProvider } from '@client/v2-events/trpc' | ||
| import { Hidden } from './Hidden' | ||
|
|
||
| const meta: Meta<typeof Hidden.Input> = { | ||
| title: 'Inputs/Hidden', | ||
| component: Hidden.Input, | ||
| args: {}, | ||
| decorators: [ | ||
| (Story) => ( | ||
| <TRPCProvider> | ||
| <Story /> | ||
| </TRPCProvider> | ||
| ) | ||
| ] | ||
| } | ||
|
|
||
| export default meta | ||
|
|
||
| const Box = styled.div` | ||
| border: 2px solid #000; | ||
| padding: 1rem; | ||
| ` | ||
|
|
||
| function HiddenComponentBox({ children }: { children: React.ReactNode }) { | ||
| return ( | ||
| <div> | ||
| <h2> | ||
| { | ||
| 'Inside the box there is a hidden component, which is not rendered in the UI, but is present in the DOM' | ||
| } | ||
| </h2> | ||
| <Box>{children}</Box> | ||
| </div> | ||
| ) | ||
| } | ||
|
|
||
| export const HiddenInput: StoryObj<typeof Hidden.Input> = { | ||
| args: { | ||
| id: 'hidden-input', | ||
| value: 'hidden value' | ||
| }, | ||
| render: (args) => ( | ||
| <HiddenComponentBox> | ||
| <Hidden.Input {...args} /> | ||
| </HiddenComponentBox> | ||
| ), | ||
| play: async ({ canvasElement }) => { | ||
| const canvas = within(canvasElement) | ||
| const hiddenInput = await canvas.findByTestId('text__hidden-input') | ||
| await expect(hiddenInput).toBeInTheDocument() | ||
| await expect(hiddenInput).toHaveValue('hidden value') | ||
| } | ||
| } |
31 changes: 31 additions & 0 deletions
31
packages/client/src/v2-events/features/events/registered-fields/Hidden.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /* | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
| * | ||
| * OpenCRVS is also distributed under the terms of the Civil Registration | ||
| * & Healthcare Disclaimer located at http://opencrvs.org/license. | ||
| * | ||
| * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. | ||
| */ | ||
| import * as React from 'react' | ||
|
|
||
| function HiddenInput({ id, value }: { id: string; value?: string }) { | ||
| return ( | ||
| <input | ||
| data-testid={`text__${id}`} | ||
| disabled={true} | ||
| id={id} | ||
| name={id} | ||
| type="hidden" | ||
| value={value} | ||
| /> | ||
| ) | ||
| } | ||
|
|
||
| export const Hidden = { | ||
| Input: HiddenInput, | ||
| stringify: (value: string | undefined) => { | ||
| return value?.toString() || '' | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.