fix(editor): recover missing files and synchronize section toggle
This commit is contained in:
@@ -93,9 +93,34 @@ describe('VisualMarkdownEditor formatting toolbars', () => {
|
||||
expect(wrapper.find('.heading-fold-hidden').exists()).toBe(false)
|
||||
expect(editor.action(getMarkdown()).trim()).toBe(source)
|
||||
await wrapper.get('button[aria-label="折叠所有章节"]').trigger('click')
|
||||
expect(wrapper.findAll('.section-actions button')).toHaveLength(1)
|
||||
expect(wrapper.get('.section-actions button').text()).toBe('全部展开')
|
||||
await wrapper.get('.heading-fold-toggle[aria-label="展开 H1 C"]').trigger('click')
|
||||
expect(wrapper.get('.section-actions button').text()).toBe('全部折叠')
|
||||
await wrapper.get('button[aria-label="折叠所有章节"]').trigger('click')
|
||||
await wrapper.get('button[aria-label="展开所有章节"]').trigger('click')
|
||||
expect(wrapper.get('.section-actions button').text()).toBe('全部折叠')
|
||||
expect(wrapper.find('.heading-fold-hidden').exists()).toBe(false)
|
||||
})
|
||||
it('offers expand all when individually collapsed parents hide expanded children', async () => {
|
||||
const source = '# A\n\nbody\n\n## B\n\nchild\n\n# C\n\nbody'
|
||||
const wrapper = mount(VisualMarkdownEditor, { props: { initialContent: source }, attachTo: document.body })
|
||||
mounted.push(wrapper)
|
||||
const editor = await waitForEditor(wrapper)
|
||||
await wrapper.get('.heading-fold-toggle[aria-label="折叠 H1 A"]').trigger('click')
|
||||
expect(wrapper.get('.section-actions button').text()).toBe('全部折叠')
|
||||
await wrapper.get('.heading-fold-toggle[aria-label="折叠 H1 C"]').trigger('click')
|
||||
expect(wrapper.get('.section-actions button').text()).toBe('全部展开')
|
||||
expect(wrapper.get('.heading-fold-toggle[aria-label="折叠 H2 B"]').attributes('aria-expanded')).toBe('true')
|
||||
await wrapper.get('.heading-fold-toggle[aria-label="展开 H1 A"]').trigger('click')
|
||||
expect(wrapper.get('.section-actions button').text()).toBe('全部折叠')
|
||||
expect(wrapper.get('.heading-fold-toggle[aria-label="折叠 H2 B"]').attributes('aria-expanded')).toBe('true')
|
||||
await wrapper.get('.heading-fold-toggle[aria-label="折叠 H1 A"]').trigger('click')
|
||||
await wrapper.get('.section-actions button').trigger('click')
|
||||
expect(wrapper.find('.heading-fold-hidden').exists()).toBe(false)
|
||||
expect(wrapper.get('.section-actions button').text()).toBe('全部折叠')
|
||||
expect(editor.action(getMarkdown()).trim()).toBe(source)
|
||||
})
|
||||
it('renders and folds callouts without losing portable Markdown on serialization', async () => {
|
||||
const source = '> [!WARNING]- 注意\n>\n> **正文**\n>\n> > [!TIP] 内层\n> > 内容'
|
||||
const wrapper = mount(VisualMarkdownEditor, { props: { initialContent: source }, attachTo: document.body })
|
||||
|
||||
Reference in New Issue
Block a user