Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexAndBear committed Jan 30, 2024
1 parent a9a4d35 commit 3336e1d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
14 changes: 7 additions & 7 deletions packages/web-pkg/src/components/TextEditor.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div ref="toastuiEditorRef" :data-markdown-mode="isMarkdown" />
<div id="text-editor-container" ref="toastUiEditorRef" :data-markdown-mode="isMarkdown" />
</template>

<script lang="ts">
Expand Down Expand Up @@ -43,9 +43,9 @@ export default defineComponent({
setup(props, { emit }) {
const { current: currentLanguage } = useGettext()
const themeStore = useThemeStore()
const toastuiEditorRef = ref()
const toastUiEditorRef = ref()
// Should not be a ref, otherwise functions like setMarkdown won't work
let toastuiEditor: EditorCore = null
let toastUiEditor: EditorCore = null
const config = computed(() => {
// TODO: Remove typecasting once vue-tsc has figured it out
const { showPreviewOnlyMd = true } = props.applicationConfig as AppConfigObject
Expand All @@ -60,7 +60,7 @@ export default defineComponent({
onMounted(() => {
let config: EditorOptions = {
el: unref(toastuiEditorRef),
el: unref(toastUiEditorRef),
usageStatistics: false, // sends hostname to google analytics DISABLE
initialValue: props.currentContent,
useCommandShortcut: false,
Expand All @@ -71,7 +71,7 @@ export default defineComponent({
viewer: props.isReadOnly,
events: {
change: () => {
emit('update:currentContent', toastuiEditor.getMarkdown())
emit('update:currentContent', toastUiEditor.getMarkdown())
}
},
...(themeStore.currentTheme.isDark && { theme: 'dark' })
Expand All @@ -85,11 +85,11 @@ export default defineComponent({
}
}
toastuiEditor = Editor.factory(config) as EditorCore
toastUiEditor = Editor.factory(config) as EditorCore
})
return {
toastuiEditorRef,
toastUiEditorRef,
isMarkdown
}
}
Expand Down
11 changes: 6 additions & 5 deletions tests/acceptance/pageObjects/textEditorPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,20 @@ module.exports = {
},
elements: {
editor: {
selector: '#text-editor'
selector: '#text-editor #text-editor-container'
},
editorPlainTextInputArea: {
selector: '#text-editor .ww-mode .ProseMirror'
selector: '#text-editor #text-editor-container .ww-mode .ProseMirror'
},
editorMarkdownInputArea: {
selector: '#text-editor .md-mode .ProseMirror'
selector: '#text-editor #text-editor-container .md-mode .ProseMirror'
},
editorPreviewButton: {
selector: '#text-editor .tab-item:nth-child(2)'
selector: '#text-editor #text-editor-container .tab-item:nth-child(2)'
},
editorPreviewPanel: {
selector: '#text-editor .toastui-editor-md-preview .toastui-editor-contents'
selector:
'#text-editor #text-editor-container .toastui-editor-md-preview .toastui-editor-contents'
},
saveButton: {
selector: saveButtonSelector
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/support/objects/app-files/resource/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ const createNewOfficeDocumentFileBUtton = '//ul[@id="create-list"]//span[text()=
const createNewShortcutButton = '#new-shortcut-btn'
const shortcutResorceInput = '#create-shortcut-modal-url-input'
const saveTextFileInEditorButton = '#app-save-action:visible'
const textEditor = '#text-editor'
const textEditorPlainTextInput = '#text-editor .ww-mode .ProseMirror'
const textEditorMarkdownInput = '#text-editor .md-mode .ProseMirror'
const textEditor = '#text-editor #text-editor-container'
const textEditorPlainTextInput = '#text-editor #text-editor-container .ww-mode .ProseMirror'
const textEditorMarkdownInput = '#text-editor #text-editor-container .md-mode .ProseMirror'
const resourceNameInput = '.oc-modal input'
const resourceUploadButton = '#upload-menu-btn'
const fileUploadInput = '#files-file-upload-input'
Expand Down

0 comments on commit 3336e1d

Please sign in to comment.