From 5917632d44ba9809566ae60d17f6a4a53a2222f5 Mon Sep 17 00:00:00 2001 From: Ruben Carvalho Date: Mon, 16 Sep 2024 16:25:05 +0100 Subject: [PATCH] chore: remove thumbnail deprecated sizes --- packages/thumbnail/src/Thumbnail.ts | 26 +---------------------- packages/thumbnail/test/thumbnail.test.ts | 26 ----------------------- 2 files changed, 1 insertion(+), 51 deletions(-) diff --git a/packages/thumbnail/src/Thumbnail.ts b/packages/thumbnail/src/Thumbnail.ts index 3a8d5202b3..388e6a01a0 100644 --- a/packages/thumbnail/src/Thumbnail.ts +++ b/packages/thumbnail/src/Thumbnail.ts @@ -36,7 +36,7 @@ const validSizes = [ '900', '1000', ]; -export type ThumbnailSize = typeof validSizes[number]; +export type ThumbnailSize = (typeof validSizes)[number]; const defaultSize = validSizes[6]; @@ -66,30 +66,6 @@ export class Thumbnail extends SpectrumElement { } public set size(value: ThumbnailSize) { - const deprecatedSizes = ['xxs', 'xs', 's', 'm', 'l']; - type DeprecatedThumbnailSize = typeof deprecatedSizes[number]; - const managedSizes: Record = { - xxs: '100', - xs: '300', - s: '500', - m: '700', - l: '900', - }; - const usesDeprecatedSize = deprecatedSizes.includes(value); - if (usesDeprecatedSize) { - if (window.__swc.DEBUG) { - window.__swc.warn( - this, - `The "size" attribute/property for <${this.localName}> no longer supports the value "${value}". Use one of the following values, instead:`, - 'https://opensource.adobe.com/spectrum-web-components/components/thumbnail/#sizes', - { - level: 'deprecation', - issues: validSizes as unknown as string[], - } - ); - } - value = managedSizes[value]; - } const size = ( validSizes.includes(value) ? value : defaultSize ) as ThumbnailSize; diff --git a/packages/thumbnail/test/thumbnail.test.ts b/packages/thumbnail/test/thumbnail.test.ts index f32cf67973..a15ef3ff7d 100644 --- a/packages/thumbnail/test/thumbnail.test.ts +++ b/packages/thumbnail/test/thumbnail.test.ts @@ -90,31 +90,5 @@ describe('Thumbnail', () => { window.__swc.verbose = false; consoleWarnStub.restore(); }); - - it('warns in devMode when white/black variant is provided', async () => { - const el = await fixture(html` - - Woman crouching - - `); - - await elementUpdated(el); - expect(consoleWarnStub.called).to.be.true; - - const spyCall = consoleWarnStub.getCall(0); - expect( - (spyCall.args.at(0) as string).includes( - 'no longer supports the value' - ), - 'confirm deprecated size warning' - ).to.be.true; - expect(spyCall.args.at(-1), 'confirm `data` shape').to.deep.equal({ - data: { - localName: 'sp-thumbnail', - type: 'api', - level: 'deprecation', - }, - }); - }); }); });