From e82e58497a789446d061f2c1032329ee1adad6cc Mon Sep 17 00:00:00 2001 From: Silvano Stralla Date: Tue, 21 Mar 2023 12:50:18 +0100 Subject: [PATCH] Add a test case that includes a mailto link --- .../__snapshots__/index.test.ts.snap | 6 +++ .../StructuredText/__tests__/index.test.ts | 38 ++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/components/StructuredText/__tests__/__snapshots__/index.test.ts.snap b/src/components/StructuredText/__tests__/__snapshots__/index.test.ts.snap index 5181fd5..d852f59 100644 --- a/src/components/StructuredText/__tests__/__snapshots__/index.test.ts.snap +++ b/src/components/StructuredText/__tests__/__snapshots__/index.test.ts.snap @@ -1,5 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`StructuredText dast including a mailto: link with default rules renders the document 1`] = ` +
+

test@test.com

+
+`; + exports[`StructuredText simple dast /2 with default rules renders the document 1`] = `

This
is a
title!

function greetings() {
diff --git a/src/components/StructuredText/__tests__/index.test.ts b/src/components/StructuredText/__tests__/index.test.ts
index 2bb85c8..762d0db 100644
--- a/src/components/StructuredText/__tests__/index.test.ts
+++ b/src/components/StructuredText/__tests__/index.test.ts
@@ -244,7 +244,7 @@ describe('StructuredText', () => {
         expect(() => {
           mount(StructuredText, {
             propsData: { data: structuredText },
-          });              
+          });
         }).toThrow(RenderError);
       });
     });
@@ -264,4 +264,40 @@ describe('StructuredText', () => {
       });
     });
   });
+
+  describe('dast including a mailto: link', () => {
+    const structuredText: StructuredTextDocument = {
+      schema: 'dast',
+      document: {
+        type: 'root',
+        children: [
+          {
+            type: 'paragraph',
+            children: [
+              {
+                url: 'mailto:test@tests.com',
+                type: 'link',
+                children: [
+                  {
+                    type: 'span',
+                    value: 'test@test.com',
+                  },
+                ],
+              },
+            ],
+          },
+        ],
+      },
+    };
+
+    describe('with default rules', () => {
+      it('renders the document', () => {
+        const wrapper = mount(StructuredText, {
+          propsData: { data: structuredText },
+        });
+        // await wrapper.vm.$nextTick();
+        expect(wrapper.html()).toMatchSnapshot();
+      });
+    });
+  });
 });