fix(chat): repair Arco migration fallout in the chat page
The Phase 006 walkthrough surfaced four issues the automated checks could not see. Dead naive-ui class names left behind by the migration stopped matching, tooltips that carried their label as trailing default-slot text leaked that text into the flex row, the workspace panel squeezed the chat column until the input toolbar wrapped, and the Escape fallback still looked for naive-ui's modal mask. Tooltips now pass their label through the content prop, the tool panel reserves a minimum width for the chat column, and Escape finds the visible Arco modal and clicks its close button.
This commit is contained in:
@@ -209,4 +209,38 @@ describe('keyboard shortcut', () => {
|
||||
|
||||
expect(useSessionSearch().sessionSearchOpen.value).toBe(true)
|
||||
})
|
||||
|
||||
// The chat page dialogs all moved to Arco in Phase 006, so the Esc fallback
|
||||
// must look for Arco's close button, not naive-ui's.
|
||||
it('closes an open Arco modal on Escape, and ignores naive-ui markup', () => {
|
||||
const close = vi.fn()
|
||||
const modal = document.createElement('div')
|
||||
modal.className = 'arco-modal'
|
||||
const closeBtn = document.createElement('div')
|
||||
closeBtn.className = 'arco-modal-close-btn'
|
||||
closeBtn.addEventListener('click', close)
|
||||
modal.appendChild(closeBtn)
|
||||
document.body.appendChild(modal)
|
||||
|
||||
const legacyModal = document.createElement('div')
|
||||
legacyModal.className = 'n-modal n-modal-mask'
|
||||
document.body.appendChild(legacyModal)
|
||||
|
||||
const Dummy = defineComponent({
|
||||
setup() {
|
||||
useKeyboard()
|
||||
return () => h('div')
|
||||
},
|
||||
})
|
||||
const wrapper = mount(Dummy)
|
||||
// jsdom reports offsetParent as null, so make the modal look visible.
|
||||
Object.defineProperty(modal, 'offsetParent', { value: document.body })
|
||||
|
||||
window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' }))
|
||||
expect(close).toHaveBeenCalled()
|
||||
|
||||
wrapper.unmount()
|
||||
modal.remove()
|
||||
legacyModal.remove()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user