Skip to content
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

Creates a generic resource details component #1397

Merged
merged 6 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ test('works correctly', async () => {

// see view details contents
const keyValuePairs = document.querySelectorAll(
'div[data-testid="key-value"] .singleKeyValue-pair'
'div[data-testid="key-value"] .singleKeyValue-pair__default'
);
keyValuePairs.forEach((pair) => {
expect(pair).toMatchSnapshot();
Expand Down Expand Up @@ -105,7 +105,7 @@ test('Closes on clicking cancel (X) ', async () => {

// see view details contents
const keyValuePairs = document.querySelectorAll(
'div[data-testid="key-value"] .singleKeyValue-pair'
'div[data-testid="key-value"] .singleKeyValue-pair__default'
);
keyValuePairs.forEach((pair) => {
expect(pair).toMatchSnapshot();
Expand Down Expand Up @@ -145,7 +145,7 @@ test('1157 - view details errors out for careTeam 3500', async () => {

// see view details contents
const keyValuePairs = document.querySelectorAll(
'div[data-testid="key-value"] .singleKeyValue-pair'
'div[data-testid="key-value"] .singleKeyValue-pair__default'
);
keyValuePairs.forEach((pair) => {
expect(pair).toMatchSnapshot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const keyValueDetailRender = (obj: IGroup, t: TFunction) => {
};
return value ? (
<div key={key} data-testid="key-value">
<SingleKeyNestedValue {...props} />
<SingleKeyNestedValue data={props} />
</div>
) : null;
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,38 @@

exports[`renders correctly when listing resources 3`] = `
<div
class="singleKeyValue-pair"
class="singleKeyValue-pair__default"
>
<dt
class="singleKeyValue-pair__label"
>
<dt>
Commodity Id
</dt>
<dd
class="singleKeyValue-pair__value"
>
<dd>
e50eb835-7827-4001-b233-e1dda721d4e8
</dd>
</div>
`;

exports[`renders correctly when listing resources 4`] = `
<div
class="singleKeyValue-pair"
class="singleKeyValue-pair__default"
>
<dt
class="singleKeyValue-pair__label"
>
<dt>
Name
</dt>
<dd
class="singleKeyValue-pair__value"
>
<dd>
Amoxicillin 250mg Tablets
</dd>
</div>
`;

exports[`renders correctly when listing resources 5`] = `
<div
class="singleKeyValue-pair"
class="singleKeyValue-pair__default"
>
<dt
class="singleKeyValue-pair__label"
>
<dt>
Active
</dt>
<dd
class="singleKeyValue-pair__value"
>
<dd>
Disabled
</dd>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ test('renders correctly when listing resources', async () => {

// see view details contents
const keyValuePairs = document.querySelectorAll(
'div[data-testid="key-value"] .singleKeyValue-pair'
'div[data-testid="key-value"] .singleKeyValue-pair__default'
);
keyValuePairs.forEach((pair) => {
expect(pair).toMatchSnapshot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const EusmViewDetails = (props: EusmViewDetailsProps) => {
};
return value ? (
<div key={key} data-testid="key-value">
<SingleKeyNestedValue {...props} />
<SingleKeyNestedValue data={props} />
</div>
) : null;
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,152 +2,116 @@

exports[`renders correctly when listing resources 3`] = `
<div
class="singleKeyValue-pair"
class="singleKeyValue-pair__default"
>
<dt
class="singleKeyValue-pair__label"
>
<dt>
Product Id
</dt>
<dd
class="singleKeyValue-pair__value"
>
<dd>
52cffa51-fa81-49aa-9944-5b45d9e4c117
</dd>
</div>
`;

exports[`renders correctly when listing resources 4`] = `
<div
class="singleKeyValue-pair"
class="singleKeyValue-pair__default"
>
<dt
class="singleKeyValue-pair__label"
>
<dt>
Material Number
</dt>
<dd
class="singleKeyValue-pair__value"
>
<dd>
52cffa51-fa81-49aa-9944-5b45d9e4c117
</dd>
</div>
`;

exports[`renders correctly when listing resources 5`] = `
<div
class="singleKeyValue-pair"
class="singleKeyValue-pair__default"
>
<dt
class="singleKeyValue-pair__label"
>
<dt>
Name
</dt>
<dd
class="singleKeyValue-pair__value"
>
<dd>
Bed nets
</dd>
</div>
`;

exports[`renders correctly when listing resources 6`] = `
<div
class="singleKeyValue-pair"
class="singleKeyValue-pair__default"
>
<dt
class="singleKeyValue-pair__label"
>
<dt>
Active
</dt>
<dd
class="singleKeyValue-pair__value"
>
<dd>
Active
</dd>
</div>
`;

exports[`renders correctly when listing resources 7`] = `
<div
class="singleKeyValue-pair"
class="singleKeyValue-pair__default"
>
<dt
class="singleKeyValue-pair__label"
>
<dt>
Attractive item
</dt>
<dd
class="singleKeyValue-pair__value"
>
<dd>
No
</dd>
</div>
`;

exports[`renders correctly when listing resources 8`] = `
<div
class="singleKeyValue-pair"
class="singleKeyValue-pair__default"
>
<dt
class="singleKeyValue-pair__label"
>
<dt>
Is it there
</dt>
<dd
class="singleKeyValue-pair__value"
>
<dd>
yes
</dd>
</div>
`;

exports[`renders correctly when listing resources 9`] = `
<div
class="singleKeyValue-pair"
class="singleKeyValue-pair__default"
>
<dt
class="singleKeyValue-pair__label"
>
<dt>
Is it in good condition
</dt>
<dd
class="singleKeyValue-pair__value"
>
<dd>
Yes, no tears, and inocuated
</dd>
</div>
`;

exports[`renders correctly when listing resources 10`] = `
<div
class="singleKeyValue-pair"
class="singleKeyValue-pair__default"
>
<dt
class="singleKeyValue-pair__label"
>
<dt>
Is it being used appropriately
</dt>
<dd
class="singleKeyValue-pair__value"
>
<dd>
Hanged at correct height and covers averagely sized beds
</dd>
</div>
`;

exports[`renders correctly when listing resources 11`] = `
<div
class="singleKeyValue-pair"
class="singleKeyValue-pair__default"
>
<dt
class="singleKeyValue-pair__label"
>
<dt>
Accountability period (in months)
</dt>
<dd
class="singleKeyValue-pair__value"
>
<dd>
12
</dd>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ test('renders correctly when listing resources', async () => {

// see view details contents
const keyValuePairs = document.querySelectorAll(
'div[data-testid="key-value"] .singleKeyValue-pair'
'div[data-testid="key-value"] .singleKeyValue-pair__default'
);
keyValuePairs.forEach((pair) => {
expect(pair).toMatchSnapshot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ test('test error on attached binary request', async () => {

await waitForElementToBeRemoved(document.querySelector('.ant-spin'));

const commodityValues = [...document.querySelectorAll('.singleKeyValue-pair')].map(
const commodityValues = [...document.querySelectorAll('.singleKeyValue-pair__default')].map(
(keyValue) => keyValue.textContent
);
expect(commodityValues).toEqual([
Expand Down Expand Up @@ -128,7 +128,7 @@ test('test missing binary in commodity', async () => {

await waitForElementToBeRemoved(document.querySelector('.ant-spin'));

const commodityValues = [...document.querySelectorAll('.singleKeyValue-pair')].map(
const commodityValues = [...document.querySelectorAll('.singleKeyValue-pair__default')].map(
(keyValue) => keyValue.textContent
);
expect(commodityValues).toEqual([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const keyValueDetailRender = (obj: IGroup, t: TFunction) => {
};
return value ? (
<div key={key} data-testid="key-value">
<SingleKeyNestedValue {...props} />
<SingleKeyNestedValue data={props} />
</div>
) : null;
})}
Expand Down
Loading
Loading