-
Notifications
You must be signed in to change notification settings - Fork 161
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(toast): isVisible property binding - master #8775
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a test that verifies setting isVisible actually opens/shows the toast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using event handlers for executing expectations results in false negative test - if event handlers are not called, test will still succeed, while there is a bug (toast is not actually opened and event is not emitted).
It's better to use jasmine spyOn to test if event is emitted.
Also, after discussion, we agreed for the following enhacements:
- Rethinkg igxToggleDircetive open method:
this.collapsed = false;
this.cdr.detectChanges();
const openEventArgs: ToggleViewCancelableEventArgs = { cancel: false, owner: this, id: this._overlayId };
this.onOpening.emit(openEventArgs);
if (openEventArgs.cancel) {
this.collapsed = true;
this.cdr.detectChanges();
return;
}
Seems too much. Must be safe to emit the onOpening event first, and if canceled, then return. Everything else to be removed.
- Rethink if this.unsubscribe() is needed
All those subscriptions (_overlayAppendedSub, _overlayOpenedSub, _overlayClosingSub, _overlayClosedSub) can be refactored to take the first emitted value only:
this._overlayOpenedSub = this.overlayService.onOpened.pipe(...this._overlaySubFilter, first())...
-
Rethink if safe to move all subscriptions (_overlayAppendedSub, _overlayOpenedSub, _overlayClosingSub, _overlayClosedSub) in the constructor. Make sure _overlayId is correct.
-
See if any detectChanges() call is excessive.Try to move all of those in the overlay.
-
Deprecate toast showing and hiding events, as suggested in the issue.
…UI/igniteui-angular into dTsvetkov/fix-8207-master
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done. I see that the changes regarding the migration are applied as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- visibility is updated by the toggle() method
- should open and close toast when set values to isVisible
- should emit onHidden when toggle onClosed is fired
- should emit onShown when toggle onOpened is fired
The above tests implementation result in false negative tests. Please refactor those.
Closes #8207
Additional information (check all that apply):
Checklist:
feature/README.MD
updates for the feature docsREADME.MD
CHANGELOG.MD
updates for newly added functionalityng update
migrations for the breaking changes (migrations guidelines)