Skip to content

Commit

Permalink
new line for each tag
Browse files Browse the repository at this point in the history
  • Loading branch information
liu-samuel committed Dec 10, 2024
1 parent 88695dc commit 14fd627
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ import classNames from 'classnames';

/** Component to print the text value inside a cell. */
const MiqStructuredListText = ({ value }) => {
const text = (value === null || value === undefined ? '' : String(value));

let text;
if (Array.isArray(value)) {
text = value.join('\n');
} else {
text = (value === null || value === undefined ? '' : String(value));
}
return (
<div className={classNames(text ? 'expand' : '', 'wrap_text')}>
{text}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,8 @@ exports[`TagGroup renders just fine 1`] = `
<div
className="expand wrap_text"
>
Policy,2
Policy
2
</div>
</MiqStructuredListText>
</div>
Expand Down Expand Up @@ -1173,7 +1174,9 @@ exports[`TagGroup renders just fine 1`] = `
<div
className="expand wrap_text"
>
Policy,2,3
Policy
2
3
</div>
</MiqStructuredListText>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('TagGroup', () => {
};

const wrapper = mount(<TagGroup items={tagData.items} title={tagData.title} />);
expect(wrapper.html()).toContain('<div class="expand wrap_text">Policy,2</div>');
expect(wrapper.html()).toContain('<div class="expand wrap_text">Policy\n2</div>');
expect(wrapper.containsMatchingElement(<i className="fa fa-tag" />)).toEqual(true);
});
});
1 change: 1 addition & 0 deletions app/stylesheet/miq-structured-list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
.wrap_text {
width: 100%;
word-break: break-all;
white-space: pre-line;
}

&.bordered-list {
Expand Down

0 comments on commit 14fd627

Please sign in to comment.