-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsidebar-threshold.test.js
More file actions
46 lines (42 loc) · 1.34 KB
/
Copy pathsidebar-threshold.test.js
File metadata and controls
46 lines (42 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const { test } = require('brittle')
const { style } = require('bare-tui')
const render = require('../lib/render.js')
function cityFrame(width) {
return style.stripAnsi(
render.mapScreen({
width,
height: 20,
place: 'plaza',
stats: { hp: 9, maxhp: 12, gold: 7 },
log: ['primer mensaje'],
cellW: 1,
map: {
tiles: ['........', '........', '........'],
actors: [],
hero: { x: 4, y: 1 }
}
})
)
}
test('the city keeps ficha and log from MIN_WIDTH up to the old cutoff (#7)', (t) => {
for (const width of [64, 70, 80, 90]) {
const frame = cityFrame(width)
t.ok(frame.includes('ficha'), `${width} columns show the sheet`)
t.ok(frame.includes('log'), `${width} columns show the log panel`)
t.ok(frame.includes('primer mensaje'), `${width} columns surface new model state`)
}
})
test('below MIN_WIDTH nothing pretends to fit, and an explicit opt-out still works (#7)', (t) => {
t.ok(!cityFrame(63).includes('ficha'), '63 columns stay on the too-small screen')
const wide = render.mapScreen({
width: 100,
height: 20,
place: 'plaza',
stats: {},
log: [],
sidebar: false,
cellW: 1,
map: { tiles: ['....'], actors: [], hero: { x: 0, y: 0 } }
})
t.ok(!style.stripAnsi(wide).includes('ficha'), 'sidebar:false keeps its escape-hatch meaning')
})