Skip to content

Commit

Permalink
[CHOPS-1424] Add bottom note prop to dropdown (#2059)
Browse files Browse the repository at this point in the history
* added bottomNote prop

* added test
  • Loading branch information
corinaper authored Nov 6, 2024
1 parent fea75d3 commit e0f3dca
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ebury/chameleon-components",
"version": "2.8.16",
"version": "2.8.17",
"main": "src/main.ts",
"sideEffects": false,
"author": "Ebury Team (http://labs.ebury.rocks/)",
Expand Down
77 changes: 77 additions & 0 deletions src/components/ec-dropdown/__snapshots__/ec-dropdown.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,83 @@ exports[`EcDropdown > :props > should render given popover style when it is a fu
</ul>
</div>
</ec-stub>
</div>
`;

exports[`EcDropdown > :props > should render properly when the bottomNote prop is set 1`] = `
<div
class="ec-dropdown ec-dropdown-search"
data-test="ec-dropdown ec-dropdown-search"
is-in-light-mode="false"
>
<ec-stub
autosize="true"
class="ec-dropdown-search__trigger"
data-test="ec-popover-dropdown-search ec-stub ec-popover-stub"
disabled="false"
distance="8"
placement="bottom-start"
popperclass="ec-dropdown-search__popover"
shift="false"
shown="false"
>
<div
class="ec-input-field"
data-test="ec-input-field"
>
<!--v-if-->
<input
class="ec-input-field__input ec-input-field__input--bg-gray-8 ec-input-field__input--has-icon ec-input-field__input--cursor-pointer"
data-test="ec-dropdown__input ec-input-field__input ec-mock ec-tooltip-mock"
id="ec-input-field-1"
placeholder=""
readonly=""
type="text"
/>
<!--v-if-->
<div
class="ec-input-field__icon-wrapper ec-input-field__icon-wrapper--right"
data-test="ec-input-field__icon-wrapper"
>
<!--v-if-->
<svg
class="ec-icon ec-input-field__icon"
data-test="ec-input-field__icon"
height="24"
width="24"
>
<use
xlink:href="#ec-simple-chevron-down"
/>
</svg>
</div>
<div
class="ec-input-field__bottom-note"
data-test="ec-input-field__bottom-note"
>
Testing the bottomNote prop
</div>
</div>
<div>
<ul
class="ec-dropdown-search__item-list"
data-test="ec-dropdown-search__item-list"
>
<!--v-if-->
<!--v-if-->
</ul>
</div>
Expand Down
5 changes: 5 additions & 0 deletions src/components/ec-dropdown/ec-dropdown.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ describe('EcDropdown', () => {
expect(wrapper.element).toMatchSnapshot();
});

it('should render properly when the bottomNote prop is set', () => {
const wrapper = mountDropdown({ bottomNote: 'Testing the bottomNote prop' });
expect(wrapper.element).toMatchSnapshot();
});

it('should render given popover style', () => {
const wrapper = mountDropdown({ popoverStyle: { width: '1234px' } });
expect(wrapper.element).toMatchSnapshot();
Expand Down
1 change: 1 addition & 0 deletions src/components/ec-dropdown/ec-dropdown.story.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ basic.args = {
disabled: false,
isSensitive: false,
errorMessage: '',
bottomNote: '',
modelValue: undefined,
};

Expand Down
2 changes: 2 additions & 0 deletions src/components/ec-dropdown/ec-dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
:icon="isDropdownOpen ? IconName.SIMPLE_CHEVRON_UP : IconName.SIMPLE_CHEVRON_DOWN"
:is-in-group="isInGroup"
:bg-color-level="(isInLightMode && !isDropdownOpen) ? 7 : 8"
:bottom-note="bottomNote"
:show-pointer-cursor="true"
:show-input-tooltip="true"
@focus="onFocus"
Expand Down Expand Up @@ -103,6 +104,7 @@ const props = withDefaults(defineProps<DropdownProps<TValue, TDropdownItem>>(),
searchPlaceholder: 'Search...',
noResultsText: 'No results found',
tooltipCta: '',
bottomNote: '',
isInLightMode: false,
});
Expand Down
1 change: 1 addition & 0 deletions src/components/ec-dropdown/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface DropdownProps<TValue = string, TDropdownItem extends DropdownIt
label?: string,
labelTooltip?: string,
errorMessage?: string,
bottomNote?: string,
isInGroup?: 'left' | 'right',
isInLightMode?: boolean,
}

0 comments on commit e0f3dca

Please sign in to comment.