Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/react-dom-bindings/src/client/ReactDOMComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ function setProp(
case 'contentEditable':
case 'spellCheck':
case 'draggable':
case 'writingsuggestions':
case 'value':
case 'autoReverse':
case 'externalResourcesRequired':
Expand Down Expand Up @@ -2831,6 +2832,7 @@ function diffHydratedGenericElement(
continue;
}
case 'draggable':
case 'writingsuggestions':
case 'autoReverse':
case 'externalResourcesRequired':
case 'focusable':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1656,6 +1656,7 @@ function pushAttribute(
case 'contentEditable':
case 'spellCheck':
case 'draggable':
case 'writingsuggestions':
case 'value':
case 'autoReverse':
case 'externalResourcesRequired':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ function validateProperty(tagName, name, value, eventRegistry) {
case 'contentEditable':
case 'spellCheck':
case 'draggable':
case 'writingsuggestions':
case 'value':
case 'autoReverse':
case 'externalResourcesRequired':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ const possibleStandardNames = {
width: 'width',
wmode: 'wmode',
wrap: 'wrap',
writingsuggestions: 'writingsuggestions',

// SVG
about: 'about',
Expand Down
36 changes: 36 additions & 0 deletions packages/react-dom/src/__tests__/ReactDOMComponent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2688,6 +2688,16 @@ describe('ReactDOMComponent', () => {
]);
});

it('should warn about incorrect casing on the writingsuggestions property (ssr)', () => {
ReactDOMServer.renderToString(
React.createElement('div', {WritingSuggestions: 'false'}),
);
assertConsoleErrorDev([
'Invalid DOM property `WritingSuggestions`. Did you mean `writingsuggestions`?\n' +
' in div (at **)',
]);
});

it('should warn about incorrect casing on event handlers (ssr)', () => {
ReactDOMServer.renderToString(
React.createElement('input', {type: 'text', oninput: '1'}),
Expand Down Expand Up @@ -3615,6 +3625,32 @@ describe('ReactDOMComponent', () => {

expect(el.getAttribute('spellCheck')).toBe('true');
});

it('stringifies the boolean true for writingsuggestions', async function () {
const container = document.createElement('div');
const root = ReactDOMClient.createRoot(container);

await act(() => {
root.render(<div writingsuggestions={true} />);
});

const el = container.firstChild;

expect(el.getAttribute('writingsuggestions')).toBe('true');
});

it('stringifies the boolean false for writingsuggestions', async function () {
const container = document.createElement('div');
const root = ReactDOMClient.createRoot(container);

await act(() => {
root.render(<div writingsuggestions={false} />);
});

const el = container.firstChild;

expect(el.getAttribute('writingsuggestions')).toBe('false');
});
});

describe('Boolean attributes', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,18 @@ describe('ReactDOMServerIntegration', () => {
});
});

describe('writingsuggestions property', function () {
itRenders('writingsuggestions prop with true value', async render => {
const e = await render(<div writingsuggestions={true} />);
expect(e.getAttribute('writingsuggestions')).toBe('true');
});

itRenders('writingsuggestions prop with false value', async render => {
const e = await render(<div writingsuggestions={false} />);
expect(e.getAttribute('writingsuggestions')).toBe('false');
});
});

describe('download property (combined boolean/string attribute)', function () {
itRenders('download prop with true value', async render => {
const e = await render(<a download={true} />);
Expand Down