Skip to content

Commit

Permalink
Merge pull request #8 from imclerran/dev
Browse files Browse the repository at this point in the history
Add prompt indicating default app name
  • Loading branch information
imclerran authored Jun 5, 2024
2 parents 849f017 + 1f22f02 commit 8b2f43d
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/Tests.roc
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,41 @@ expect
&& newModel.cursor.row
== newModel.menuRow

expect
# TEST: PlatformSelect to Search
initModel =
Model.init ["platform1", "platform2", "platform3"] []
|> Model.toPlatformSelectState
model = { initModel &
state: PlatformSelect { config: { appName: "a", platform: "b", packages: ["c", "d"] } },
}
newModel = Model.toSearchState model
newModel.state
== Search { searchBuffer: [], sender: Platform, config: { appName: "a", platform: "b", packages: ["c", "d"] } }
&& newModel.cursor.row
== newModel.menuRow

expect
# TEST: PlatformSelect to UserExited
model =
Model.init [] []
|> Model.toPlatformSelectState
newModel = Model.toUserExitedState model
newModel.state == UserExited

expect
# TEST: PlatformSelect to PackageSelect
initModel =
Model.init ["b"] ["c", "d"]
|> Model.toPlatformSelectState
model = { initModel &
cursor: { row: initModel.menuRow, col: 2 },
state: PlatformSelect { config: { appName: "a", platform: "", packages: ["c"] } },
}
newModel = Model.toPackageSelectState model
newModel.state
== PackageSelect { config: { appName: "a", platform: "b", packages: ["c"] } }
&& newModel.cursor.row
== newModel.menuRow
&& newModel.selected
== ["c"]
2 changes: 2 additions & 0 deletions src/View.roc
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,12 @@ renderInputAppName = \model ->
renderControlsPrompt (controlsPromptStr model) model.screen,
],
renderOuterBorder model.screen,
if List.len nameBuffer == 0 then [Core.drawText " (Leave blank for \"main\"):" { r: 1, c: 20, fg: Standard Cyan }] else [],
[
renderScreenPrompt "ENTER THE APP NAME:",
Core.drawCursor { fg: Standard Magenta, char: ">" },
Core.drawText (nameBuffer |> Str.fromUtf8 |> Result.withDefault "") { r: model.menuRow, c: 4, fg: Standard White },

],
]

Expand Down

0 comments on commit 8b2f43d

Please sign in to comment.