Skip to content

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

Merged
thetaPC merged 8 commits into
mainfrom
FW-3708
Mar 24, 2023
Merged

fix(item): use thumbnail's size when present#27014
thetaPC merged 8 commits into
mainfrom
FW-3708

Conversation

@thetaPC

@thetaPC thetaPC commented Mar 23, 2023

Copy link
Copy Markdown
Contributor

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

@bolt-new-by-stackblitz

Copy link
Copy Markdown

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

@liamdebeasi liamdebeasi left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread core/src/components/item/item.ios.scss Outdated
@thetaPC thetaPC assigned thetaPC and unassigned thetaPC Mar 24, 2023

@brandyscarney brandyscarney left a comment

Copy link
Copy Markdown
Member

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