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

Addition of optional metaText details for Feat/select-options #936

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8f3ff04
feat: introduction of new variations - conversation to create new sel…
harshith-venkatesh-freshworks Aug 5, 2024
54e5a0d
feat: addition of dropdownvariant conversations with interface defined
harshith-venkatesh-freshworks Aug 5, 2024
17db7a4
test: addition of select options test cases
harshith-venkatesh-freshworks Aug 5, 2024
f9ed45d
docs: addition of documentation related to select-options
harshith-venkatesh-freshworks Aug 5, 2024
b455ffb
feat: handle the scenario when imageSrc is present
harshith-venkatesh-freshworks Aug 6, 2024
bce20c0
fix: changes to metaText from author for generic text in select option
harshith-venkatesh-freshworks Aug 9, 2024
ef046bd
fix: text cases changes
harshith-venkatesh-freshworks Aug 9, 2024
d03e4db
updated readme and minor changes
harshith-venkatesh-freshworks Aug 9, 2024
79d866d
readme documentation changes
harshith-venkatesh-freshworks Aug 9, 2024
506163c
select option test cases added
harshith-venkatesh-freshworks Aug 9, 2024
2c35849
Merge branch 'next' into feat/select-options
harshith-venkatesh-freshworks Sep 20, 2024
14514e6
addition of metaText to be conditionally rendered in select-option
harshith-venkatesh-freshworks Sep 20, 2024
a0b1e97
conditionally checking of the metaText details before adding to the m…
harshith-venkatesh-freshworks Sep 20, 2024
8399630
addition of conversation icon for conversation section
harshith-venkatesh-freshworks Sep 23, 2024
f59af73
Merge branch 'next' into feat/select-options
harshith-venkatesh-freshworks Sep 30, 2024
7fc89bd
Update on the removal of createConversation Description
harshith-venkatesh-freshworks Sep 30, 2024
e280127
fix: minor update on createDescription changes
harshith-venkatesh-freshworks Sep 30, 2024
d8d0fa9
changes on review comments
harshith-venkatesh-freshworks Sep 30, 2024
e784c9b
Update packages/crayons-core/src/components/select-option/select-opti…
harshith-venkatesh-freshworks Sep 30, 2024
1533384
test: addition of test cases for icon variation
harshith-venkatesh-freshworks Sep 30, 2024
c6485de
Merge branch 'next' into feat/select-options
harshith-venkatesh-freshworks Sep 30, 2024
fb4e567
Merge branch 'next' into feat/select-options
harshith-venkatesh-freshworks Sep 30, 2024
232a6ec
fix: test case changes for fw-select
harshith-venkatesh-freshworks Sep 30, 2024
cea5896
changes on test case for fw-select
harshith-venkatesh-freshworks Sep 30, 2024
a2a04d3
test: select option test case
harshith-venkatesh-freshworks Oct 1, 2024
674b06f
select e2e test case changes
harshith-venkatesh-freshworks Oct 1, 2024
4f73f70
addition of test case with no variation changes
harshith-venkatesh-freshworks Oct 1, 2024
8dc9424
test: minor fix
harshith-venkatesh-freshworks Oct 1, 2024
efba7d1
chore: remove commented line
harshith-venkatesh-freshworks Oct 1, 2024
af29b29
chore: update on select test case
harshith-venkatesh-freshworks Oct 3, 2024
2d31f4f
Merge branch 'next' into feat/select-options
rihansiddhi Oct 3, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,29 @@ describe('fw-select-option', () => {
expect(metaText.email).toBe('author@example.com');
expect(metaText.mobile).toBe('123-456-7890');
});

it('should render fw-select-option with no variant and verify attributes', async () => {
const page = await newE2EPage();

await page.setContent(
`<fw-select-option
text="This is a select option description"
subText="This is selected option subtext"
data-meta-text='{"name": "Author Name", "email": "author@example.com", "mobile": "123-456-7890"}'>
</fw-select-option>`
);

await page.waitForChanges();

const text = await page.find('fw-select-option >>> .description');
expect(text).toBeTruthy();
expect(text.innerText).toBe('This is a select option description');

const metaText = await page.$eval('fw-select-option', (elm: any) =>
JSON.parse(elm.getAttribute('data-meta-text'))
);
expect(metaText.name).toBe('Author Name');
expect(metaText.email).toBe('author@example.com');
expect(metaText.mobile).toBe('123-456-7890');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,9 @@ $bg-color-disabled: $color-smoke-25;
width: 1.25rem;
height: 1.25rem;
}

.conversation-icon {
display: flex;
align-self: flex-start;
min-height: 30px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ export class SelectOption {
return (
<Fragment>
{checkbox}
{this.createIcon()}
{this.createConversationDescription()}
{this.createConversationIcon()}
harshith-venkatesh-freshworks marked this conversation as resolved.
Show resolved Hide resolved
{description}
{selectedIconContainer}
</Fragment>
);
Expand All @@ -205,6 +205,24 @@ export class SelectOption {
}

createDescription() {
if (this.metaText) {
const metaTextDetails = [];
if (this.metaText?.name) metaTextDetails.push(this.metaText.name);
if (this.metaText?.email) metaTextDetails.push(this.metaText.email);
if (this.metaText?.mobile) metaTextDetails.push(this.metaText.mobile);

return (
<div class={'description ' + 'icon-margin '}>
<span class='description-text'>{this.text}</span>
{this.subText && (
<span class='description-subText-conversation'>{this.subText}</span>
)}
<span class='description-metaText-details'>
{metaTextDetails?.join(' | ')}
</span>
</div>
);
}
return this.subText ? (
<div
class={
Expand All @@ -227,23 +245,8 @@ export class SelectOption {
);
}

createConversationDescription() {
const metaTextDetails = [];
if (this.metaText.name) metaTextDetails.push(this.metaText.name);
if (this.metaText.email) metaTextDetails.push(this.metaText.email);
if (this.metaText.mobile) metaTextDetails.push(this.metaText.mobile);

return this.subText ? (
<div class={'description ' + 'icon-margin '}>
<span class='description-text'>{this.text}</span>
<span class='description-subText-conversation'>{this.subText}</span>
<span class='description-metaText-details'>
{metaTextDetails?.join(' | ')}
</span>
</div>
) : (
<span class={'description ' + 'icon-margin'}>{this.text}</span>
);
createConversationIcon() {
return <div class='conversation-icon'>{this.createIcon()}</div>;
}

createIcon() {
Expand Down
Loading