Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lukasmasuch
Copy link
Collaborator

@lukasmasuch lukasmasuch commented Feb 21, 2025

Describe your changes

Add a new option to the dataframe column menu to auto-size a given column based on its content:

image

Testing Plan

  • Added e2e tests.

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@lukasmasuch lukasmasuch marked this pull request as draft February 21, 2025 09:30
@lukasmasuch lukasmasuch changed the title Add autosize option to column menu [Lukas] Add autosize option to column menu Feb 21, 2025
@lukasmasuch lukasmasuch added security-assessment-completed Security assessment has been completed for PR change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users labels Feb 21, 2025
@lukasmasuch lukasmasuch changed the title [Lukas] Add autosize option to column menu [WIP] Add autosize option to column menu Feb 21, 2025
@lukasmasuch lukasmasuch marked this pull request as ready for review February 21, 2025 13:09
@lukasmasuch lukasmasuch changed the title [WIP] Add autosize option to column menu Add autosize option to column menu Feb 21, 2025
@lukasmasuch lukasmasuch changed the title Add autosize option to column menu Add autosize option to dataframe column menu Feb 21, 2025
Copy link
Collaborator

@sfc-gh-lwilby sfc-gh-lwilby left a comment

Choose a reason for hiding this comment

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

LGTM

open_column_menu(df, 0, "small")
app.get_by_test_id("stDataFrameColumnMenu").get_by_text("Autosize").click()
unfocus_dataframe(app)
# Use the same screenshots as above since we expect the same
Copy link
Collaborator

Choose a reason for hiding this comment

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

Which screenshot as above? I did not find any screenshot with the same name

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, sorry... the comment is wrong here :(

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added a small improvement to the test to ensure that the new dataframe is smaller than the old one

})
})

describe("autosize functionality", () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

would it somehow be possible to test that autosizing actually works? Maybe by manually setting the width of a column to a certain value, then click on the Autosize button and then compare the widths? Could also be done in an e2e test

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It would be very hard to do that in RTL tests, but I added an e2e test already that shows that auto-sizing works. I can improve the e2e tests a bit more.

Copy link
Collaborator

@raethlein raethlein left a comment

Choose a reason for hiding this comment

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

LGTM! Just left two minor comments about tests

@lukasmasuch lukasmasuch enabled auto-merge (squash) February 21, 2025 14:57
@lukasmasuch lukasmasuch merged commit 7e591f7 into develop Feb 21, 2025
32 checks passed
@lukasmasuch lukasmasuch deleted the feature/add-autosize-to-column-menu branch February 21, 2025 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants