Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(item): use thumbnail's size when present #27014

Merged
merged 8 commits into from
Mar 24, 2023
Merged

fix(item): use thumbnail's size when present #27014

merged 8 commits into from
Mar 24, 2023

Conversation

thetaPC
Copy link
Contributor

@thetaPC thetaPC commented Mar 23, 2023

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
    • Some docs updates need to be made in the ionic-docs repo, in a separate PR. See the contributing guide for details.
  • Build (npm run build) was run locally and any changes were pushed
  • Lint (npm run lint) has passed locally and any fixes were made for failures

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

The --size from ion-thumbnail is being overwritten when component is placed inside ion-item by ion-item's slotted styling.

Screenshot 2023-03-23 at 11 37 44 AM

This contradicts the behavior described in the ion-thumbnail documentation.

Thumbnails can be used by themselves or inside of any element. If placed inside of an ion-item, the thumbnail will resize to fit the parent component.

Issue URL: resolves #22935

What is the new behavior?

  • ion-item will set a default value for ion-thumbnail's --size when present

Passes a default size to thumbnail when slotted.

Does this introduce a breaking change?

  • Yes
  • No

Other information

N/A

@stackblitz
Copy link

stackblitz bot commented Mar 23, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions github-actions bot added the package: core @ionic/core package label Mar 23, 2023
@thetaPC thetaPC marked this pull request as ready for review March 23, 2023 23:16
@thetaPC thetaPC requested a review from a team as a code owner March 23, 2023 23:16
Copy link
Contributor

@liamdebeasi liamdebeasi left a comment

Choose a reason for hiding this comment

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

The changes look great! Could we add a test so this does not regress?

Maybe something like this:

test('size should be customizable in item', async ({ page, skip }) => {
  skip.rtl();

  await page.setContent(`
    <ion-item>
      <ion-thumbnail style="--size: 20px">
        <img src="/src/components/thumbnail/test/thumbnail.svg" />
      </ion-thumbnail>
    </ion-item>
  `);
  const item = page.locator('ion-item');
  await expect(item).toHaveScreenshot(`item-thumbnail-size-${page.getSnapshotSettings()}.png`);
});

We will want to test iOS and MD mode since we are updating the code for both modes. However, we can skip the LTR vs RTL tests. The focus of this test should be ensuring that developers can use the --size API on ion-thumbnail to customize its size even when used inside of ion-item.

edit:

You can also add this inside of the test body:

test.info().annotations.push({
  type: 'issue',
  description: 'https://github.com/ionic-team/ionic-framework/issues/22935',
});

This adds a Custom Playwright Annotation to indicate that this test was added to verify a particular bug fix.

@thetaPC thetaPC assigned thetaPC and unassigned thetaPC Mar 24, 2023
Copy link
Member

@brandyscarney brandyscarney left a comment

Choose a reason for hiding this comment

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

Looks great!

@thetaPC thetaPC merged commit 6cecdf4 into main Mar 24, 2023
@thetaPC thetaPC deleted the FW-3708 branch March 24, 2023 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: thumbnail not being properly sized when slotted inside item
4 participants