From 2137006bda1c4ef4eeae1d59962ee98cc9213994 Mon Sep 17 00:00:00 2001 From: Brian Heston <47367562+bheston@users.noreply.github.com> Date: Thu, 3 Jun 2021 11:55:31 -0700 Subject: [PATCH] Updated old recipe and tests --- packages/web-components/src/color/neutral-fill-card.spec.ts | 6 +++--- packages/web-components/src/color/neutral-fill-card.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/web-components/src/color/neutral-fill-card.spec.ts b/packages/web-components/src/color/neutral-fill-card.spec.ts index d78e10eeca9689..e8d0852684ffbb 100644 --- a/packages/web-components/src/color/neutral-fill-card.spec.ts +++ b/packages/web-components/src/color/neutral-fill-card.spec.ts @@ -10,10 +10,10 @@ import { neutralFillCard as neutralFillCardNew } from "../color-vNext/recipes/ne describe('neutralFillCard', (): void => { it('should operate on design system defaults', (): void => { expect(neutralFillCard({} as DesignSystem)).to.equal( - DesignSystemDefaults.neutralPalette[DesignSystemDefaults.neutralFillCardDelta], + DesignSystemDefaults.neutralPalette[0], ); }); - it('should get darker when the index of the backgroundColor is lower than the offset index', (): void => { + it('should stay white when the index of the backgroundColor is lower than the offset index', (): void => { for (let i: number = 0; i < DesignSystemDefaults.neutralFillCardDelta; i++) { expect( DesignSystemDefaults.neutralPalette.indexOf( @@ -23,7 +23,7 @@ describe('neutralFillCard', (): void => { }), ), ), - ).to.equal(DesignSystemDefaults.neutralFillCardDelta + i); + ).to.equal(0); } }); it('should return the color at three steps lower than the background color', (): void => { diff --git a/packages/web-components/src/color/neutral-fill-card.ts b/packages/web-components/src/color/neutral-fill-card.ts index 54249992570014..c4454294a03a33 100644 --- a/packages/web-components/src/color/neutral-fill-card.ts +++ b/packages/web-components/src/color/neutral-fill-card.ts @@ -5,7 +5,7 @@ import { findClosestSwatchIndex, getSwatch } from './palette'; const neutralCardFillAlgorithm: SwatchResolver = (designSystem: DesignSystem): Swatch => { const offset: number = neutralFillCardDelta(designSystem); const index: number = findClosestSwatchIndex(neutralPalette, backgroundColor(designSystem))(designSystem); - return getSwatch(index - (index < offset ? offset * -1 : offset), neutralPalette(designSystem)); + return getSwatch(index - offset, neutralPalette(designSystem)); }; /**