@pie-lib/mask-markup 2.0.0-beta.1 → 2.0.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/CHANGELOG.json +1 -871
  2. package/CHANGELOG.md +434 -32
  3. package/LICENSE.md +5 -0
  4. package/NEXT.CHANGELOG.json +1 -0
  5. package/lib/choices/choice.js +101 -129
  6. package/lib/choices/choice.js.map +1 -1
  7. package/lib/choices/index.js +28 -48
  8. package/lib/choices/index.js.map +1 -1
  9. package/lib/componentize.js +2 -6
  10. package/lib/componentize.js.map +1 -1
  11. package/lib/components/blank.js +315 -246
  12. package/lib/components/blank.js.map +1 -1
  13. package/lib/components/correct-input.js +47 -66
  14. package/lib/components/correct-input.js.map +1 -1
  15. package/lib/components/dropdown.js +399 -156
  16. package/lib/components/dropdown.js.map +1 -1
  17. package/lib/components/input.js +15 -19
  18. package/lib/components/input.js.map +1 -1
  19. package/lib/constructed-response.js +81 -28
  20. package/lib/constructed-response.js.map +1 -1
  21. package/lib/customizable.js +44 -0
  22. package/lib/customizable.js.map +1 -0
  23. package/lib/drag-in-the-blank.js +160 -96
  24. package/lib/drag-in-the-blank.js.map +1 -1
  25. package/lib/index.js +8 -7
  26. package/lib/index.js.map +1 -1
  27. package/lib/inline-dropdown.js +10 -14
  28. package/lib/inline-dropdown.js.map +1 -1
  29. package/lib/mask.js +93 -101
  30. package/lib/mask.js.map +1 -1
  31. package/lib/serialization.js +36 -81
  32. package/lib/serialization.js.map +1 -1
  33. package/lib/with-mask.js +53 -49
  34. package/lib/with-mask.js.map +1 -1
  35. package/package.json +26 -15
  36. package/src/__tests__/drag-in-the-blank.test.js +111 -0
  37. package/src/__tests__/index.test.js +39 -0
  38. package/src/__tests__/mask.test.js +187 -0
  39. package/src/__tests__/serialization.test.js +54 -0
  40. package/src/__tests__/utils.js +1 -0
  41. package/src/__tests__/with-mask.test.js +76 -0
  42. package/src/choices/__tests__/index.test.js +75 -0
  43. package/src/choices/choice.jsx +84 -83
  44. package/src/choices/index.jsx +25 -15
  45. package/src/components/__tests__/blank.test.js +138 -0
  46. package/src/components/__tests__/correct-input.test.js +90 -0
  47. package/src/components/__tests__/dropdown.test.js +93 -0
  48. package/src/components/__tests__/input.test.js +102 -0
  49. package/src/components/blank.jsx +319 -195
  50. package/src/components/correct-input.jsx +45 -46
  51. package/src/components/dropdown.jsx +374 -139
  52. package/src/components/input.jsx +6 -3
  53. package/src/constructed-response.jsx +81 -18
  54. package/src/customizable.jsx +35 -0
  55. package/src/drag-in-the-blank.jsx +159 -47
  56. package/src/index.js +3 -1
  57. package/src/inline-dropdown.jsx +6 -3
  58. package/src/mask.jsx +75 -30
  59. package/src/serialization.js +37 -44
  60. package/src/with-mask.jsx +36 -3
  61. package/README.md +0 -14
  62. package/lib/new-serialization.js +0 -320
  63. package/lib/parse-html.js +0 -16
  64. package/lib/test-serializer.js +0 -215
  65. package/src/new-serialization.jsx +0 -291
  66. package/src/parse-html.js +0 -8
  67. package/src/test-serializer.js +0 -163
