-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
60b751c
commit 876e509
Showing
6 changed files
with
102 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { nextTick } from 'vue' | ||
import { WysiwygEditor } from '@/components/common' | ||
import { createComponent } from './utils' | ||
|
||
describe('WysiwygEditor', () => { | ||
let wrapper | ||
beforeEach(async () => { | ||
wrapper = await createComponent(WysiwygEditor, { editorContent: '<p>Test content</p>' }) | ||
}) | ||
|
||
it('renders the component correctly', () => { | ||
expect(wrapper.exists()).toBe(true) | ||
}) | ||
|
||
it('sets the editor content correctly', () => { | ||
expect(wrapper.vm.wysiwygEditorContent).toBe('<p>Test content</p>') | ||
}) | ||
|
||
it('emits the editor content when it updates', async () => { | ||
wrapper.vm.setEditorContent('<p>New content</p>') | ||
await nextTick() | ||
|
||
expect(wrapper.emitted('emitEditorContent')[1]).toEqual(['<p>New content</p>']) | ||
}) | ||
|
||
it('displays table input dialog on insertTable action', async () => { | ||
// Simulate clicking insertTable action | ||
await wrapper.vm.getToolAction({ | ||
action: 'insertTable' | ||
}) | ||
|
||
expect(wrapper.vm.displayTableInput).toBe(true) | ||
}) | ||
|
||
it('handles dialog action correctly', async () => { | ||
// Simulate clicking insertTable action | ||
await wrapper.vm.getToolAction({ | ||
action: 'insertTable' | ||
}) | ||
|
||
wrapper.vm.insertTableRows = 2 | ||
wrapper.vm.insertTableCols = 3 | ||
|
||
// Simulate proceeding with the dialog action | ||
await wrapper.vm.handleDialogAction(true) | ||
|
||
expect(wrapper.vm.displayTableInput).toBe(false) | ||
// Add your assertions for the inserted table here | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters