Edit popup menu commands and literal DataGrid group keys
This commit is contained in:
@@ -76,6 +76,47 @@ class GridDockDocumentTest {
|
||||
assertThrows(IllegalArgumentException.class, () -> doc.set(col, "fixedPosition", "2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void pathLabelsRoundTripWithoutChangingNeighbouringMapEntries() throws Exception {
|
||||
String source =
|
||||
"""
|
||||
<?import de.neitzel.fx.view.*?>
|
||||
<DataGridColumn><groupLabels Post='Alt' another="%reference"/><!-- keep --></DataGridColumn>
|
||||
""";
|
||||
for (String key : java.util.List.of("/", "Post/Eingang West", "Ohne Endung", "$path & more")) {
|
||||
var doc = new GridDockDocument(source);
|
||||
String edited =
|
||||
doc.xml.source.apply(doc.groupLabel(doc.xml.elements.getFirst(), key, "%T & T", false));
|
||||
var changed = new GridDockDocument(edited);
|
||||
var col = changed.xml.elements.getFirst();
|
||||
assertEquals("%T & T", changed.groupLabels(col).get(key));
|
||||
assertTrue(edited.contains("<groupLabels Post='Alt' another=\"%reference\"/><!-- keep -->"));
|
||||
String removed = changed.xml.source.apply(changed.groupLabel(col, key, "", true));
|
||||
var restored = new GridDockDocument(removed);
|
||||
assertEquals(
|
||||
java.util.Map.of("Post", "Alt"), restored.groupLabels(restored.xml.elements.getFirst()));
|
||||
assertTrue(removed.contains("<groupLabels Post='Alt' another=\"%reference\"/><!-- keep -->"));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void deletingAPairPreservesSiblingsAndReferences() throws Exception {
|
||||
String source =
|
||||
"""
|
||||
<?import de.neitzel.fx.view.*?>
|
||||
<DataGridColumn><DataGridColumn.groupLabel><!-- keep -->
|
||||
<javafx.util.Pair key="/" value="Archiv"/><javafx.util.Pair key="Post/Eingang" value="%title"/>
|
||||
</DataGridColumn.groupLabel></DataGridColumn>
|
||||
""";
|
||||
var doc = new GridDockDocument(source);
|
||||
var col = doc.xml.elements.getFirst();
|
||||
assertEquals(
|
||||
source.replace("<javafx.util.Pair key=\"/\" value=\"Archiv\"/>", ""),
|
||||
doc.xml.source.apply(doc.groupLabel(col, "/", "", true)));
|
||||
assertThrows(
|
||||
IllegalArgumentException.class, () -> doc.groupLabel(col, "Post/Eingang", "", true));
|
||||
}
|
||||
|
||||
@Test
|
||||
void implicitRowAttributeAndGroupingSurviveRename() throws Exception {
|
||||
var source =
|
||||
|
||||
Reference in New Issue
Block a user