Skip to content

Conversation

@tltv
Copy link
Member

@tltv tltv commented Dec 30, 2025

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

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
@github-actions
Copy link

github-actions bot commented Dec 30, 2025

Test Results

1 308 files  + 2  1 308 suites  +2   1h 16m 42s ⏱️ + 1m 38s
9 273 tests +10  9 205 ✅ +10  68 💤 ±0  0 ❌ ±0 
9 722 runs  ± 0  9 646 ✅ ± 0  76 💤 ±0  0 ❌ ±0 

Results for commit b3077a6. ± Comparison against base commit e016202.

♻️ This comment has been updated with latest results.

public void bindVisible_elementNotAttached_bindingInactive() {
Element element = new Element("foo");
ValueSignal<Boolean> signal = new ValueSignal<>(true);
element.bindVisible(signal);
Copy link
Contributor

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:

Suggested change
element.bindVisible(signal);
element.bindVisible(signal);
signal.value(false); // ignored

Copy link
Member Author

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());
}
Copy link
Contributor

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?

Copy link
Member Author

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.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 2, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Component::bindVisible

3 participants