Skip to content

[AdvancedLayouts] Adds a width parameter to st.metric#11159

Merged
sfc-gh-lwilby merged 17 commits intodevelopfrom
feature/add-width-to-metric
Jun 5, 2025
Merged

[AdvancedLayouts] Adds a width parameter to st.metric#11159
sfc-gh-lwilby merged 17 commits intodevelopfrom
feature/add-width-to-metric

Conversation

@sfc-gh-lwilby
Copy link
Copy Markdown
Collaborator

@sfc-gh-lwilby sfc-gh-lwilby commented Apr 22, 2025

Describe your changes

This PR is part of the [AdvancedLayouts] project and introduces a new width parameter to metric elements.

GitHub Issue Link (if applicable)

#8197

Testing Plan

Unit Tests (JS and/or Python) ✅
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.

@snyk-io
Copy link
Copy Markdown
Contributor

snyk-io bot commented Apr 22, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 22, 2025

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-11159/streamlit-1.45.1-py3-none-any.whl
🕹️ Preview app pr-11159.streamlit.app (☁️ Deploy here if not accessible)

@sfc-gh-lwilby sfc-gh-lwilby added security-assessment-completed change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users labels Apr 22, 2025
Base automatically changed from feature/add-width-to-messages to develop April 23, 2025 19:52
@sfc-gh-lwilby sfc-gh-lwilby force-pushed the feature/add-width-to-metric branch from f408283 to 0c6eeff Compare May 31, 2025 08:35
@sfc-gh-lwilby sfc-gh-lwilby changed the title [WIP] [AdvancedLayouts] Feature/add width to metric [WIP] [AdvancedLayouts] Adds a width parameter to st.metric May 31, 2025
@sfc-gh-lwilby sfc-gh-lwilby marked this pull request as ready for review June 2, 2025 17:45
@sfc-gh-lwilby sfc-gh-lwilby changed the title [WIP] [AdvancedLayouts] Adds a width parameter to st.metric [AdvancedLayouts] Adds a width parameter to st.metric Jun 2, 2025
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Comment on lines +148 to +180
def test_stretch_width(themed_app: Page, assert_snapshot: ImageCompareFunction):
"""Test that stretch width works correctly."""
metric_element = themed_app.get_by_test_id("stMetric").nth(12)
expect(metric_element.get_by_test_id("stMetricLabel")).to_have_text("Stretch width")

assert_snapshot(
metric_element,
name="st_metric-stretch_width",
)


def test_pixel_width(themed_app: Page, assert_snapshot: ImageCompareFunction):
"""Test that pixel width works correctly."""
metric_element = themed_app.get_by_test_id("stMetric").nth(13)
expect(metric_element.get_by_test_id("stMetricLabel")).to_have_text(
"Pixel width (300px)"
)

assert_snapshot(
metric_element,
name="st_metric-pixel_width",
)


def test_content_width(themed_app: Page, assert_snapshot: ImageCompareFunction):
"""Test that content width works correctly."""
metric_element = themed_app.get_by_test_id("stMetric").nth(14)
expect(metric_element.get_by_test_id("stMetricLabel")).to_have_text("Content width")

assert_snapshot(
metric_element,
name="st_metric-content_width",
)
Copy link
Copy Markdown
Collaborator

@lukasmasuch lukasmasuch Jun 5, 2025

Choose a reason for hiding this comment

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

nit: same as in the other PRs, I think we can use app here to lower the number of snapshots and test runs.

Copy link
Copy Markdown
Collaborator

@lukasmasuch lukasmasuch left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@sfc-gh-lwilby sfc-gh-lwilby merged commit a9d11d7 into develop Jun 5, 2025
37 checks passed
@sfc-gh-lwilby sfc-gh-lwilby deleted the feature/add-width-to-metric branch June 5, 2025 14:30
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants