Skip to content

Commit

Permalink
Add regression test for multiline yield bang in if/then expression. F…
Browse files Browse the repository at this point in the history
…ixes #1185. (#1492)
  • Loading branch information
nojaf authored Feb 26, 2021
1 parent 3cafac5 commit 83ff34e
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/Fantomas.Tests/IfThenElseTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2019,3 +2019,40 @@ module Configuration =
then
config.Save file
"""

[<Test>]
let ``multiline yield bang in then expression, 1185`` () =
formatSourceString
false
"""
let lessonsForm (f:ValidatedForm<Request.CreateLessons>) dispatch =
Html.div [
Bulma.field.div [
Bulma.fieldBody [
Bulma.button.button [
color.isPrimary
prop.text "Přidat lekce"
if f.IsLoading then yield! [ button.isLoading; prop.disabled true ]
prop.onClick (fun _ -> CreateLessons |> dispatch)
]
]
]
]
"""
config
|> prepend newline
|> should
equal
"""
let lessonsForm (f: ValidatedForm<Request.CreateLessons>) dispatch =
Html.div [ Bulma.field.div [ Bulma.fieldBody [ Bulma.button.button [ color.isPrimary
prop.text "Přidat lekce"
if f.IsLoading then
yield!
[ button.isLoading
prop.disabled true ]
prop.onClick
(fun _ -> CreateLessons |> dispatch) ] ] ] ]
"""

0 comments on commit 83ff34e

Please sign in to comment.