@@ -3,11 +3,37 @@ import {test, expect} from '@playwright/test';
3
3
import * as TEST_CONST from '../../example/src/testConstants' ;
4
4
import { getElementValue , setCursorPosition , setupInput , testMarkdownContentStyle } from './utils' ;
5
5
6
+ const CODEBLOCK_DEFAULT_STYLE = 'border-radius: 4px; padding: 0px; font-family: monospace; font-size: 20px; color: black;' ;
7
+
6
8
test . beforeEach ( async ( { page} ) => {
7
9
await page . goto ( TEST_CONST . LOCAL_URL , { waitUntil : 'load' } ) ;
8
10
} ) ;
9
11
10
- test . describe ( 'typing' , ( ) => {
12
+ test . describe ( 'modyfying codeblock content' , ( ) => {
13
+ test ( 'codeblock content wrapping' , async ( { page} ) => {
14
+ const LINE_TO_ADD = ' very long line of code that should be wrapped' ;
15
+ const inputLocator = await setupInput ( page , 'clear' ) ;
16
+ await inputLocator . focus ( ) ;
17
+ await inputLocator . pressSequentially ( '```\nCodeblock\nSample code line\n```' ) ;
18
+
19
+ await setCursorPosition ( page , 3 ) ;
20
+
21
+ await inputLocator . pressSequentially ( LINE_TO_ADD ) ;
22
+
23
+ expect ( await getElementValue ( inputLocator ) ) . toEqual ( `\`\`\`\nCodeblock${ LINE_TO_ADD } \nSample code line\n\`\`\`` ) ;
24
+
25
+ // Verify if the codeblock style wasn't appleid
26
+ await testMarkdownContentStyle ( {
27
+ testContent : 'codeblock' ,
28
+ style : CODEBLOCK_DEFAULT_STYLE ,
29
+ pseudoStyle : {
30
+ height : '108px' ,
31
+ width : '246px' ,
32
+ } ,
33
+ page,
34
+ } ) ;
35
+ } ) ;
36
+
11
37
test ( 'typing after codeblock opening syntax' , async ( { page} ) => {
12
38
const inputLocator = await setupInput ( page , 'clear' ) ;
13
39
await inputLocator . focus ( ) ;
@@ -40,7 +66,7 @@ test.describe('typing', () => {
40
66
// Verify if the codeblock style is applied correctly after cahnges
41
67
await testMarkdownContentStyle ( {
42
68
testContent : 'codeblock' ,
43
- style : 'border-radius: 4px; padding: 0px; font-family: monospace; font-size: 20px; color: black;' ,
69
+ style : CODEBLOCK_DEFAULT_STYLE ,
44
70
pseudoStyle : {
45
71
height : '82px' ,
46
72
width : '197px' ,
@@ -52,7 +78,7 @@ test.describe('typing', () => {
52
78
test ( 'typing after codeblock closing syntax' , async ( { page} ) => {
53
79
const styleProperties = {
54
80
testContent : 'codeblock' ,
55
- style : 'border-radius: 4px; padding: 0px; font-family: monospace; font-size: 20px; color: black;' ,
81
+ style : CODEBLOCK_DEFAULT_STYLE ,
56
82
pseudoStyle : {
57
83
height : '56px' ,
58
84
width : '197px' ,
0 commit comments