33 */
44
55import { useFormat } from '../src/use/format';
6- import { useRaw } from '../src/use/raw';
6+ import { bold, italic, useRaw } from '../src/use/raw';
77
8- describe('Raw', () => {
8+ describe('Raw - Editor Convert ', () => {
99 beforeEach(() => {});
1010
1111 it('should not convert unnecessary paragraph', () => {
@@ -21,4 +21,188 @@ describe('Raw', () => {
2121
2222 expect(entity.raw).toEqual(raw);
2323 })
24+
25+ it('should not convert unnecessary heading one', () => {
26+ const entity = {
27+ id: 0,
28+ type: 'heading-one',
29+ raw: 'Untitled',
30+ createdAt: useFormat().actually(),
31+ updatedAt: useFormat().actually(),
32+ };
33+
34+ const raw = useRaw().convert(entity);
35+
36+ expect(entity.raw).toEqual(raw);
37+ })
38+
39+ it('should not convert unnecessary heading two', () => {
40+ const entity = {
41+ id: 0,
42+ type: 'heading-two',
43+ raw: 'Untitled',
44+ createdAt: useFormat().actually(),
45+ updatedAt: useFormat().actually(),
46+ };
47+
48+ const raw = useRaw().convert(entity);
49+
50+ expect(entity.raw).toEqual(raw);
51+ })
52+
53+ it('should not convert unnecessary heading three', () => {
54+ const entity = {
55+ id: 0,
56+ type: 'heading-three',
57+ raw: 'Untitled',
58+ createdAt: useFormat().actually(),
59+ updatedAt: useFormat().actually(),
60+ };
61+
62+ const raw = useRaw().convert(entity);
63+
64+ expect(entity.raw).toEqual(raw);
65+ })
66+
67+ // italic
68+ it('should not convert italic in heading one', () => {
69+ const entity = {
70+ id: 0,
71+ type: 'heading-one',
72+ raw: 'Untitled *test* Untitled',
73+ createdAt: useFormat().actually(),
74+ updatedAt: useFormat().actually(),
75+ };
76+
77+ const raw = useRaw().convert(entity);
78+
79+ expect(entity.raw).toEqual(raw);
80+ })
81+
82+ it('should not convert italic in heading two', () => {
83+ const entity = {
84+ id: 0,
85+ type: 'heading-two',
86+ raw: 'Untitled *test* Untitled',
87+ createdAt: useFormat().actually(),
88+ updatedAt: useFormat().actually(),
89+ };
90+
91+ const raw = useRaw().convert(entity);
92+
93+ expect(entity.raw).toEqual(raw);
94+ })
95+
96+ it('should not convert italic in heading three', () => {
97+ const entity = {
98+ id: 0,
99+ type: 'heading-three',
100+ raw: 'Untitled *test* Untitled',
101+ createdAt: useFormat().actually(),
102+ updatedAt: useFormat().actually(),
103+ };
104+
105+ const raw = useRaw().convert(entity);
106+
107+ expect(entity.raw).toEqual(raw);
108+ })
109+
110+ it('should correct bold convert', () => {
111+ const entity = {
112+ id: 0,
113+ type: 'paragraph',
114+ raw: 'Untitled *test* Untitled',
115+ createdAt: useFormat().actually(),
116+ updatedAt: useFormat().actually(),
117+ };
118+
119+ const raw = useRaw().convert(entity);
120+
121+ expect(`Untitled ${italic().open()}test${italic().close()} Untitled`).toEqual(raw);
122+ })
123+
124+ it('should not convert break italic insert', () => {
125+ const entity = {
126+ id: 0,
127+ type: 'paragraph',
128+ raw: 'Untitled *test Untitled',
129+ createdAt: useFormat().actually(),
130+ updatedAt: useFormat().actually(),
131+ };
132+
133+ const raw = useRaw().convert(entity);
134+
135+ expect(`Untitled ${italic().open()}test Untitled`).toEqual(raw);
136+ })
137+
138+ // bold
139+ it('should not convert bold in heading one', () => {
140+ const entity = {
141+ id: 0,
142+ type: 'heading-one',
143+ raw: 'Untitled &test& Untitled',
144+ createdAt: useFormat().actually(),
145+ updatedAt: useFormat().actually(),
146+ };
147+
148+ const raw = useRaw().convert(entity);
149+
150+ expect(entity.raw).toEqual(raw);
151+ })
152+
153+ it('should not convert bold in heading two', () => {
154+ const entity = {
155+ id: 0,
156+ type: 'heading-two',
157+ raw: 'Untitled &test& Untitled',
158+ createdAt: useFormat().actually(),
159+ updatedAt: useFormat().actually(),
160+ };
161+
162+ const raw = useRaw().convert(entity);
163+
164+ expect(entity.raw).toEqual(raw);
165+ })
166+
167+ it('should not convert bold in heading three', () => {
168+ const entity = {
169+ id: 0,
170+ type: 'heading-three',
171+ raw: 'Untitled &test& Untitled',
172+ createdAt: useFormat().actually(),
173+ updatedAt: useFormat().actually(),
174+ };
175+
176+ const raw = useRaw().convert(entity);
177+
178+ expect(entity.raw).toEqual(raw);
179+ })
180+
181+ it('should correct bold convert', () => {
182+ const entity = {
183+ id: 0,
184+ type: 'paragraph',
185+ raw: 'Untitled &test& Untitled',
186+ createdAt: useFormat().actually(),
187+ updatedAt: useFormat().actually(),
188+ };
189+
190+ const raw = useRaw().convert(entity);
191+
192+ expect(`Untitled ${bold().open()}test${bold().close()} Untitled`).toEqual(raw);
193+ })
194+
195+ it('should not convert break bold insert', () => {
196+ const entity = {
197+ id: 0,
198+ type: 'paragraph',
199+ raw: 'Untitled &test Untitled',
200+ createdAt: useFormat().actually(),
201+ updatedAt: useFormat().actually(),
202+ };
203+
204+ const raw = useRaw().convert(entity);
205+
206+ expect(`Untitled ${bold().open()}test Untitled`).toEqual(raw);
207+ })
24208})
0 commit comments