mirror of
https://github.com/nunntom/elm-ui-select.git
synced 2024-11-26 03:49:25 +03:00
Fix simulateClickOption not working when mutliple options contain the same substring
This commit is contained in:
parent
0671e3c3ce
commit
e21bfc3e50
@ -68,8 +68,6 @@ simulateInputConfig =
|
||||
{ simulateDomEvent = ProgramTest.simulateDomEvent
|
||||
, find = Query.find
|
||||
, attribute = Selector.attribute
|
||||
, containing = Selector.containing
|
||||
, text = Selector.text
|
||||
}
|
||||
|
||||
|
||||
|
@ -99,8 +99,6 @@ simulateConfig =
|
||||
{ simulateDomEvent = ProgramTest.simulateDomEvent
|
||||
, find = Query.find
|
||||
, attribute = Selector.attribute
|
||||
, containing = Selector.containing
|
||||
, text = Selector.text
|
||||
}
|
||||
|
||||
|
||||
|
@ -235,6 +235,7 @@ optionElement v i opt =
|
||||
Element.row
|
||||
[ Element.htmlAttribute (Html.Attributes.id (v.toOptionId i))
|
||||
, htmlAttribute "role" "option"
|
||||
, htmlAttribute "value" (Option.toString opt)
|
||||
, Element.htmlAttribute (Html.Events.preventDefaultOn "mousedown" (Decode.succeed ( v.onChange NoOp, True )))
|
||||
, Element.htmlAttribute (Html.Events.preventDefaultOn "click" (Decode.succeed ( v.onChange <| OptionClicked opt, True )))
|
||||
, Events.onMouseEnter (v.onChange <| MouseEnteredOption i)
|
||||
|
@ -281,8 +281,6 @@ type alias SimulateInputConfig single selector programTest =
|
||||
{ simulateDomEvent : (single -> single) -> ( String, Encode.Value ) -> programTest -> programTest
|
||||
, find : List selector -> single -> single
|
||||
, attribute : Html.Attribute Never -> selector
|
||||
, containing : List selector -> selector
|
||||
, text : String -> selector
|
||||
}
|
||||
|
||||
|
||||
@ -315,7 +313,7 @@ simulateClickOption config id optionLabel =
|
||||
(config.find [ config.attribute (Html.Attributes.id (id ++ "-menu")) ]
|
||||
>> config.find
|
||||
[ config.attribute (Html.Attributes.attribute "role" "option")
|
||||
, config.containing [ config.text optionLabel ]
|
||||
, config.attribute (Html.Attributes.attribute "value" optionLabel)
|
||||
]
|
||||
)
|
||||
( "click", Encode.object [] )
|
||||
|
Loading…
Reference in New Issue
Block a user