Skip to content

Commit

Permalink
fix: update panes positions on Spreadsheet resize (#6964) (CP: 24.5) (#…
Browse files Browse the repository at this point in the history
…6969)

Co-authored-by: Diego Cardoso <diego@vaadin.com>
  • Loading branch information
vaadin-bot and DiegoCardoso authored Dec 18, 2024
1 parent fcd55f5 commit b72d372
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,7 @@ public void onWidgetResize() {
// vaadin does bunch of layout phases so this needs to be done in
// case the comment overlay position should be updated
refreshAlwaysVisibleCellCommentOverlays();
updateSheetPanePositions();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public SizingPage() {
e -> layout.setHeight(null))));

layoutList.add(new ListItem(new Span("Display: "),
getButton("none", "layoutDisplayNone",
e -> layout.getStyle().set("display", "none")),
getButton("flex", "layoutDisplayFlex",
e -> layout.getStyle().set("display", "flex")),
getButton("Default (block)", "layoutDisplayDefault",
Expand All @@ -89,7 +91,27 @@ public SizingPage() {

add(layoutList);

add(new H2("Logs"));

var logList = new UnorderedList();
var messageLog = new Span();
messageLog.setId("messageLog");
logList.add(new ListItem(new Span("Message: "), messageLog));

logList.add(new ListItem(new Span("Panel"),
getButton("Panel position", "logPanelPosition", e -> {
spreadsheet.getElement().executeJs(
"return this.shadowRoot.querySelector('.bottom-right-pane').style.top")
.then(message -> {
var stringMessage = message.asString();
messageLog.setText(stringMessage);
});
})));

add(logList);

add(layout);

}

private NativeButton getButton(String title, String id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,26 @@ public void toggleSpreadsheetAttached_noMissingRows() {
waitUntil(e -> spreadsheet.getCellAt("A20") != null);
}

@Test
public void containerInitiallyHidden_containerIsShown_panelsPositionsAreCorrect() {
// Detach spreadsheet
findElement(By.id("spreadsheetAttachedToggle")).click();
// Hide layout
findElement(By.id("layoutDisplayNone")).click();
// Attach spreadsheet
findElement(By.id("spreadsheetAttachedToggle")).click();
// Get reference to the new spreadsheet
var spreadsheet = $(SpreadsheetElement.class).first();
// Show layout
findElement(By.id("layoutDisplayDefault")).click();

// Print panel position
findElement(By.id("logPanelPosition")).click();

var messageLog = findElement(By.id("messageLog")).getText();
Assert.assertNotEquals("0px", messageLog);
}

private void assertSpreadsheetHeight(int height) {
var internal = spreadsheet.$(DivElement.class).first();
Assert.assertEquals(height, internal.getSize().getHeight());
Expand Down

0 comments on commit b72d372

Please sign in to comment.