Skip to content

Commit

Permalink
Remove initOption
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage committed Apr 11, 2023
1 parent ac43bf6 commit 0d9515b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 20 deletions.
3 changes: 1 addition & 2 deletions packages/react-dom-bindings/src/client/ReactDOMComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
updateInput,
restoreControlledInputState,
} from './ReactDOMInput';
import {initOption, validateOptionProps} from './ReactDOMOption';
import {validateOptionProps} from './ReactDOMOption';
import {
validateSelectProps,
initSelect,
Expand Down Expand Up @@ -995,7 +995,6 @@ export function setInitialProperties(
}
}
}
initOption(domElement, props);
return;
}
case 'dialog': {
Expand Down
7 changes: 0 additions & 7 deletions packages/react-dom-bindings/src/client/ReactDOMOption.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,3 @@ export function validateOptionProps(element: Element, props: Object) {
}
}
}

export function initOption(element: Element, props: Object) {
// value="" should make a value attribute (#6219)
if (props.value != null) {
element.setAttribute('value', toString(getToStringValue(props.value)));
}
}
22 changes: 11 additions & 11 deletions packages/react-dom/src/__tests__/ReactDOMSelect-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ describe('ReactDOMSelect', () => {
});

describe('When given a Symbol value', () => {
it('treats initial Symbol value as an empty string', () => {
it('treats initial Symbol value as missing', () => {
let node;

expect(() => {
Expand All @@ -862,10 +862,10 @@ describe('ReactDOMSelect', () => {
);
}).toErrorDev('Invalid value for prop `value`');

expect(node.value).toBe('');
expect(node.value).toBe('A Symbol!');
});

it('treats updated Symbol value as an empty string', () => {
it('treats updated Symbol value as missing', () => {
let node;

expect(() => {
Expand All @@ -888,7 +888,7 @@ describe('ReactDOMSelect', () => {
</select>,
);

expect(node.value).toBe('');
expect(node.value).toBe('A Symbol!');
});

it('treats initial Symbol defaultValue as an empty string', () => {
Expand All @@ -904,7 +904,7 @@ describe('ReactDOMSelect', () => {
);
}).toErrorDev('Invalid value for prop `value`');

expect(node.value).toBe('');
expect(node.value).toBe('A Symbol!');
});

it('treats updated Symbol defaultValue as an empty string', () => {
Expand All @@ -930,12 +930,12 @@ describe('ReactDOMSelect', () => {
</select>,
);

expect(node.value).toBe('');
expect(node.value).toBe('A Symbol!');
});
});

describe('When given a function value', () => {
it('treats initial function value as an empty string', () => {
it('treats initial function value as missing', () => {
let node;

expect(() => {
Expand All @@ -948,7 +948,7 @@ describe('ReactDOMSelect', () => {
);
}).toErrorDev('Invalid value for prop `value`');

expect(node.value).toBe('');
expect(node.value).toBe('A function!');
});

it('treats initial function defaultValue as an empty string', () => {
Expand All @@ -964,7 +964,7 @@ describe('ReactDOMSelect', () => {
);
}).toErrorDev('Invalid value for prop `value`');

expect(node.value).toBe('');
expect(node.value).toBe('A function!');
});

it('treats updated function value as an empty string', () => {
Expand All @@ -990,7 +990,7 @@ describe('ReactDOMSelect', () => {
</select>,
);

expect(node.value).toBe('');
expect(node.value).toBe('A function!');
});

it('treats updated function defaultValue as an empty string', () => {
Expand All @@ -1016,7 +1016,7 @@ describe('ReactDOMSelect', () => {
</select>,
);

expect(node.value).toBe('');
expect(node.value).toBe('A function!');
});
});

Expand Down

0 comments on commit 0d9515b

Please sign in to comment.