-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add index prop to NativeOption component and update selection l…
…ogic Refs: #7032
- Loading branch information
Showing
6 changed files
with
204 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
.../src/functional-components/inputs/NativeOption/tests/__snapshots__/snapshot.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,43 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`NativeOptionFc should render an option tag with the correct index as value and label 1`] = ` | ||
<option value="-1"> | ||
testLabel | ||
</option> | ||
`; | ||
|
||
exports[`NativeOptionFc should render an option tag with the correct value and label 1`] = ` | ||
<option value="testValue"> | ||
testLabel | ||
</option> | ||
`; | ||
|
||
exports[`NativeOptionFc should render and match snapshot 1`] = ` | ||
<option value="testValue"> | ||
testLabel | ||
</option> | ||
`; | ||
|
||
exports[`NativeOptionFc should set selected attribute correctly based on selected prop 1`] = ` | ||
<option selected="" value="testValue"> | ||
testLabel | ||
</option> | ||
`; | ||
|
||
exports[`NativeOptionFc should set selected attribute correctly based on selectedValue (with index as value) 1`] = ` | ||
<option selected="" value="-1"> | ||
testLabel | ||
</option> | ||
`; | ||
|
||
exports[`NativeOptionFc should set selected attribute correctly based on selectedValue 1`] = ` | ||
<option selected="" value="testValue"> | ||
testLabel | ||
</option> | ||
`; | ||
|
||
exports[`NativeOptionFc should set selected attribute correctly based on selectedValue as number (with index as value) 1`] = ` | ||
<option selected="" value="-1"> | ||
testLabel | ||
</option> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 49 additions & 14 deletions
63
.../functional-components/inputs/NativeOptionList/tests/__snapshots__/snapshot.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,65 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`NativeOptionListFc should render and match snapshot 1`] = ` | ||
<option value="-0"> | ||
Option 1 | ||
</option> | ||
<div id="jest-test"> | ||
<option value="-0"> | ||
Option 1 | ||
</option> | ||
</div> | ||
`; | ||
|
||
exports[`NativeOptionListFc should render with a single option 1`] = ` | ||
<option value="-0"> | ||
Option 1 | ||
</option> | ||
<div id="jest-test"> | ||
<option value="-0"> | ||
Option 1 | ||
</option> | ||
</div> | ||
`; | ||
|
||
exports[`NativeOptionListFc should render with multiple options 1`] = ` | ||
<option value="-0"> | ||
Option 1 | ||
</option> | ||
<div id="jest-test"> | ||
<option value="-0"> | ||
Option 1 | ||
</option> | ||
<option value="-1"> | ||
Option 2 | ||
</option> | ||
</div> | ||
`; | ||
|
||
exports[`NativeOptionListFc should render with nested option groups 1`] = ` | ||
<optgroup label="Group 1"> | ||
<option value="-0-0"> | ||
exports[`NativeOptionListFc should render with multiple options with selected value 1`] = ` | ||
<div id="jest-test"> | ||
<option value="-0"> | ||
Option 1 | ||
</option> | ||
<option value="-0-1"> | ||
<option selected="" value="-1"> | ||
Option 2 | ||
</option> | ||
</optgroup> | ||
</div> | ||
`; | ||
|
||
exports[`NativeOptionListFc should render with nested option groups 1`] = ` | ||
<div id="jest-test"> | ||
<optgroup label="Group 1"> | ||
<option value="-0-0"> | ||
Option 1 | ||
</option> | ||
<option value="-0-1"> | ||
Option 2 | ||
</option> | ||
</optgroup> | ||
</div> | ||
`; | ||
|
||
exports[`NativeOptionListFc should render with nested option groups with selected value 1`] = ` | ||
<div id="jest-test"> | ||
<optgroup label="Group 1"> | ||
<option value="-0-0"> | ||
Option 1 | ||
</option> | ||
<option selected="" value="-0-1"> | ||
Option 2 | ||
</option> | ||
</optgroup> | ||
</div> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters