From fd10862c5b8d70160a5e5bda605f6c041bffd855 Mon Sep 17 00:00:00 2001 From: MadanKumarGovindaswamy Date: Fri, 23 Jun 2023 16:07:05 +0530 Subject: [PATCH 1/8] Update: Native Select allow initial values --- .../native-select/ControlledSelect.test.jsx | 32 ++++++++++++++++++ .../src/native-select/NativeSelect.jsx | 17 ++++++++-- .../controlled-select-null.png | Bin 0 -> 3880 bytes .../controlled-select-value.png | Bin 0 -> 4297 bytes .../controlled-select-null.png | Bin 0 -> 3589 bytes .../controlled-select-value.png | Bin 0 -> 3856 bytes .../controlled-select-null.png | Bin 0 -> 4078 bytes .../controlled-select-value.png | Bin 0 -> 4415 bytes .../tests/wdio/native-select-spec.js | 14 ++++++++ 9 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 packages/terra-core-docs/src/terra-dev-site/test/form-select/native-select/ControlledSelect.test.jsx create mode 100644 packages/terra-form-select/tests/wdio/__snapshots__/reference/clinical-lowlight-theme/en/chrome_tiny/native-select-spec/controlled-select-null.png create mode 100644 packages/terra-form-select/tests/wdio/__snapshots__/reference/clinical-lowlight-theme/en/chrome_tiny/native-select-spec/controlled-select-value.png create mode 100644 packages/terra-form-select/tests/wdio/__snapshots__/reference/orion-fusion-theme/en/chrome_tiny/native-select-spec/controlled-select-null.png create mode 100644 packages/terra-form-select/tests/wdio/__snapshots__/reference/orion-fusion-theme/en/chrome_tiny/native-select-spec/controlled-select-value.png create mode 100644 packages/terra-form-select/tests/wdio/__snapshots__/reference/terra-default-theme/en/chrome_tiny/native-select-spec/controlled-select-null.png create mode 100644 packages/terra-form-select/tests/wdio/__snapshots__/reference/terra-default-theme/en/chrome_tiny/native-select-spec/controlled-select-value.png diff --git a/packages/terra-core-docs/src/terra-dev-site/test/form-select/native-select/ControlledSelect.test.jsx b/packages/terra-core-docs/src/terra-dev-site/test/form-select/native-select/ControlledSelect.test.jsx new file mode 100644 index 00000000000..a8a4f91a531 --- /dev/null +++ b/packages/terra-core-docs/src/terra-dev-site/test/form-select/native-select/ControlledSelect.test.jsx @@ -0,0 +1,32 @@ +import React, { useState } from 'react'; +import classNames from 'classnames/bind'; +import NativeSelect from 'terra-form-select/lib/native-select/NativeSelect'; +import Button from 'terra-button'; +import styles from './NativeSelectTest.module.scss'; + +const cx = classNames.bind(styles); + +const ControlledSelect = () => { + const [value, setValue] = useState(null); + + return ( + <> + setValue(event.currentTarget.value)} + options={[ + { value: 'volvo', display: 'Volvo' }, + { value: 'saab', display: 'Saab' }, + { value: 'mercedes', display: 'Mercedes' }, + { value: 'audi', display: 'Audi' }, + ]} + value={value} + className={cx('form-select')} + /> +