Skip to content

Commit

Permalink
feat: [ActiveDatesCard] update tests and move away from LegacyCard (#105
Browse files Browse the repository at this point in the history
)

* feat: move away from legacy card

* feat: update tests so they match new cards

* chore: add changeset

* fix: remove leftovers from rebase action
  • Loading branch information
wisniewski94 authored Aug 25, 2023
1 parent e20863b commit c870ef0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/spicy-kangaroos-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/discount-app-components': minor
---

Upgrade ActiveDates component to use Alpha Card
10 changes: 5 additions & 5 deletions src/components/ActiveDatesCard/ActiveDatesCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import {LegacyCard as Card, Checkbox, FormLayout} from '@shopify/polaris';
import {Text, Card, Checkbox, FormLayout} from '@shopify/polaris';
import {isSameDay} from '@shopify/dates';
import {useI18n} from '@shopify/react-i18n';

Expand Down Expand Up @@ -114,11 +114,11 @@ export function ActiveDatesCard({
);

return (
<Card
title={i18n.translate('DiscountAppComponents.ActiveDatesCard.title')}
sectioned
>
<Card>
<FormLayout>
<Text variant="headingMd" as="h2">
{i18n.translate('DiscountAppComponents.ActiveDatesCard.title')}
</Text>
<FormLayout.Group>
<DatePicker
date={{
Expand Down
7 changes: 3 additions & 4 deletions src/components/ActiveDatesCard/tests/ActiveDatesCard.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import {mockField, mountWithApp} from 'tests/utilities';
import {LegacyCard as Card, Checkbox, FormLayout} from '@shopify/polaris';
import {Checkbox, FormLayout, Text} from '@shopify/polaris';
import _ from 'lodash';
import MockDate from 'mockdate';

Expand All @@ -26,9 +26,8 @@ describe('<ActiveDatesCard />', () => {
it('renders a Card', () => {
const activeDates = mountWithApp(<ActiveDatesCard {...mockProps} />);

expect(activeDates).toContainReactComponent(Card, {
title: 'Active dates',
sectioned: true,
expect(activeDates).toContainReactComponent(Text, {
children: 'Active dates',
});
});

Expand Down

0 comments on commit c870ef0

Please sign in to comment.