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

Empty String in attribute value should not remove it #255

Closed
casid opened this issue Aug 1, 2023 · 1 comment
Closed

Empty String in attribute value should not remove it #255

casid opened this issue Aug 1, 2023 · 1 comment
Assignees

Comments

@casid
Copy link
Owner

casid commented Aug 1, 2023

Especially for options this feature breaks the intent of the user:

@Test
void attributes_String_empty_option() {
    codeResolver.givenCode("template.jte", "@param String value\n<option value=\"${value}\">Click</option>");

    templateEngine.render("template.jte", "", output);

    assertThat(output.toString()).isEqualTo("<option value=\"\">Click</option>");
}

The actual output currently is:
<option>Click</option>

This is semantically different to the expected output:
<option value="">Click</option>

My proposed solution would be to remove String attributes only if the String is null. @kelunik I think you already suggested this already before.

@casid casid self-assigned this Aug 1, 2023
@kelunik
Copy link
Collaborator

kelunik commented Aug 1, 2023

Indeed, that's how I thought I'd work.

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

No branches or pull requests

2 participants