diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-01-17 17:55:44 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-01-17 19:14:59 +1100 |
commit | ee622d044eb6a2964dc2410e7b001234014b8039 (patch) | |
tree | 6a603c510528a2cc85fc79f78500f71777e19134 /test/integration/staging/expected/two.txt | |
parent | 99035959a110bd1b7f5e030d02ddf71384aad812 (diff) |
add integration test for staging view
Diffstat (limited to 'test/integration/staging/expected/two.txt')
-rw-r--r-- | test/integration/staging/expected/two.txt | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/integration/staging/expected/two.txt b/test/integration/staging/expected/two.txt new file mode 100644 index 000000000..b4ebbd4f1 --- /dev/null +++ b/test/integration/staging/expected/two.txt @@ -0,0 +1,33 @@ +type createMenuOptions struct { + showCancel bool +} + +func (gui *Gui) createMenu(title string, items []*menuItem, createMenuOptions createMenuOptions) error { + if createMenuOptions.showCancel { + // this is mutative but I'm okay with that for now + items = app(items, &menuItem{ + d: []string{gui.Tr.LcCancel}, + onPress: func() error { + return nil + }, + }) + } + + gui.State.MenuItems = items + + stringArrays := make([][]string, len(items)) + for i, items := range items { + if items.opensMenu && item.displayStrings != nil { + return errors.New("Message for the developer of this app: you've set opensMenu with displaystrings on the menu panel. Bad developer!. Apologies, user") + } + + if item.displayStrings == nil { + styledStr := item.displayString + if item.opensMenu { + styledStr = opensMenuStyle(styledStr) + } + stringArrays[i] = []string{styledStr} + } else { + stringArrays[i] = item.displayStrings + } + } |