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

fix(option): emit selection change when selection is changed #1334

Merged
merged 14 commits into from
Apr 8, 2019
Merged

fix(option): emit selection change when selection is changed #1334

merged 14 commits into from
Apr 8, 2019

Conversation

yggg
Copy link
Contributor

@yggg yggg commented Mar 29, 2019

Please read and mark the following check list before creating a pull request:

Short description of what this resolves:

Previously NbOptionComponent 'selectionChange' where emitted only when
option clicked, ignoring cases where select/deselect methods were called
from NbSelectComponent.

Also deprecates NbSelectComponent 'selectionChange' property.
We already has 'selectedChange' for this. Also 'selectionChange' name is
a bit confusing since it emits only when option clicked.

yggg added 2 commits March 29, 2019 18:21
Previously NbOptionComponent 'selectionChange' where emitted only when
option clicked, ignoring cases where select/deselect methods were called
from NbSelectComponent.

Also deprecates NbSelectComponent 'selectionChange' property.
We already has 'selectedChange' for this. Also 'selectionChange' name is
a bit confusing since it emits only when option clicked.
@yggg yggg requested a review from Tibing March 29, 2019 15:23
@yggg yggg requested a review from nnixaa April 4, 2019 08:26
@codecov
Copy link

codecov bot commented Apr 8, 2019

Codecov Report

Merging #1334 into master will increase coverage by 0.03%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #1334      +/-   ##
==========================================
+ Coverage   81.14%   81.17%   +0.03%     
==========================================
  Files         232      232              
  Lines        7048     7049       +1     
  Branches      598      598              
==========================================
+ Hits         5719     5722       +3     
+ Misses       1152     1151       -1     
+ Partials      177      176       -1
Impacted Files Coverage Δ
...mework/theme/components/select/select.component.ts 90.16% <100%> (+0.32%) ⬆️
...mework/theme/components/select/option.component.ts 97.61% <100%> (+3.02%) ⬆️

/**
* Stream of events that will fire when one of the options fire selectionChange event.
* */
/* @deprecated */
protected selectionChange$: Subject<NbOptionComponent<T>> = new Subject();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is internal change there is no need to deprecate it, we can just break it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 5ca3837

@@ -115,10 +122,10 @@ export class NbOptionComponent<T> implements OnDestroy {
* Also Angular can call writeValue on destroyed view (select implements ControlValueAccessor).
* angular/angular#27803
* */
if (this.alive) {
if (this.alive && this.selected !== isSelected) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since instance variable is called selected why don't we call local variable same selected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed in 0a89ed2

@yggg yggg requested a review from nnixaa April 8, 2019 11:01
@yggg yggg merged commit 788a6d4 into akveo:master Apr 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants