mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-07-02 21:18:05 +02:00
Fix search highlighting conflict with jsx code (#1886)
Replaces "<>", "</>" highlighting marks with "<|[[--" and "--]]|>" to avoid conflicts when highlighting jsx code.
This commit is contained in:
@@ -52,7 +52,7 @@ class LuceneHighlighterTest {
|
||||
String[] snippets = highlighter.highlight("content", Indexed.Analyzer.DEFAULT, content);
|
||||
|
||||
assertThat(snippets).hasSize(1).allSatisfy(
|
||||
snippet -> assertThat(snippet).contains("<>Golgafrinchan</>")
|
||||
snippet -> assertThat(snippet).contains("<|[[--Golgafrinchan--]]|>")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class LuceneHighlighterTest {
|
||||
snippet -> assertThat(snippet.split("\n")).contains(
|
||||
"\t\t\t\tint neighbors= getNeighbors(above, same, below);",
|
||||
"\t\t\t\tif(neighbors < 2 || neighbors > 3){",
|
||||
"\t\t\t\t\tnewGen[row]+= \"_\";//<2 or >3 neighbors -> <>die</>",
|
||||
"\t\t\t\t\tnewGen[row]+= \"_\";//<2 or >3 neighbors -> <|[[--die--]]|>",
|
||||
"\t\t\t\t}else if(neighbors == 3){",
|
||||
"\t\t\t\t\tnewGen[row]+= \"#\";//3 neighbors -> spawn/live"
|
||||
)
|
||||
@@ -79,7 +79,7 @@ class LuceneHighlighterTest {
|
||||
snippet -> assertThat(snippet.split("\n")).contains(
|
||||
"}) => {",
|
||||
" const renderIcon = () => {",
|
||||
" return <>{icon ? <Icon name={icon} color=\"<>inherit</>\" className=\"is-medium pr-1\" /> : null}</>;",
|
||||
" return <>{icon ? <Icon name={icon} color=\"<|[[--inherit--]]|>\" className=\"is-medium pr-1\" /> : null}</>;",
|
||||
" };"
|
||||
)
|
||||
);
|
||||
|
||||
@@ -499,7 +499,7 @@ class LuceneQueryBuilderTest {
|
||||
|
||||
JsonNode displayName = fields.get("displayName");
|
||||
assertThat(displayName.get("highlighted").asBoolean()).isTrue();
|
||||
assertThat(displayName.get("fragments").get(0).asText()).contains("<>Arthur</>");
|
||||
assertThat(displayName.get("fragments").get(0).asText()).contains("<|[[--Arthur--]]|>");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user