Skip to content

Conversation

@Tobianas
Copy link
Contributor

Fix buttons in JsTree output

Buttons expand all and colapse all did nothing when
using multiple modules.

JIRA:LIGHTY-230

@Tobianas Tobianas changed the title 17.x fixv4 Fix buttons in JsTree output Aug 21, 2023
Previously, there was no test coverage for the output of multiple json-tree modules.
To address this, this commit adds a new test that parses two modules and compares their
combined output against the old expected output. This provides more comprehensive
testing and ensures that the json-tree modules are correctly processing multiple inputs.

JIRA:LIGHTY-229
Signed-off-by: tobias.pobocik <[email protected]>
Added test case for generating HTML file from multiple modules to
identify the issue with multiple <body> tags. The test asserts that
the file contains the expected modules, verifies that there is only
one <body> tag, and checks if the output matches the expected HTML file.

JIRA: LIGHTY-128
Signed-off-by: tobias.pobocik <[email protected]>
Ensure JsTree output contains a single body element, resolving the
issue of multiple bodies in the generated HTML file.

JIRA: LIGHTY-128
Signed-off-by: tobias.pobocik <[email protected]>
Since we have changed the logic of JsTree, the expected
output for deviations needs to be changed.

JIRA: LIGHTY-128
Signed-off-by: tobias.pobocik <[email protected]>
Expanders and collapsers were not funcional in the generated
html file when using multiple modules. This patch resolves
that issue

JIRA: LIGHTY-229
Signed-off-by: tobias.pobocik <[email protected]>
Since we have changed the logic of JsTree, the expected
output needs to be changed.

JIRA: LIGHTY-229
Signed-off-by: tobias.pobocik <[email protected]>
Buttons expand all and colapse all did nothing when
using multiple modules.

JIRA:LIGHTY-230
Signed-off-by: tobias.pobocik <[email protected]>
Since we have changed the logic of JsTree, the expected
output for deviations needs to be changed.

JIRA:LIGHTY-230
Signed-off-by: tobias.pobocik <[email protected]>
@@ -33,5 +34,5 @@ public interface Emitter {
/**
* Close after printing out the module.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing @param in javadoc.

@Override
public void close() {
this.usedFormat.close();
public void close(Collection<Module> modules) {
Copy link
Contributor

Choose a reason for hiding this comment

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

final

@@ -48,7 +49,7 @@ void init(final EffectiveModelContext context, final SchemaTree tree, final Conf
/**
* Close after printing out the module.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing @param in javadoc.

try {
text = Resources.toString(url, StandardCharsets.UTF_8);

final StringBuilder moduleCode = new StringBuilder();
Copy link
Contributor

Choose a reason for hiding this comment

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

this new code should not be in try-catch block.


// Define the multi-line string to add
final String multiLineStringToAdd =
" $('#basic-" + module.getName()
Copy link
Contributor

Choose a reason for hiding this comment

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

Use a text block here instead. It will improve the formatting of the resulting injected query.

}

// Encapsulate module code within $(document).ready(function () {...});
final String encapsulatedCode = "\n$(document).ready(function () {\n" + moduleCode + "});\n";
Copy link
Contributor

Choose a reason for hiding this comment

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

Creating this query should be moved to a separate method and called only if commentIndex != -1. If this condition is not met, the query will not be used.

format.emit(module);
}
format.close();
format.close((Collection<Module>) effectiveModelContext.getModules());
Copy link
Contributor

Choose a reason for hiding this comment

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

contextFactory.getModulesForTesting()

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.

2 participants