Skip to content

Commit

Permalink
[NOREF] - Fixed previous names readonly render to now render in bullet (
Browse files Browse the repository at this point in the history
#983)

Fixed previous names render to now render in bullet
  • Loading branch information
patrickseguraoddball authored Feb 29, 2024
1 parent 360a1e8 commit baadc1b
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 20 deletions.
40 changes: 31 additions & 9 deletions src/components/ShareExport/__snapshots__/index.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,22 @@ exports[`ShareExportModal > matches the snapshot 1`] = `
>
Previous names
</p>
<div
class="margin-y-0 font-body-md line-height-sans-4 text-pre-line"
<ul
class="margin-y-0 padding-left-3"
>
First NameSecond Name
</div>
<li
class="font-sans-md line-height-sans-4"
>
First Name
</li>
<ul />
<li
class="font-sans-md line-height-sans-4"
>
Second Name
</li>
<ul />
</ul>
</div>
</div>
<div
Expand Down Expand Up @@ -8240,11 +8251,22 @@ exports[`ShareExportModal > matches the snapshot 2`] = `
>
Previous names
</p>
<div
class="margin-y-0 font-body-md line-height-sans-4 text-pre-line"
>
First NameSecond Name
</div>
<ul
class="margin-y-0 padding-left-3"
>
<li
class="font-sans-md line-height-sans-4"
>
First Name
</li>
<ul />
<li
class="font-sans-md line-height-sans-4"
>
Second Name
</li>
<ul />
</ul>
</div>
</div>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,22 @@ exports[`Read Only Model Plan Summary -- Model Basics > matches snapshot 1`] = `
>
Previous names
</p>
<div
class="margin-y-0 font-body-md line-height-sans-4 text-pre-line"
<ul
class="margin-y-0 padding-left-3"
>
First NameSecond Name
</div>
<li
class="font-sans-md line-height-sans-4"
>
First Name
</li>
<ul />
<li
class="font-sans-md line-height-sans-4"
>
Second Name
</li>
<ul />
</ul>
</div>
</div>
<div
Expand Down
19 changes: 15 additions & 4 deletions src/views/ModelPlan/ReadOnly/__snapshots__/index.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -530,11 +530,22 @@ exports[`Read Only Model Plan Summary > matches snapshot 1`] = `
>
Previous names
</p>
<div
class="margin-y-0 font-body-md line-height-sans-4 text-pre-line"
<ul
class="margin-y-0 padding-left-3"
>
First NameSecond Name
</div>
<li
class="font-sans-md line-height-sans-4"
>
First Name
</li>
<ul />
<li
class="font-sans-md line-height-sans-4"
>
Second Name
</li>
<ul />
</ul>
</div>
</div>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ const RenderReadonlyValue = <
// Renders a single value
if (
isTranslationFieldProperties(config) &&
!isTranslationFieldPropertiesWithOptions(config)
!isTranslationFieldPropertiesWithOptions(config) &&
!config.isArray
) {
return <SingleValue value={value} />;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ export const formatListValues = <
| TranslationFieldPropertiesWithOptions<T>, // Translation config
value: T[] | undefined // field value/enum array
): string[] => {
if (!isTranslationFieldPropertiesWithOptions(config)) return [];
if (config.isArray || config.isModelLinks) return value as string[];

if (config.isModelLinks) return value as string[];
if (!isTranslationFieldPropertiesWithOptions(config)) return [];

return getKeys(config.options)
.filter(option => Array.isArray(value) && value?.includes(option))
Expand Down

0 comments on commit baadc1b

Please sign in to comment.