Skip to content

Commit

Permalink
Migrate to vue 3
Browse files Browse the repository at this point in the history
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
  • Loading branch information
raimund-schluessler committed Sep 18, 2023
1 parent 33ecf70 commit e0e34b5
Show file tree
Hide file tree
Showing 62 changed files with 792 additions and 913 deletions.
11 changes: 6 additions & 5 deletions cypress/component/modal.cy.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import { mount } from 'cypress/vue2'
import { mount } from 'cypress/vue'
import NcModal from '../../src/components/NcModal/NcModal.vue'
import type { Component } from 'vue'
import { h } from 'vue'

describe('NcModal', () => {
it('close button is visible when content is scrolled', () => {
mount(NcModal, {
propsData: {
props: {
show: true,
size: 'small',
name: 'Name',
},
slots: {
// Create two div as children, first is 100vh = overflows the content, second just gets some data attribute so we can scroll into view
default: {
render: (h) =>
render: () =>
h('div', [
h('div', { style: 'height: 100vh;' }),
h('div', { attrs: { 'data-cy': 'bottom' } }),
h('div', { style: { height: '100vh' } }),
h('div', { 'data-cy': 'bottom' }),
]),
} as Component,
},
Expand Down
76 changes: 38 additions & 38 deletions cypress/component/richtext.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Markdown guide: https://www.markdownguide.org/basic-syntax/
// Reference tests: https://github.com/nextcloud-deps/CDMarkdownKit/tree/master/CDMarkdownKitTests

import { mount } from 'cypress/vue2'
import { mount } from 'cypress/vue'
import NcRichText from '../../src/components/NcRichText/NcRichText.vue'

describe('NcRichText', () => {
Expand All @@ -18,7 +18,7 @@ describe('NcRichText', () => {
]

mount(NcRichText, {
propsData: {
props: {
text: testCases.map(i => i.input).join('\n'),
useMarkdown: true,
},
Expand All @@ -31,7 +31,7 @@ describe('NcRichText', () => {

it('ignored heading (with hash (#) syntax padded to the text)', () => {
mount(NcRichText, {
propsData: {
props: {
text: '#heading',
useMarkdown: true,
},
Expand All @@ -42,7 +42,7 @@ describe('NcRichText', () => {

it('heading 1 (with equal (=) syntax on the next line)', () => {
mount(NcRichText, {
propsData: {
props: {
text: 'heading 1\n==',
useMarkdown: true,
},
Expand All @@ -53,7 +53,7 @@ describe('NcRichText', () => {

it('heading 2 (with dash (-) syntax on the next line)', () => {
mount(NcRichText, {
propsData: {
props: {
text: 'heading 2\n--',
useMarkdown: true,
},
Expand All @@ -66,7 +66,7 @@ describe('NcRichText', () => {
describe('bold text', () => {
it('bold text (single with asterisk syntax)', () => {
mount(NcRichText, {
propsData: {
props: {
text: '**bold asterisk**',
useMarkdown: true,
},
Expand All @@ -77,7 +77,7 @@ describe('NcRichText', () => {

it('bold text (single with underscore syntax)', () => {
mount(NcRichText, {
propsData: {
props: {
text: '__bold underscore__',
useMarkdown: true,
},
Expand All @@ -89,7 +89,7 @@ describe('NcRichText', () => {
it('bold text (several in line with different syntax)', () => {
const outputs = ['bold underscore', 'bold asterisk']
mount(NcRichText, {
propsData: {
props: {
text: 'normal text __bold underscore__ normal text **bold asterisk** normal text',
useMarkdown: true,
},
Expand All @@ -103,7 +103,7 @@ describe('NcRichText', () => {

it('bold text (between normal texts with asterisk syntax)', () => {
mount(NcRichText, {
propsData: {
props: {
text: 'text**bold**text',
useMarkdown: true,
},
Expand All @@ -114,7 +114,7 @@ describe('NcRichText', () => {

it('ignored bold text (between normal texts with underscore syntax)', () => {
mount(NcRichText, {
propsData: {
props: {
text: 'text__bold__text',
useMarkdown: true,
},
Expand All @@ -126,7 +126,7 @@ describe('NcRichText', () => {
it('normal text (between bold texts with asterisk syntax)', () => {
const outputs = ['bold asterisk', 'bold asterisk']
mount(NcRichText, {
propsData: {
props: {
text: '**bold asterisk**normal text**bold asterisk**',
useMarkdown: true,
},
Expand All @@ -142,7 +142,7 @@ describe('NcRichText', () => {
describe('italic text', () => {
it('italic text (single with asterisk syntax)', () => {
mount(NcRichText, {
propsData: {
props: {
text: '*italic asterisk*',
useMarkdown: true,
},
Expand All @@ -153,7 +153,7 @@ describe('NcRichText', () => {

it('italic text (single with underscore syntax)', () => {
mount(NcRichText, {
propsData: {
props: {
text: '_italic underscore_',
useMarkdown: true,
},
Expand All @@ -165,7 +165,7 @@ describe('NcRichText', () => {
it('italic text (several in line with different syntax)', () => {
const outputs = ['italic underscore', 'italic asterisk']
mount(NcRichText, {
propsData: {
props: {
text: 'normal text _italic underscore_ normal text *italic asterisk* normal text',
useMarkdown: true,
},
Expand All @@ -179,7 +179,7 @@ describe('NcRichText', () => {

it('italic text (between normal texts with asterisk syntax)', () => {
mount(NcRichText, {
propsData: {
props: {
text: 'text*italic*text',
useMarkdown: true,
},
Expand All @@ -190,7 +190,7 @@ describe('NcRichText', () => {

it('ignored italic text (between normal texts with underscore syntax)', () => {
mount(NcRichText, {
propsData: {
props: {
text: 'text_italic_text',
useMarkdown: true,
},
Expand All @@ -202,7 +202,7 @@ describe('NcRichText', () => {
it('normal text (between italic texts with asterisk syntax)', () => {
const outputs = ['italic asterisk', 'italic asterisk']
mount(NcRichText, {
propsData: {
props: {
text: '*italic asterisk*normal text*italic asterisk*',
useMarkdown: true,
},
Expand All @@ -218,7 +218,7 @@ describe('NcRichText', () => {
describe('inline code', () => {
it('inline code (single with backticks syntax)', () => {
mount(NcRichText, {
propsData: {
props: {
text: 'normal text `inline code` normal text',
useMarkdown: true,
},
Expand All @@ -229,7 +229,7 @@ describe('NcRichText', () => {

it('inline code (single with double backticks syntax)', () => {
mount(NcRichText, {
propsData: {
props: {
text: 'normal text ``inline code`` normal text',
useMarkdown: true,
},
Expand All @@ -240,7 +240,7 @@ describe('NcRichText', () => {

it('inline code (single with triple backticks syntax)', () => {
mount(NcRichText, {
propsData: {
props: {
text: 'normal text ```inline code``` normal text',
useMarkdown: true,
},
Expand All @@ -252,7 +252,7 @@ describe('NcRichText', () => {
it('inline code (several in line )', () => {
const outputs = ['inline code 1', 'inline code 2']
mount(NcRichText, {
propsData: {
props: {
text: 'normal text `inline code 1`normal text ``inline code 2`` normal text',
useMarkdown: true,
},
Expand All @@ -266,7 +266,7 @@ describe('NcRichText', () => {

it('inline code (between normal texts)', () => {
mount(NcRichText, {
propsData: {
props: {
text: 'text`inline code`text',
useMarkdown: true,
},
Expand All @@ -279,7 +279,7 @@ describe('NcRichText', () => {
describe('multiline code', () => {
it('multiline code (with triple backticks syntax)', () => {
mount(NcRichText, {
propsData: {
props: {
text: '```\nmultiline code\n```',
useMarkdown: true,
},
Expand All @@ -290,7 +290,7 @@ describe('NcRichText', () => {

it('multiline code (ignored info)', () => {
mount(NcRichText, {
propsData: {
props: {
text: '```vue\nmultiline code\n```',
useMarkdown: true,
},
Expand All @@ -301,7 +301,7 @@ describe('NcRichText', () => {

it('empty multiline code', () => {
mount(NcRichText, {
propsData: {
props: {
text: '``````',
useMarkdown: true,
},
Expand All @@ -312,7 +312,7 @@ describe('NcRichText', () => {

it('empty multiline code (with new line)', () => {
mount(NcRichText, {
propsData: {
props: {
text: '```\n```',
useMarkdown: true,
},
Expand All @@ -323,7 +323,7 @@ describe('NcRichText', () => {

it('multiline code (with several lines)', () => {
mount(NcRichText, {
propsData: {
props: {
text: '```\nline 1\nline 2\nline 3\n```',
useMarkdown: true,
},
Expand All @@ -335,7 +335,7 @@ describe('NcRichText', () => {

it('multiline code (with ignored bold, italic, inline code syntax)', () => {
mount(NcRichText, {
propsData: {
props: {
text: '```\n**bold text**\n_italic text_\n`inline code`\n```',
useMarkdown: true,
},
Expand All @@ -348,7 +348,7 @@ describe('NcRichText', () => {
describe('blockquote', () => {
it('blockquote (with greater then (gt >) syntax)', () => {
mount(NcRichText, {
propsData: {
props: {
text: '> blockquote',
useMarkdown: true,
},
Expand All @@ -359,7 +359,7 @@ describe('NcRichText', () => {

it('blockquote (with bold, italic text, inline code)', () => {
mount(NcRichText, {
propsData: {
props: {
text: '> blockquote **bold text** _italic text_ `inline code`',
useMarkdown: true,
},
Expand All @@ -373,7 +373,7 @@ describe('NcRichText', () => {

it('blockquote (with several lines)', () => {
mount(NcRichText, {
propsData: {
props: {
text: '> line 1\nline 2\n line 3',
useMarkdown: true,
},
Expand All @@ -384,7 +384,7 @@ describe('NcRichText', () => {

it('blockquote (divided from normal text)', () => {
mount(NcRichText, {
propsData: {
props: {
text: 'normal text\n> line 1\nline 2\n\nnormal text',
useMarkdown: true,
},
Expand All @@ -395,7 +395,7 @@ describe('NcRichText', () => {

it('blockquote (with several paragraphs)', () => {
mount(NcRichText, {
propsData: {
props: {
text: '> line 1\n>\n> line 3',
useMarkdown: true,
},
Expand All @@ -406,7 +406,7 @@ describe('NcRichText', () => {

it('blockquote (with nested blockquote)', () => {
mount(NcRichText, {
propsData: {
props: {
text: '> blockquote\n>\n>> nested blockquote',
useMarkdown: true,
},
Expand All @@ -425,7 +425,7 @@ describe('NcRichText', () => {
]

mount(NcRichText, {
propsData: {
props: {
text: testCases.map(i => i.input).join('\n'),
useMarkdown: true,
},
Expand All @@ -446,7 +446,7 @@ describe('NcRichText', () => {
]

mount(NcRichText, {
propsData: {
props: {
text: testCases.map(i => i.input).join('\n'),
useMarkdown: true,
},
Expand All @@ -467,7 +467,7 @@ describe('NcRichText', () => {
]

mount(NcRichText, {
propsData: {
props: {
text: testCases.map(i => i.input).join('\n'),
useMarkdown: true,
},
Expand All @@ -483,7 +483,7 @@ describe('NcRichText', () => {
describe('dividers', () => {
it('dividers (with different syntax)', () => {
mount(NcRichText, {
propsData: {
props: {
text: '***\n---\n___',
useMarkdown: true,
},
Expand Down
12 changes: 1 addition & 11 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/

const ignorePatterns = [
'@ckpack/vue-color',
'ansi-regex',
'bail',
'char-regex',
Expand Down Expand Up @@ -72,17 +73,6 @@ module.exports = {
transformIgnorePatterns: [
'/node_modules/(?!(' + ignorePatterns.join('|') + '))',
],
// Temporarily exclude not yet migrated vue2 components
testPathIgnorePatterns: [
"/node_modules/",
"<rootDir>/tests/unit/components/NcActions",
"<rootDir>/tests/unit/components/NcAppNavigation",
"<rootDir>/tests/unit/components/NcAppSidebar",
"<rootDir>/tests/unit/components/NcModal",
"<rootDir>/tests/unit/components/NcRichContenteditable",
"<rootDir>/tests/unit/components/NcRichText",
"<rootDir>/tests/unit/mixins/",
],

moduleNameMapper: {
'\\.(css|scss)$': 'jest-transform-stub',
Expand Down
Loading

0 comments on commit e0e34b5

Please sign in to comment.