|
| 1 | +package ui |
| 2 | + |
| 3 | +import ( |
| 4 | + "github.com/jesseduffield/lazygit/pkg/config" |
| 5 | + . "github.com/jesseduffield/lazygit/pkg/integration/components" |
| 6 | +) |
| 7 | + |
| 8 | +// When in acccordion mode, Lazygit looks like this: |
| 9 | +// |
| 10 | +// ╶─Status─────────────────────────╴┌─Patch──────────────────────────────────────────────────────────┐ |
| 11 | +// ╶─Files - Submodules──────0 of 0─╴│commit 6e56dd04b70e548976f7f2928c4d9c359574e2bc ▲ |
| 12 | +// ╶─Local branches - Remotes1 of 1─╴│Author: CI <[email protected]> █ |
| 13 | +// ┌─Commits - Reflog───────────────┐│Date: Wed Jul 19 22:00:03 2023 +1000 │ |
| 14 | +// │7fe02805 CI commit 12 ▲│ ▼ |
| 15 | +// │6e56dd04 CI commit 11 █└────────────────────────────────────────────────────────────────┘ |
| 16 | +// │a35c687d CI commit 10 ▼┌─Command log────────────────────────────────────────────────────┐ |
| 17 | +// └───────────────────────10 of 20─┘│Random tip: To filter commits by path, press '<c-s>' │ |
| 18 | +// ╶─Stash───────────────────0 of 0─╴└────────────────────────────────────────────────────────────────┘ |
| 19 | +// <pgup>/<pgdown>: Scroll, <esc>: Cancel, q: Quit, ?: Keybindings, 1-Donate Ask Question unversioned |
| 20 | + |
| 21 | +var Accordion = NewIntegrationTest(NewIntegrationTestArgs{ |
| 22 | + Description: "Verify accordion mode kicks in when the screen height is too small", |
| 23 | + ExtraCmdArgs: []string{}, |
| 24 | + Width: 100, |
| 25 | + Height: 10, |
| 26 | + Skip: false, |
| 27 | + SetupConfig: func(config *config.AppConfig) {}, |
| 28 | + SetupRepo: func(shell *Shell) { |
| 29 | + shell.CreateNCommits(20) |
| 30 | + }, |
| 31 | + Run: func(t *TestDriver, keys config.KeybindingConfig) { |
| 32 | + t.Views().Commits(). |
| 33 | + Focus(). |
| 34 | + VisibleLines( |
| 35 | + Contains("commit 20").IsSelected(), |
| 36 | + Contains("commit 19"), |
| 37 | + Contains("commit 18"), |
| 38 | + ). |
| 39 | + // go past commit 11, then come back, so that it ends up in the centre of the viewport |
| 40 | + NavigateToLine(Contains("commit 11")). |
| 41 | + NavigateToLine(Contains("commit 10")). |
| 42 | + NavigateToLine(Contains("commit 11")). |
| 43 | + VisibleLines( |
| 44 | + Contains("commit 12"), |
| 45 | + Contains("commit 11").IsSelected(), |
| 46 | + Contains("commit 10"), |
| 47 | + ) |
| 48 | + |
| 49 | + t.Views().Files(). |
| 50 | + Focus() |
| 51 | + |
| 52 | + // ensure we retain the same viewport upon re-focus |
| 53 | + t.Views().Commits(). |
| 54 | + Focus(). |
| 55 | + VisibleLines( |
| 56 | + Contains("commit 12"), |
| 57 | + Contains("commit 11").IsSelected(), |
| 58 | + Contains("commit 10"), |
| 59 | + ) |
| 60 | + }, |
| 61 | +}) |
0 commit comments