@@ -0,0 +1,54 @@
1
+ import { deserialize } from '../serialization';
2
+
3
+ describe('serialization', () => {
4
+ it('ignores comments', () => {
5
+ const out = deserialize(`<!-- hi -->`);
6
+ expect(out.document.nodes[0]).toEqual(expect.objectContaining({ type: 'span' }));
7
+ });
8
+
9
+ it('ignores comments', () => {
10
+ const out = deserialize(`<!-- hi --><div>foo</div>`);
11
+ expect(out.document.nodes[0]).toEqual(
12
+ expect.objectContaining({
13
+ type: 'div',
14
+ nodes: [
15
+ expect.objectContaining({
16
+ object: 'text',
17
+ leaves: [{ text: 'foo' }],
18
+ }),
19
+ ],
20
+ }),
21
+ );
22
+ });
23
+
24
+ it('deserializes an em', () => {
25
+ const out = deserialize(`<!-- hi --><div> <em>x</em> </div>`);
26
+ expect(out.document.nodes[0]).toEqual(
27
+ expect.objectContaining({
28
+ type: 'div',
29
+ nodes: [
30
+ expect.objectContaining({
31
+ object: 'text',
32
+ }),
33
+ expect.objectContaining({
34
+ leaves: [
35
+ {
36
+ marks: [
37
+ {
38
+ data: undefined,
39
+ type: 'italic',
40
+ },
41
+ ],
42
+ text: 'x',
43
+ },
44
+ ],
45
+ object: 'text',
46
+ }),
47
+ expect.objectContaining({
48
+ object: 'text',
49
+ }),
50
+ ],
51
+ }),
52
+ );
53
+ });
54
+ });
@@ -0,0 +1 @@
1
+ export const choice = (v, id) => ({ label: v, value: v, id });
@@ -0,0 +1,76 @@
1
+ import * as React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
+ import userEvent from '@testing-library/user-event';
4
+ import { withMask } from '../with-mask';
5
+
6
+ describe('WithMask', () => {
7
+ const onChange = jest.fn();
8
+ const defaultProps = {
9
+ markup: '<p>Foo bar {{0}} over the moon;</p>',
10
+ value: {
11
+ 0: 'blank',
12
+ },
13
+ onChange,
14
+ };
15
+
16
+ const Masked = withMask('foo', (props) => (node) => {
17
+ const dataset = node.data ? node.data.dataset || {} : {};
18
+
19
+ if (dataset.component === 'foo') {
20
+ return <input type="text" data-testid="masked-input" defaultValue="Foo" onChange={props.onChange} />;
21
+ }
22
+ });
23
+
24
+ beforeEach(() => {
25
+ onChange.mockClear();
26
+ });
27
+
28
+ describe('rendering', () => {
29
+ it('renders with default props', () => {
30
+ const { container } = render(<Masked {...defaultProps} />);
31
+ expect(container.firstChild).toBeInTheDocument();
32
+ });
33
+
34
+ it('renders markup content', () => {
35
+ render(<Masked {...defaultProps} />);
36
+ expect(screen.getByText(/Foo bar/)).toBeInTheDocument();
37
+ });
38
+
39
+ it('renders paragraph content', () => {
40
+ const { container } = render(<Masked {...defaultProps} />);
41
+ // Paragraph is rendered as a styled div, not a <p> tag
42
+ expect(container.firstChild).toBeInTheDocument();
43
+ expect(screen.getByText(/Foo bar/)).toBeInTheDocument();
44
+ });
45
+ });
46
+
47
+ describe('onChange handler', () => {
48
+ it('calls onChange when value changes', async () => {
49
+ const user = userEvent.setup();
50
+ render(<Masked {...defaultProps} />);
51
+
52
+ const input = screen.queryByTestId('masked-input');
53
+ if (input) {
54
+ await user.clear(input);
55
+ await user.type(input, 'ceva');
56
+
57
+ expect(onChange).toHaveBeenCalled();
58
+ }
59
+ });
60
+
61
+ it('passes event to onChange', async () => {
62
+ const user = userEvent.setup();
63
+ render(<Masked {...defaultProps} />);
64
+
65
+ const input = screen.queryByTestId('masked-input');
66
+ if (input) {
67
+ await user.clear(input);
68
+ await user.type(input, 'test');
69
+
70
+ expect(onChange).toHaveBeenCalled();
71
+ const lastCall = onChange.mock.calls[onChange.mock.calls.length - 1][0];
72
+ expect(lastCall).toHaveProperty('target');
73
+ }
74
+ });
75
+ });
76
+ });
@@ -0,0 +1,75 @@
1
+ import * as React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
+ import Choice from '../choice';
4
+ import { choice } from '../../__tests__/utils';
5
+ import Choices from '../index';
6
+
7
+ // Mock @dnd-kit hooks to avoid DndContext requirement
8
+ jest.mock('@dnd-kit/core', () => ({
9
+ useDraggable: jest.fn(() => ({
10
+ attributes: {},
11
+ listeners: {},
12
+ setNodeRef: jest.fn(),
13
+ isDragging: false,
14
+ })),
15
+ useDroppable: jest.fn(() => ({
16
+ setNodeRef: jest.fn(),
17
+ isOver: false,
18
+ active: null,
19
+ })),
20
+ }));
21
+
22
+ describe('index', () => {
23
+ describe('Choices', () => {
24
+ const defaultProps = {
25
+ disabled: false,
26
+ choices: [choice('Jumped', '0'), choice('Laughed', '1'), choice('Spoon', '2')],
27
+ choicePosition: 'below',
28
+ instanceId: 'test-instance',
29
+ };
30
+
31
+ it('renders correctly with default props', () => {
32
+ const { container } = render(<Choices {...defaultProps} />);
33
+ expect(container.firstChild).toBeInTheDocument();
34
+ expect(screen.getByText('Jumped')).toBeInTheDocument();
35
+ expect(screen.getByText('Laughed')).toBeInTheDocument();
36
+ expect(screen.getByText('Spoon')).toBeInTheDocument();
37
+ });
38
+
39
+ it('renders correctly with disabled prop as true', () => {
40
+ const { container } = render(<Choices {...defaultProps} disabled={true} />);
41
+ expect(container.firstChild).toBeInTheDocument();
42
+ });
43
+
44
+ it('renders without duplicates', () => {
45
+ const { container } = render(<Choices {...defaultProps} duplicates={undefined} value={{ 0: '0', 1: '1' }} />);
46
+ expect(container.firstChild).toBeInTheDocument();
47
+ });
48
+
49
+ it('renders with duplicates', () => {
50
+ const { container } = render(<Choices {...defaultProps} duplicates={true} value={{ 0: '0', 1: '1' }} />);
51
+ expect(container.firstChild).toBeInTheDocument();
52
+ });
53
+ });
54
+
55
+ describe('Choice', () => {
56
+ const defaultProps = {
57
+ disabled: false,
58
+ choice: choice('Label', '1'),
59
+ instanceId: 'test-instance',
60
+ };
61
+
62
+ describe('render', () => {
63
+ it('renders correctly with default props', () => {
64
+ const { container } = render(<Choice {...defaultProps} />);
65
+ expect(container.firstChild).toBeInTheDocument();
66
+ expect(screen.getByText('Label')).toBeInTheDocument();
67
+ });
68
+
69
+ it('renders correctly with disabled prop as true', () => {
70
+ const { container } = render(<Choice {...defaultProps} disabled={true} />);
71
+ expect(container.firstChild).toBeInTheDocument();
72
+ });
73
+ });
74
+ });
75
+ });
@@ -1,96 +1,97 @@
1
- import React from 'react';
1
+ import React, { useEffect, useRef } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { DragSource } from '@pie-lib/drag';
4
- import { withStyles } from '@material-ui/core/styles';
5
- import Chip from '@material-ui/core/Chip';
6
- import classnames from 'classnames';
7
- import ReactDOM from 'react-dom';
3
+ import { useDraggable } from '@dnd-kit/core';
4
+ import { styled } from '@mui/material/styles';
5
+ import Chip from '@mui/material/Chip';
8
6
  import { renderMath } from '@pie-lib/math-rendering';
