Skip to content

Commit cad0360

Browse files
Changes from peer review
1 parent 5b72e8e commit cad0360

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

apps/pie-storybook/stories/pie-radio.stories.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { type RadioProps as RadioBaseProps, defaultProps } from '@justeattakeawa
77

88
import { type SlottedComponentProps } from '../types';
99

10-
import { createStory } from '../utilities';
10+
import { createStory, sanitizeAndRenderHTML } from '../utilities';
1111

1212
type RadioProps = SlottedComponentProps<RadioBaseProps>;
1313
type RadioStoryMeta = Meta<RadioProps>;
@@ -96,7 +96,7 @@ const Template = ({
9696
?required="${required}"
9797
name="${ifDefined(name)}"
9898
.value="${value}">
99-
${slot}
99+
${sanitizeAndRenderHTML(slot)}
100100
</pie-radio>
101101
`;
102102

packages/components/pie-radio/test/component/pie-radio.spec.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import { test, expect } from '@sand4rt/experimental-ct-web';
32
import { PieRadio } from '../../src/index.ts';
43
import { type RadioProps } from '../../src/defs.ts';
@@ -167,9 +166,11 @@ test.describe('PieRadio - Component tests', () => {
167166
// Act
168167
await component.locator(inputSelector).click();
169168
const isValid = await page.evaluate(() => document.querySelector('pie-radio')?.validity.valid);
169+
const isValueMissing = await page.evaluate(() => document.querySelector('pie-radio')?.validity.valueMissing);
170170

171171
// Assert
172172
expect(isValid).toBe(true);
173+
expect(isValueMissing).toBe(false);
173174
});
174175

175176
test('should be in an invalid state if the radio is required but unchecked', async ({ mount, page }) => {
@@ -184,9 +185,11 @@ test.describe('PieRadio - Component tests', () => {
184185

185186
// Act
186187
const isValid = await page.evaluate(() => document.querySelector('pie-radio')?.validity.valid);
188+
const isValueMissing = await page.evaluate(() => document.querySelector('pie-radio')?.validity.valueMissing);
187189

188190
// Assert
189191
expect(isValid).toBe(false);
192+
expect(isValueMissing).toBe(true);
190193
});
191194

192195
test('should be in a valid state if the radio is checked but not required', async ({ mount, page }) => {
@@ -201,9 +204,11 @@ test.describe('PieRadio - Component tests', () => {
201204

202205
// Act
203206
const isValid = await page.evaluate(() => document.querySelector('pie-radio')?.validity.valid);
207+
const isValueMissing = await page.evaluate(() => document.querySelector('pie-radio')?.validity.valueMissing);
204208

205209
// Assert
206210
expect(isValid).toBe(true);
211+
expect(isValueMissing).toBe(false);
207212
});
208213

209214
test('should be in a valid state if the radio is unchecked and not required', async ({ mount, page }) => {
@@ -218,9 +223,11 @@ test.describe('PieRadio - Component tests', () => {
218223

219224
// Act
220225
const isValid = await page.evaluate(() => document.querySelector('pie-radio')?.validity.valid);
226+
const isValueMissing = await page.evaluate(() => document.querySelector('pie-radio')?.validity.valueMissing);
221227

222228
// Assert
223229
expect(isValid).toBe(true);
230+
expect(isValueMissing).toBe(false);
224231
});
225232
});
226233
});

0 commit comments

Comments
 (0)