Skip to content

Commit 024a2be

Browse files
fix(types): use ButtonVariant & ButtonPresetTheme, fix playwright types
Fix "yarn typecheck": ``` $ yarn typecheck yarn run v1.22.22 $ tsc --project ./tsconfig.json --noEmit src/domain/headless-cms/components/__tests__/CmsPage.test.tsx:113:11 - error TS2322: Type '"primary"' is not assignable to type 'ButtonVariant.Primary | ButtonVariant.Secondary | ButtonVariant.Success | ButtonVariant.Danger | ButtonVariant.Clear | undefined'. 113 loadMoreButtonVariant: 'primary', ~~~~~~~~~~~~~~~~~~~~~ src/domain/headless-cms/components/__tests__/CmsPage.test.tsx:114:11 - error TS2322: Type '"coat"' is not assignable to type 'ButtonPresetTheme | ButtonTheme | undefined'. 114 loadMoreButtonTheme: 'coat', ~~~~~~~~~~~~~~~~~~~ src/playwright/tests/search.spec.ts:55:41 - error TS2345: Argument of type '"Detaljerad sökning"' is not assignable to parameter of type 'SearchButton'. 55 await frontPageSv.clickSearchButton('Detaljerad sökning'); ~~~~~~~~~~~~~~~~~~~~ src/playwright/tests/search.spec.ts:71:41 - error TS2345: Argument of type '"Advanced search"' is not assignable to parameter of type 'SearchButton'. 71 await frontPageEn.clickSearchButton('Advanced search'); ~~~~~~~~~~~~~~~~~ ``` Refs: PT-453
1 parent 2f6ba6e commit 024a2be

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/domain/headless-cms/components/__tests__/CmsPage.test.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
ConfigProvider as RHHCConfigProvider,
44
defaultConfig as rhhcDefaultConfig,
55
} from '@city-of-helsinki/react-helsinki-headless-cms';
6+
import { ButtonPresetTheme, ButtonVariant } from 'hds-react';
67
import * as React from 'react';
78

89
import {
@@ -110,8 +111,8 @@ test('renders with sidebar layout when sidebar has content', async () => {
110111
openInExternalDomainAriaLabel: 'Avautuu uudella sivustolla.',
111112
},
112113
customCopy: {
113-
loadMoreButtonVariant: 'primary',
114-
loadMoreButtonTheme: 'coat',
114+
loadMoreButtonVariant: ButtonVariant.Primary,
115+
loadMoreButtonTheme: ButtonPresetTheme.Coat,
115116
},
116117
internalHrefOrigins,
117118
utils: {

src/playwright/pages/searchCapable.page.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ type ZeroToTwoYears = '0-2 vuotiaat' | '0-2 år' | '0-2 years';
77
type TargetGroupOption = ZeroToTwoYears;
88
type SearchOption = TargetGroupOption;
99
type SearchEvents = 'Hae tapahtumia' | 'Sök evenemang' | 'Search events';
10-
type AdvancedSearch = 'Tarkennettu haku' | 'Redigera sökning' | 'Edit search';
10+
type AdvancedSearch =
11+
| 'Tarkennettu haku'
12+
| 'Detaljerad sökning'
13+
| 'Advanced search';
1114
type SearchButton = SearchEvents | AdvancedSearch;
1215
type SearchTextBox = SearchEvents | TargetGroupButton;
1316
type TargetGroupField = TargetGroupButton;

0 commit comments

Comments
 (0)