From f9860c54a9e9ae7b0f529c6cf4e607256b85bb60 Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Thu, 8 Oct 2020 14:39:44 +0200 Subject: [PATCH] test bold and link regex --- .../integration/extensions/bold.spec.ts | 26 +++++++++++++++++++ .../integration/extensions/link.spec.ts | 11 ++++++++ 2 files changed, 37 insertions(+) create mode 100644 tests/cypress/integration/extensions/bold.spec.ts create mode 100644 tests/cypress/integration/extensions/link.spec.ts diff --git a/tests/cypress/integration/extensions/bold.spec.ts b/tests/cypress/integration/extensions/bold.spec.ts new file mode 100644 index 00000000..16ec952f --- /dev/null +++ b/tests/cypress/integration/extensions/bold.spec.ts @@ -0,0 +1,26 @@ +/// + +import { + starInputRegex, + starPasteRegex, + underscoreInputRegex, + underscorePasteRegex, +} from '@tiptap/extension-bold' + +describe('bold regex test', () => { + it('star input regex matches', () => { + expect('**Test**').to.match(starInputRegex) + }) + + it('star paste regex matches', () => { + expect('**Test**').to.match(starPasteRegex) + }) + + it('underscore input regex matches', () => { + expect('__Test__').to.match(underscoreInputRegex) + }) + + it('underscore paste regex matches', () => { + expect('__Test__').to.match(underscorePasteRegex) + }) +}) diff --git a/tests/cypress/integration/extensions/link.spec.ts b/tests/cypress/integration/extensions/link.spec.ts new file mode 100644 index 00000000..08f55add --- /dev/null +++ b/tests/cypress/integration/extensions/link.spec.ts @@ -0,0 +1,11 @@ +/// + +import { pasteRegex } from '@tiptap/extension-link' + +describe('link regex test', () => { + + it('paste regex matches url', () => { + expect('https://www.example.com/with-spaces?var=true&foo=bar+3').to.match(pasteRegex) + }) + +})