momentum-design / momentum-ui

Momentum UI is a collection of UI libraries for implementing Momentum Design into web applications and websites.
https://momentum.design
MIT License
199 stars 204 forks source link

feat: dropdown to watch for changes in default option prop #1317

Closed sohonisaurabh closed 2 years ago

sohonisaurabh commented 2 years ago

Description

Dropdown component does not watch for changes in defaultOption prop, when this is changed programatically. This results in display of outdated selected option on UI. This PR fixes this issue by adding a watcher for changes in defaultOption prop.

Related Issue

Motivation and Context

Discovered this issue while implementing user preferences pane in UX refresh

How Has This Been Tested?

Tested using built bundle in consumer code. And also via unit tests

Screenshots:

Before (If applicable):

After:

Types of changes

Checklist:

codecov[bot] commented 2 years ago

Codecov Report

Merging #1317 (671df63) into master (9692f80) will decrease coverage by 0.00%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1317      +/-   ##
==========================================
- Coverage   94.10%   94.09%   -0.01%     
==========================================
  Files         132      132              
  Lines       17677    17684       +7     
  Branches     2647     2647              
==========================================
+ Hits        16635    16640       +5     
- Misses       1042     1044       +2     
Impacted Files Coverage Δ
web-components/src/components/dropdown/Dropdown.ts 88.84% <100.00%> (+0.15%) :arrow_up:
web-components/src/components/icon/Icon.ts 78.57% <0.00%> (-4.17%) :arrow_down:
web-components/src/mixins/RovingTabIndexMixin.ts 93.63% <0.00%> (-3.64%) :arrow_down:
...components/src/components/datepicker/DatePicker.ts 87.45% <0.00%> (-2.67%) :arrow_down:
web-components/src/components/input/Input.ts 98.87% <0.00%> (-0.38%) :arrow_down:
...nts/src/components/table-advanced/TableAdvanced.ts 88.10% <0.00%> (+0.46%) :arrow_up:
web-components/src/components/radio/Radio.ts 97.84% <0.00%> (+2.15%) :arrow_up:
web-components/src/components/tabs/Tab.ts 100.00% <0.00%> (+5.39%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.