File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
packages/design-system/src/components/OcSelect Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,17 @@ describe('OcSelect', () => {
5858 options [ 0 ] . customLabel
5959 )
6060 } )
61+ it ( 'displays with a custom label function' , ( ) => {
62+ const options = [ { customLabel : 'label1' } , { customLabel : 'label2' } ]
63+ const wrapper = getWrapper < ( typeof options ) [ 0 ] > ( {
64+ options,
65+ modelValue : options [ 0 ] ,
66+ getOptionLabel : ( o ) => o . customLabel
67+ } )
68+ expect ( wrapper . findAll ( selectors . selectedOptions ) . at ( 0 ) . text ( ) ) . toEqual (
69+ options [ 0 ] . customLabel
70+ )
71+ } )
6172 it ( 'can be cleared if multi-select is allowed' , ( ) => {
6273 const options = [ { label : 'label1' } , { label : 'label2' } ]
6374 const wrapper = getWrapper ( { options, modelValue : options [ 0 ] , multiple : true } )
@@ -87,9 +98,13 @@ describe('OcSelect', () => {
8798 } )
8899} )
89100
90- function getWrapper (
101+ function getWrapper < T > (
91102 props : Partial <
92- PartialComponentProps < typeof OcSelect > & { options : unknown [ ] ; modelValue : unknown }
103+ Omit < PartialComponentProps < typeof OcSelect > , 'getOptionLabel' > & {
104+ options : T [ ]
105+ getOptionLabel : ( o : T ) => string
106+ modelValue : T
107+ }
93108 > = { }
94109) {
95110 return mount ( OcSelect , {
You can’t perform that action at this time.
0 commit comments