Skip to content
This repository was archived by the owner on Mar 4, 2024. It is now read-only.

Commit 2c3cf6f

Browse files
Refine types for StringChoiceWidget
1 parent 7f3b2ce commit 2c3cf6f

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres
66
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [6.0.2] 2023-05-10
9+
10+
### Changed
11+
12+
- remove `required` from `StringChoiceWidget`
13+
- non-optional 'default' for `StringChoiceWidget`
14+
815
## [6.0.1] 2023-05-09
916

1017
### Added

__tests__/factories.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ export const getStringChoiceWidgetConfiguration = () => {
143143
help: null,
144144
label: 'Format',
145145
name: 'format',
146-
required: true,
147146
type: 'StringChoiceWidget' as const
148147
}
149148
}

cypress/component/StringChoiceWidget.cy.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ describe('<StringChoiceWidget/>', () => {
6060
})
6161

6262
it('renders with missing default', () => {
63+
/**
64+
* Note: rendering without a default is not a requirement. The default is always enforced in Gecko JSON configuration level in Gecko.
65+
*/
6366
cy.mount(
6467
<StringChoiceWidget
6568
configuration={{
@@ -68,6 +71,7 @@ describe('<StringChoiceWidget/>', () => {
6871
help: null,
6972
required: true,
7073
type: 'StringChoiceWidget',
74+
// @ts-expect-error
7175
details: {
7276
values: ['summer', 'winter', 'year'],
7377
columns: 3,

src/widgets/StringChoiceWidget.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,14 @@ export interface StringChoiceWidgetDetails {
2929
[value: string]: string
3030
}
3131
values: string[]
32-
default?: string[]
32+
default: string[]
3333
}
3434

3535
export interface StringChoiceWidgetConfiguration {
3636
type: 'StringChoiceWidget'
3737
name: string
3838
label: string
3939
help?: string | null
40-
required: boolean
4140
details: StringChoiceWidgetDetails
4241
}
4342

0 commit comments

Comments
 (0)