-
Notifications
You must be signed in to change notification settings - Fork 190
feat: add Component::bindVisible #23095
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
base: main
Are you sure you want to change the base?
Conversation
Adds public void bindVisible(Signal<Boolean>) method to Component and Element. ElementAttributeMap, AbstractPropertyMap and NodeMap are refactored to share same bindSignal and hasSignal code. Fixes: #23030
| public void bindVisible_elementNotAttached_bindingInactive() { | ||
| Element element = new Element("foo"); | ||
| ValueSignal<Boolean> signal = new ValueSignal<>(true); | ||
| element.bindVisible(signal); |
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.
I'd suggest to add a signal state change here to verify that it has no effect:
| element.bindVisible(signal); | |
| element.bindVisible(signal); | |
| signal.value(false); // ignored |
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.
Thanks, I copied this test with initial signal being false and then of course missed this important piece of detail after changing it to true. Fixed.
| signal.value(false); // no effect | ||
| assertTrue(element.isVisible()); | ||
| assertTrue(events.isEmpty()); | ||
| } |
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.
What happens if the element is hidden through signal binding, and then the binding is removed? Should the element assume default visible or keep hidden state? Would it make sense to assert this?
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.
State is preserved as false since removing binding is not changing the state anymore. in other words, it doesn't matter whether state changes via signal or manually. I'll add a test.
|



Adds public void bindVisible(Signal) method to Component and Element. ElementAttributeMap, AbstractPropertyMap and NodeMap are refactored to share same bindSignal and hasSignal code.
Fixes: #23030