Skip to content

Commit

Permalink
refactor(PPDSC-2606): update feature card component & copy (#515)
Browse files Browse the repository at this point in the history
* refactor(PPDSC-2606): update feature card component & copy

Bumps [loader-utils](https://github.com/webpack/loader-utils) from 1.4.0 to 1.4.2.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v1.4.2/CHANGELOG.md)
- [Commits](webpack/loader-utils@v1.4.0...v1.4.2)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: baburay23 <54642337+baburay23@users.noreply.github.com>

* chore(DEPS): bump qs from 6.5.2 to 6.5.3 (#508)

Bumps [qs](https://github.com/ljharb/qs) from 6.5.2 to 6.5.3.
- [Release notes](https://github.com/ljharb/qs/releases)
- [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md)
- [Commits](ljharb/qs@v6.5.2...v6.5.3)

---
updated-dependencies:
- dependency-name: qs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: baburay23 <54642337+baburay23@users.noreply.github.com>

* docs(PPDSC-2627): docs(PPDSC-2627) updated overrides in doc sites (#516)

updated overrides in doc site

* chore(DEPS): bump express from 4.17.1 to 4.18.2 (#513)

Bumps [express](https://github.com/expressjs/express) from 4.17.1 to 4.18.2.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](expressjs/express@4.17.1...4.18.2)

---
updated-dependencies:
- dependency-name: express
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: baburay23 <54642337+baburay23@users.noreply.github.com>

* docs(PPDSC-2557): update Byline component storybook scenarios (#511)

* refactor(PPDSC-2606): new release feature card

* refactor(PPDSC-2606): fix styling issues from design review

* refactor(PPDSC-2606): refactor featurecard props

* refactor(PPDSC-2606): remove interactivity; standardise border radius

* refactor(PPDSC-2606): fix merge conflict

* refactor(PPDSC-2606): remove leftovers

* refactor(PPDSC-2606): link*Persistent to site/theme/style-presets.ts

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: John Parsons <john.parsons@f2cxgrkwp0.home>
Co-authored-by: Evgeni Nikolov <evgeni.nikolov@news.co.uk>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: baburay23 <54642337+baburay23@users.noreply.github.com>
Co-authored-by: Rashika <113605781+RashikaNewsUK@users.noreply.github.com>
Co-authored-by: JohnTParsons <JohnTParsons>
Co-authored-by: Marco Vanali <Marco91Vanali@gmail.com>
  • Loading branch information
7 people authored Dec 20, 2022
1 parent 4e15f2c commit a414237
Show file tree
Hide file tree
Showing 22 changed files with 2,847 additions and 1,012 deletions.
1,996 changes: 1,465 additions & 531 deletions site/components/feature-card/__tests__/__snapshots__/feature-card.test.tsx.snap

Large diffs are not rendered by default.

51 changes: 44 additions & 7 deletions site/components/feature-card/__tests__/feature-card.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
import {screen} from '@testing-library/react';
import {renderToFragmentWithTheme} from 'newskit/test/test-utils';
import {FeatureCard} from '../feature-card';
import {FeatureCardProps} from '../types';

describe('FeatureCard', () => {
test('Renders interactive horizontal card with button', () => {
test('Renders interactive horizontal card without link or link text', async () => {
const props: FeatureCardProps = {
title: 'Interactive Horizontal Card',
description: 'I am interactive',
stylePrefix: 'patternsCard',
layout: 'horizontal',
href: 'href',
};
const fragment = renderToFragmentWithTheme(FeatureCard, props);

const arrowLinkLarge = await screen.queryAllByTestId('arrowLinkLarge');
expect(arrowLinkLarge.length).toBeFalsy();

expect(fragment).toMatchSnapshot();
});

test('Renders interactive horizontal card with text when no buttonHref', async () => {
const props: FeatureCardProps = {
title: 'Interactive Horizontal Card',
description: 'I am interactive',
Expand All @@ -13,29 +30,49 @@ describe('FeatureCard', () => {
href: 'href',
};
const fragment = renderToFragmentWithTheme(FeatureCard, props);

await screen.findByTestId('arrowLinkSmall');
const arrowLinkLarge = await screen.findByTestId('arrowLinkLarge');
const link = arrowLinkLarge.getElementsByTagName('a')[0];
expect(link).toBeUndefined();
expect(arrowLinkLarge.textContent).toEqual('Read more');

expect(fragment).toMatchSnapshot();
});

test('Renders horizontal card with clickable button only', () => {
test('Renders horizontal card with clickable button only', async () => {
const props: FeatureCardProps = {
title: 'Interactive Horizontal Card',
description: 'I am interactive',
stylePrefix: 'patternsCard',
layout: 'horizontal',
buttonLabel: 'Read more',
buttonHref: 'href',
buttonHref: 'buttonHref',
};
const fragment = renderToFragmentWithTheme(FeatureCard, props);

await screen.findByTestId('arrowLinkSmall');
const arrowLinkLarge = await screen.findByTestId('arrowLinkLarge');
const link = arrowLinkLarge.getElementsByTagName('a')[0];
expect(link.textContent).toEqual('Read more');
expect(link.href).toEqual('http://localhost/buttonHref');

expect(fragment).toMatchSnapshot();
});

test('Renders interactive horizontal card without button', () => {
test('Renders horizontal card with clickable button and style override', () => {
const props: FeatureCardProps = {
title: 'Interactive Horizontal Card',
description: 'I am interactive',
stylePrefix: 'patternsCard',
layout: 'horizontal',
href: 'href',
buttonLabel: 'Read more',
buttonHref: 'buttonHref',
overrides: {
button: {
stylePreset: 'linkStandalone',
},
},
};
const fragment = renderToFragmentWithTheme(FeatureCard, props);
expect(fragment).toMatchSnapshot();
Expand Down Expand Up @@ -72,7 +109,7 @@ describe('FeatureCard', () => {
expect(fragment).toMatchSnapshot();
});

test('Renders interactive vertical card with button', () => {
test('Renders interactive vertical card with link', () => {
const props: FeatureCardProps = {
title: 'Interactive Horizontal Card',
description: 'I am interactive',
Expand All @@ -85,7 +122,7 @@ describe('FeatureCard', () => {
expect(fragment).toMatchSnapshot();
});

test('Renders interactive vertical card without button', () => {
test('Renders interactive vertical card without link', () => {
const props: FeatureCardProps = {
title: 'Interactive Horizontal Card',
description: 'I am interactive',
Expand Down
Loading

0 comments on commit a414237

Please sign in to comment.