7
+ import { color } from '@pie-lib/render-ui';
9
8
 
10
9
  export const DRAG_TYPE = 'MaskBlank';
11
10
 
12
- class BlankContentComp extends React.Component {
13
- static propTypes = {
14
- disabled: PropTypes.bool,
15
- choice: PropTypes.object,
16
- classes: PropTypes.object,
17
- connectDragSource: PropTypes.func
18
- };
11
+ const StyledChoice = styled('span')(({ theme, disabled }) => ({
12
+ border: `solid 0px ${theme.palette.primary.main}`,
13
+ borderRadius: theme.spacing(2),
14
+ margin: theme.spacing(0.5),
15
+ transform: 'translate(0, 0)',
16
+ display: 'inline-flex',
17
+ ...(disabled && {}),
18
+ }));
19
19
 
20
- componentDidUpdate() {
21
- renderMath(this.rootRef);
22
- }
20
+ const StyledChip = styled(Chip)(() => ({
21
+ backgroundColor: color.white(),
22
+ border: `1px solid ${color.text()}`,
23
+ color: color.text(),
24
+ alignItems: 'center',
25
+ display: 'inline-flex',
26
+ height: 'initial',
27
+ minHeight: '32px',
28
+ fontSize: 'inherit',
29
+ whiteSpace: 'pre-wrap',
30
+ maxWidth: '374px',
31
+ // Added for touch devices, for image content.
32
+ // This will prevent the context menu from appearing and not allowing other interactions with the image.
33
+ // If interactions with the image in the token will be requested we should handle only the context Menu.
34
+ pointerEvents: 'none',
35
+ borderRadius: '3px',
36
+ paddingTop: '12px',
37
+ paddingBottom: '12px',
23
38
 
24
- render() {
25
- const { connectDragSource, choice, classes, disabled } = this.props;
26
-
27
- return connectDragSource(
28
- <span className={classnames(classes.choice, disabled && classes.disabled)}>
29
- <Chip
30
- ref={ref => {
31
- //eslint-disable-next-line
32
- this.rootRef = ReactDOM.findDOMNode(ref);
33
- }}
34
- className={classes.chip}
35
- label={
36
- <span
37
- className={classes.chipLabel}
38
- ref={ref => {
39
- if (ref) {
40
- ref.innerHTML = choice.value || ' ';
41
- }
42
- }}
43
- >
44
- {' '}
45
- </span>
46
- }
47
- variant={disabled ? 'outlined' : undefined}
48
- />
49
- </span>,
50
- {}
51
- );
52
- }
53
- }
54
-
55
- export const BlankContent = withStyles(theme => ({
56
- choice: {
57
- border: `solid 0px ${theme.palette.primary.main}`
39
+ '&.Mui-disabled': {
40
+ opacity: 1,
58
41
  },
59
- chip: {
60
- alignItems: 'center',
61
- display: 'inline-flex',
62
- height: 'initial',
63
- minHeight: '32px',
64
- fontSize: 'inherit',
65
- whiteSpace: 'pre-wrap',
66
- maxWidth: '374px',
67
- margin: '4px'
42
+ }));
43
+
44
+ const StyledChipLabel = styled('span')(() => ({
45
+ whiteSpace: 'normal',
46
+ '& img': {
47
+ display: 'block',
48
+ padding: '2px 0',
68
49
  },
69
- chipLabel: {
70
- whiteSpace: 'pre-wrap',
71
- '& img': {
72
- display: 'block',
73
- padding: '2px 0'
74
- }
50
+ '& mjx-frac': {
51
+ fontSize: '120% !important',
75
52
  },
76
- disabled: {}
77
- }))(BlankContentComp);
53
+ }));
78
54
 
79
- const tileSource = {
80
- canDrag(props) {
81
- return !props.disabled;
82
- },
83
- beginDrag(props) {
84
- return {
85
- choice: props.choice,
86
- instanceId: props.instanceId
87
- };
88
- }
89
- };
55
+ export default function Choice({ choice, disabled, instanceId }) {
56
+ const rootRef = useRef(null);
57
+
58
+ const { attributes, listeners, setNodeRef, isDragging } = useDraggable({
59
+ id: `choice-${choice.id}`,
60
+ data: { choice, instanceId, fromChoice: true, type: DRAG_TYPE },
61
+ disabled,
62
+ });
90
63
 
91
- const DragDropTile = DragSource(DRAG_TYPE, tileSource, (connect, monitor) => ({
92
- connectDragSource: connect.dragSource(),
93
- isDragging: monitor.isDragging()
94
- }))(BlankContent);
64
+ useEffect(() => {
65
+ renderMath(rootRef.current);
66
+ }, [choice.value]);
95
67
 
96
- export default DragDropTile;
68
+ return (
69
+ <StyledChoice
70
+ ref={setNodeRef}
71
+ style={
72
+ isDragging
73
+ ? {
74
+ width: rootRef.current?.offsetWidth,
75
+ height: rootRef.current?.offsetHeight,
76
+ }
77
+ : {}
78
+ }
79
+ disabled={disabled}
80
+ {...listeners}
81
+ {...attributes}
82
+ >
83
+ <StyledChip
84
+ clickable={false}
85
+ disabled={disabled}
86
+ ref={rootRef}
87
+ label={<StyledChipLabel dangerouslySetInnerHTML={{ __html: choice.value }} />}
88
+ />
89
+ </StyledChoice>
90
+ );
91
+ }
92
+
93
+ Choice.propTypes = {
94
+ choice: PropTypes.object.isRequired,
95
+ disabled: PropTypes.bool,
96
+ instanceId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
97
+ };
@@ -2,16 +2,16 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import findKey from 'lodash/findKey';
4
4
  import Choice from './choice';
5
+ import { DragDroppablePlaceholder } from '@pie-lib/drag';
5
6
 
6
7
  export default class Choices extends React.Component {
7
8
  static propTypes = {
8
9
  disabled: PropTypes.bool,
9
10
  duplicates: PropTypes.bool,
10
- choices: PropTypes.arrayOf(
11
- PropTypes.shape({ label: PropTypes.string, value: PropTypes.string })
12
- ),
11
+ choices: PropTypes.arrayOf(PropTypes.shape({ label: PropTypes.string, value: PropTypes.string })),
13
12
  value: PropTypes.object,
14
- choicePosition: PropTypes.string.isRequired
13
+ choicePosition: PropTypes.string.isRequired,
14
+ instanceId: PropTypes.string, // Added for drag isolation
15
15
  };
16
16
 
17
17
  getStyleForWrapper = () => {
@@ -20,39 +20,49 @@ export default class Choices extends React.Component {
20
20
  switch (choicePosition) {
21
21
  case 'above':
22
22
  return {
23
- margin: '0 0 40px 0'
23
+ margin: '0 0 40px 0',
24
24
  };
25
+
25
26
  case 'below':
26
27
  return {
27
- margin: '40px 0 0 0'
28
+ margin: '40px 0 0 0',
28
29
  };
30
+
29
31
  case 'right':
30
32
  return {
31
- margin: '0 0 0 40px'
33
+ margin: '0 0 0 40px',
32
34
  };
35
+
33
36
  default:
34
37
  return {
35
- margin: '0 40px 0 0'
38
+ margin: '0 40px 0 0',
36
39
  };
37
40
  }
38
41
  };
39
42
 
40
43
  render() {
41
- const { disabled, duplicates, choices, value } = this.props;
42
- const filteredChoices = choices.filter(c => {
44
+ const { disabled, duplicates, choices, value, instanceId } = this.props;
45
+ const filteredChoices = choices.filter((c) => {
43
46
  if (duplicates === true) {
44
47
  return true;
45
48
  }
46
- const foundChoice = findKey(value, v => v === c.id);
49
+ const foundChoice = findKey(value, (v) => v === c.id);
47
50
  return foundChoice === undefined;
48
51
  });
49
- const elementStyle = this.getStyleForWrapper();
52
+ const elementStyle = { ...this.getStyleForWrapper(), minWidth: '100px' };
50
53
 
51
54
  return (
52
55
  <div style={elementStyle}>
53
- {filteredChoices.map((c, index) => (
54
- <Choice key={`${c.value}-${index}`} disabled={disabled} choice={c} />
55
- ))}
56
+ <DragDroppablePlaceholder disabled={disabled} instanceId={instanceId}>
57
+ {filteredChoices.map((c, index) => (
58
+ <Choice
59
+ key={`${c.value}-${index}`}
60
+ disabled={disabled}
61
+ choice={c}
62
+ instanceId={instanceId}
63
+ />
64
+ ))}
65
+ </DragDroppablePlaceholder>
56
66
  </div>
57
67
  );
58
68
  }
@@ -0,0 +1,138 @@
1
+ import * as React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
+ import userEvent from '@testing-library/user-event';
4
+ import Blank from '../blank';
5
+
6
+ // Mock @dnd-kit hooks to avoid DndContext requirement
7
+ jest.mock('@dnd-kit/core', () => ({
8
+ useDraggable: jest.fn(() => ({
9
+ attributes: {},
10
+ listeners: {},
11
+ setNodeRef: jest.fn(),
12
+ transform: null,
13
+ isDragging: false,
14
+ })),
15
+ useDroppable: jest.fn(() => ({
16
+ setNodeRef: jest.fn(),
17
+ isOver: false,
18
+ active: null,
19
+ })),
20
+ }));
21
+
22
+ jest.mock('@dnd-kit/utilities', () => ({
23
+ CSS: {
24
+ Translate: {
25
+ toString: jest.fn(() => 'translate3d(0, 0, 0)'),
26
+ },
27
+ },
28
+ }));
29
+
30
+ describe('Blank', () => {
31
+ const onChange = jest.fn();
32
+ const defaultProps = {
33
+ disabled: false,
34
+ choice: { value: 'Cow' },
35
+ isOver: false,
36
+ dragItem: {},
37
+ correct: false,
38
+ onChange,
39
+ };
40
+
41
+ beforeEach(() => {
42
+ onChange.mockClear();
43
+ });
44
+
45
+ describe('rendering', () => {
46
+ it('renders with default props', () => {
47
+ const { container } = render(<Blank {...defaultProps} />);
48
+ expect(container.firstChild).toBeInTheDocument();
49
+ });
50
+
51
+ it('displays the value when provided', () => {
52
+ render(<Blank {...defaultProps} />);
53
+ expect(screen.getByText('Cow')).toBeInTheDocument();
54
+ });
55
+
56
+ it('renders as disabled when disabled prop is true', () => {
57
+ render(<Blank {...defaultProps} disabled={true} />);
58
+ // Check that delete button is not present when disabled
59
+ expect(screen.queryByRole('button', { name: /delete/i })).not.toBeInTheDocument();
60
+ });
61
+
62
+ it('renders with dragged item preview', () => {
63
+ render(<Blank {...defaultProps} dragItem={{ choice: { value: 'Dog' } }} />);
64
+ // Blank component should render
65
+ expect(screen.getByText('Cow')).toBeInTheDocument();
66
+ });
67
+
68
+ it('shows hover state when isOver is true', () => {
69
+ const { container } = render(<Blank {...defaultProps} dragItem={{ choice: { value: 'Dog' } }} isOver={true} />);
70
+ // Component should have hover styling
71
+ expect(container.firstChild).toBeInTheDocument();
72
+ });
73
+
74
+ it('shows correct state when correct is true', () => {
75
+ const { container } = render(<Blank {...defaultProps} correct={true} />);
76
+ // Component should indicate correctness
77
+ expect(container.firstChild).toBeInTheDocument();
78
+ });
79
+ });
80
+
81
+ describe('delete functionality', () => {
82
+ it('does not show delete button when disabled', () => {
83
+ render(<Blank {...defaultProps} disabled={true} />);
84
+ expect(screen.queryByRole('button', { name: /delete/i })).not.toBeInTheDocument();
85
+ });
86
+
87
+ it('does not show delete button when no value is set', () => {
88
+ render(<Blank {...defaultProps} choice={undefined} />);
89
+ expect(screen.queryByRole('button', { name: /delete/i })).not.toBeInTheDocument();
90
+ });
91
+
92
+ it('shows delete button when value is present and not disabled', () => {
93
+ render(<Blank {...defaultProps} />);
94
+ // If delete button is present, it should be clickable
95
+ const deleteButton = screen.queryByRole('button');
96
+ if (deleteButton) {
97
+ expect(deleteButton).toBeInTheDocument();
98
+ }
99
+ });
100
+ });
101
+
102
+ describe('dimensions', () => {
103
+ it('renders with custom dimensions when provided', () => {
104
+ const { container } = render(
105
+ <Blank {...defaultProps} emptyResponseAreaHeight={100} emptyResponseAreaWidth={200} />,
106
+ );
107
+ const element = container.firstChild;
108
+ expect(element).toBeInTheDocument();
109
+ });
110
+
111
+ it('renders with min dimensions by default', () => {
112
+ const { container } = render(<Blank {...defaultProps} />);
113
+ const element = container.firstChild;
114
+ expect(element).toBeInTheDocument();
115
+ // Component should have minimum dimensions applied
116
+ });
117
+
118
+ it('handles non-numeric dimension props gracefully', () => {
119
+ const { container } = render(
120
+ <Blank {...defaultProps} emptyResponseAreaHeight="non-numeric" emptyResponseAreaWidth="non-numeric" />,
121
+ );
122
+ expect(container.firstChild).toBeInTheDocument();
123
+ });
124
+ });
125
+
126
+ describe('drag and drop', () => {
127
+ it('accepts drag item when not disabled', () => {
128
+ render(<Blank {...defaultProps} isOver={true} dragItem={{ choice: { value: 'Dog' } }} />);
129
+ expect(screen.getByText('Cow')).toBeInTheDocument();
130
+ });
131
+
132
+ it('shows drag preview when dragging over', () => {
133
+ const { container } = render(<Blank {...defaultProps} isOver={true} dragItem={{ choice: { value: 'Dog' } }} />);
134
+ expect(container.firstChild).toBeInTheDocument();
135
+ // Should show visual feedback for drag over
136
+ });
137
+ });
138
+ });