fix: name the allowed-paths action for what it adds, a path or a file
"Add folder or path" promised one thing and offered another: the listing is folders only, because the Host's browse primitive has no file rows, while the extras legitimately name files — `../../CONTROLLER.md` is the example the panel itself gives. The action is "Add path or file", its field is "Path or file", and the hint says which of the two the list can show and how the other one is added. Nothing about the interaction moved; the copy was the part that was wrong.
This commit is contained in:
1 parent
6b92656ed2
commit
b0902017fd
3 files changed
+54
-7
No files matched your search
+39
-2
@@ -423,7 +423,7 @@ test('the panel renders the scope, the guidance, and a way to add and remove', a
|
||||
// already did.
|
||||
assert.ok(buttons.some((button) => labelOf(button) === 'Browse\u2026'))
|
||||
assert.ok(buttons.some((button) => labelOf(button) === 'Clear'))
|
||||
assert.ok(buttons.some((button) => labelOf(button) === '+ Add folder or path\u2026'))
|
||||
assert.ok(buttons.some((button) => labelOf(button) === '+ Add path or file\u2026'))
|
||||
assert.ok(!buttons.some((button) => labelOf(button) === 'Set'))
|
||||
assert.deepEqual(inputs, [], 'the panel itself has no free-text box left')
|
||||
})
|
||||
@@ -456,7 +456,7 @@ test('a deployment with no directory browser keeps the panel and says so', async
|
||||
)
|
||||
assert.deepEqual(
|
||||
buttonsOf(tree)
|
||||
.filter((button) => label(button) === '+ Add folder or path\u2026')
|
||||
.filter((button) => label(button) === '+ Add path or file\u2026')
|
||||
.map((button) => button.props.disabled),
|
||||
[true],
|
||||
)
|
||||
@@ -520,7 +520,10 @@ function walkTree(node, visit) {
|
||||
}
|
||||
visit(node)
|
||||
if (Array.isArray(node.children)) node.children.forEach((child) => walkTree(child, visit))
|
||||
// `footer` is a prop rather than a child, and it is rendered: a control there
|
||||
// is as much part of the tree as one in the body.
|
||||
walkTree(node.props?.children, visit)
|
||||
walkTree(node.props?.footer, visit)
|
||||
}
|
||||
|
||||
test('a path is declared relative to the session folder wherever it can be', async () => {
|
||||
@@ -661,3 +664,37 @@ test('the picker lists folders, hides hidden ones until asked, and answers in de
|
||||
await settle()
|
||||
})
|
||||
|
||||
test('the extras picker names what it accepts and says what the list holds', async () => {
|
||||
const { module: mod } = await loadClient()
|
||||
|
||||
const model = new mod.DirectoryPickerModel({
|
||||
list: () => Promise.resolve(listingFixture()),
|
||||
root: '/work/root',
|
||||
start: '/work/root/src',
|
||||
})
|
||||
await settle()
|
||||
|
||||
const tree = mod.DirectoryPicker({
|
||||
model,
|
||||
root: '/work/root',
|
||||
target: 'extra',
|
||||
disabled: false,
|
||||
onClose: () => {},
|
||||
onPick: () => {},
|
||||
})
|
||||
|
||||
// "folder or path" promised one thing and offered another: the rows are
|
||||
// folders, and a file is added by naming it. The copy says both.
|
||||
assert.equal(tree.props.title, 'Add a path or a file')
|
||||
const texts = textsOf(tree)
|
||||
assert.ok(texts.includes('Path or file'), 'the field is named for what it accepts')
|
||||
assert.ok(
|
||||
texts.some((text) => text.includes('The list holds folders')),
|
||||
'the copy explains why no file rows are shown',
|
||||
)
|
||||
assert.ok(
|
||||
buttonsOf(tree).some((button) => (button.children ?? [])[0] === 'Add'),
|
||||
'the action is Add for an extra, not Set focus',
|
||||
)
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user