Skip to content

feat: add Markdown.bindContent(Signal<String>)#9391

Open
Artur- wants to merge 1 commit into
mainfrom
feature/markdown-bind-content-signal
Open

feat: add Markdown.bindContent(Signal<String>)#9391
Artur- wants to merge 1 commit into
mainfrom
feature/markdown-bind-content-signal

Conversation

@Artur-
Copy link
Copy Markdown
Member

@Artur- Artur- commented May 29, 2026

Allow driving Markdown content from a Signal through a new bindContent method and matching signal constructor. The existing setContent and appendContent throw BindingActiveException while a binding is active to keep component state consistent with the signal.

Fixes #9388

Allow driving Markdown content from a Signal<String> through a new
bindContent method and matching signal constructor. The existing
setContent and appendContent throw BindingActiveException while a
binding is active to keep component state consistent with the signal.

Fixes #9388
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do the new ITs add significant value over the JS sync tests in MarkdownSignalTest?

I feel they could be dropped as the existing ITs already verify that the JS sync works and the signal binding reuses the same infrastructure.

}

@Test
void bindContent_constructorBinds() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Test structure around constructor usage is quite messy:

  • This one tests the constructor specifically, but still mentions bindContent which is never used in this test
  • Then subsequent tests arbitrarily either use the constructor or the bindContent method despite all having names including bindContent

I'd suggest to have a single test for the constructor (this one marked here, as is) and give it a more appropriate name, and then only use bindContent in other tests for clarity.

Some existing naming candidates for this test from other components:

  Badge (BadgeSignalTest.java) — <param>Constructor style
  - textSignalConstructor()
  - textSignalAndIconConstructor()
  
  Button (ButtonSignalTest.java) — <param>Ctor style (abbreviated)
  - textSignalCtor()
  - textSignalAndIconCtor()
  - textSignalAndEventCtor()
  - textSignalAndIconAndEventCtor()
  
  Icon (IconSignalTest.java) — constructor_<params>_<expectation> style
  - constructor_withSignal_bindsIconCorrectly()
  
  SvgIcon (SvgIconSignalTest.java) — same constructor_<params>_<expectation> style as Icon
  - constructor_stringWithSignal_bindsSymbolCorrectly()
  - constructor_downloadHandlerWithSignal_bindsSymbolCorrectly()

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.

Markdown should provide a bindContent(Signal) method

2 participants