fix(editor): C1 review round 1, note endings tested, tile hook, pin guard
Tests: note ends on another tile's Modifier, on Ajouter une reference, and is replaced (announced again) by a newer drop; long titles shortened. Read-only toggle deletes the key from openKeys explicitly. Drop slot and tile wrappers moved to useTileActions. pinEdited pins nothing for an absent key.
This commit is contained in:
1 parent
3303530717
commit
1e19479853
4 files changed
+80
-13
No files matched your search
@@ -145,7 +145,7 @@ async function typeBadUrl(user: User, id: string) {
|
||||
}
|
||||
|
||||
describe('a read-only flip with a refused draft (tab tile)', () => {
|
||||
it('shows the note in the tile, says it once, writes nothing, keeps the focus on the tile', async () => {
|
||||
it('shows the note, says it once, writes nothing, focuses the tile', async () => {
|
||||
const user = await mount()
|
||||
await editTile(user, 'ref-b', /^Denoix/)
|
||||
await typeBadUrl(user, 'ref-b')
|
||||
@@ -167,7 +167,7 @@ describe('a read-only flip with a refused draft (tab tile)', () => {
|
||||
watch.stop()
|
||||
})
|
||||
|
||||
it('keeps the note across the flip back, URL field on the document value; Terminer removes it', async () => {
|
||||
it('keeps the note across the flip back; Terminer removes it', async () => {
|
||||
const user = await mount()
|
||||
await editTile(user, 'ref-b', /^Denoix/)
|
||||
await typeBadUrl(user, 'ref-b')
|
||||
@@ -225,8 +225,57 @@ describe('a read-only flip with a refused draft (tab tile)', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('the note ends on the next action', () => {
|
||||
/** ref-b flipped with a refused URL and back: in edit again, note shown. */
|
||||
async function flippedBack() {
|
||||
const user = await mount()
|
||||
await editTile(user, 'ref-b', /^Denoix/)
|
||||
await typeBadUrl(user, 'ref-b')
|
||||
cross(800)
|
||||
cross(1280)
|
||||
expect(
|
||||
within(tile('ref-b')).getByText(/Saisie non appliquée/),
|
||||
).toBeVisible()
|
||||
return user
|
||||
}
|
||||
const noted = () => within(tabPanel()).queryAllByText(/Saisie non appliquée/)
|
||||
|
||||
it("ends on another tile's « Modifier » (this tile leaves edit)", async () => {
|
||||
const user = await flippedBack()
|
||||
await user.click(
|
||||
within(tabPanel()).getByRole('button', { name: /^Barone/ }),
|
||||
)
|
||||
await user.click(
|
||||
within(tile('ref-a')).getByRole('button', { name: 'Modifier' }),
|
||||
)
|
||||
expect(noted()).toHaveLength(0)
|
||||
})
|
||||
|
||||
it('ends on « Ajouter une référence »', async () => {
|
||||
const user = await flippedBack()
|
||||
await user.click(
|
||||
within(tabPanel()).getByRole('button', { name: 'Ajouter une référence' }),
|
||||
)
|
||||
expect(noted()).toHaveLength(0)
|
||||
})
|
||||
|
||||
it('is replaced by a newer drop of the same tile, announced again', async () => {
|
||||
const user = await flippedBack()
|
||||
const watch = watchNotes()
|
||||
await user.clear(field('ref-b', 'citation'))
|
||||
await typeBadUrl(user, 'ref-b')
|
||||
cross(800)
|
||||
await flush()
|
||||
const items = noted()
|
||||
expect(items).toHaveLength(1)
|
||||
expect(items[0]).toHaveTextContent(`${NOTE} : Citation, Adresse web (URL)`)
|
||||
expect(watch.seen).toHaveLength(1)
|
||||
watch.stop()
|
||||
})
|
||||
})
|
||||
|
||||
describe('a read-only flip without a refused draft', () => {
|
||||
it('adds exactly the typed change when a valid draft has the focus, nothing on the way back', async () => {
|
||||
it('adds only the typed change when a valid draft has the focus', async () => {
|
||||
const user = await mount()
|
||||
await editTile(user, 'ref-a', /^Barone/)
|
||||
const citation = field('ref-a', 'citation')
|
||||
|
||||
Reference in new issue
Block a user