Skip to content

Commit 3c987cc

Browse files
committed
test(diff): add tests for not showing visualization
1 parent 2918f44 commit 3c987cc

3 files changed

+71
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--|---------|-----
2+
01|AAA
3+
02|uuu
4+
03|BBB
5+
04|CcC
6+
05|DDD
7+
06|FFF
8+
07|~
9+
08|~
10+
09|<e] [+] 1,1 All
11+
10|
12+
13+
--|---------|-----
14+
01|000000000000000
15+
02|000000000000000
16+
03|000000000000000
17+
04|000000000000000
18+
05|000000000000000
19+
06|000000000000000
20+
07|111111111111111
21+
08|111111111111111
22+
09|222222222222222
23+
10|333333333333333
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--|---------|-----
2+
01|AAA
3+
02|uuu
4+
03|BBB
5+
04|CcC
6+
05|DDD
7+
06|FFF
8+
07|~
9+
08|~
10+
09|<e] [+] 1,1 All
11+
10|
12+
13+
--|---------|-----
14+
01|000000000000000
15+
02|000000000000000
16+
03|000000000000000
17+
04|000000000000000
18+
05|000000000000000
19+
06|000000000000000
20+
07|111111111111111
21+
08|111111111111111
22+
09|222222222222222
23+
10|333333333333333

tests/test_diff.lua

+25
Original file line numberDiff line numberDiff line change
@@ -1957,6 +1957,31 @@ T['Visualization']['works'] = function()
19571957
})
19581958
end
19591959

1960+
T['Visualization']['does not appear if there is no gutter'] = function()
1961+
child.o.signcolumn, child.o.number = 'no', false
1962+
disable()
1963+
enable()
1964+
1965+
set_lines({ 'AAA', 'uuu', 'BBB', 'CcC', 'DDD', 'FFF' })
1966+
set_ref_text(0, { 'AAA', 'BBB', 'CCC', 'DDD', 'EEE', 'FFF' })
1967+
-- Shouldn't force neither sign nor number column
1968+
child.expect_screenshot()
1969+
end
1970+
1971+
T['Visualization']['can be visually disabled'] = function()
1972+
if child.fn.has('nvim-0.9') == 0 then MiniTest.skip('Neovim<0.9 still forces sign column to appear') end
1973+
child.lua('MiniDiff.config.view.style = "sign"')
1974+
child.lua('MiniDiff.config.view.signs = { add = "", change = "", delete = "" }')
1975+
disable()
1976+
enable()
1977+
1978+
set_lines({ 'AAA', 'uuu', 'BBB', 'CcC', 'DDD', 'FFF' })
1979+
set_ref_text(0, { 'AAA', 'BBB', 'CCC', 'DDD', 'EEE', 'FFF' })
1980+
-- Shouldn't show sign column, although extmarks are still placed
1981+
child.expect_screenshot()
1982+
eq(#get_viz_extmarks(0) > 0, true)
1983+
end
1984+
19601985
T['Visualization']['works with "add" hunks'] = function()
19611986
-- Every added line should be visualized as part of hunk
19621987
set_lines({ 'aaa', 'uuu', 'vvv', 'bbb', 'www', 'ccc' })

0 commit comments

Comments
 (0)