@@ -184,6 +184,10 @@ void main() async {
184184 Selection .single (path: [0 ], startOffset: 0 ),
185185 );
186186
187+ await editor.insertText (textNode, '>' , 0 );
188+ await editor.pressLogicKey (LogicalKeyboardKey .space);
189+ expect (textNode.subtype, BuiltInAttributeKey .quote);
190+
187191 await editor.insertText (textNode, '*' , 0 );
188192 await editor.pressLogicKey (LogicalKeyboardKey .space);
189193 expect (textNode.subtype, BuiltInAttributeKey .bulletedList);
@@ -227,5 +231,65 @@ void main() async {
227231 expect (textNode.subtype, null );
228232 expect (textNode.toPlainText (), text);
229233 });
234+
235+ group ('convert geater to blockquote' , () {
236+ testWidgets ('> AppFlowy to blockquote AppFlowy' , (tester) async {
237+ const text = 'AppFlowy' ;
238+ final editor = tester.editor..insertTextNode ('' );
239+ await editor.startTesting ();
240+ await editor.updateSelection (
241+ Selection .single (path: [0 ], startOffset: 0 ),
242+ );
243+
244+ final textNode = editor.nodeAtPath ([0 ]) as TextNode ;
245+ await editor.insertText (textNode, '>' , 0 );
246+ await editor.pressLogicKey (LogicalKeyboardKey .space);
247+ expect (textNode.subtype, BuiltInAttributeKey .quote);
248+ for (var i = 0 ; i < text.length; i++ ) {
249+ await editor.insertText (textNode, text[i], i);
250+ }
251+ expect (textNode.toPlainText (), 'AppFlowy' );
252+ });
253+
254+ testWidgets ('AppFlowy > nothing changes' , (tester) async {
255+ const text = 'AppFlowy >' ;
256+ final editor = tester.editor..insertTextNode ('' );
257+ await editor.startTesting ();
258+ await editor.updateSelection (
259+ Selection .single (path: [0 ], startOffset: 0 ),
260+ );
261+
262+ final textNode = editor.nodeAtPath ([0 ]) as TextNode ;
263+ for (var i = 0 ; i < text.length; i++ ) {
264+ await editor.insertText (textNode, text[i], i);
265+ }
266+ await editor.pressLogicKey (LogicalKeyboardKey .space);
267+ final isQuote = textNode.subtype == BuiltInAttributeKey .quote;
268+ expect (isQuote, false );
269+ expect (textNode.toPlainText (), text);
270+ });
271+
272+ testWidgets ('> in front of text to blockquote' , (tester) async {
273+ const text = 'AppFlowy' ;
274+ final editor = tester.editor..insertTextNode ('' );
275+ await editor.startTesting ();
276+ await editor.updateSelection (
277+ Selection .single (path: [0 ], startOffset: 0 ),
278+ );
279+ final textNode = editor.nodeAtPath ([0 ]) as TextNode ;
280+ for (var i = 0 ; i < text.length; i++ ) {
281+ await editor.insertText (textNode, text[i], i);
282+ }
283+ await editor.updateSelection (
284+ Selection .single (path: [0 ], startOffset: 0 ),
285+ );
286+ await editor.insertText (textNode, '>' , 0 );
287+ await editor.pressLogicKey (LogicalKeyboardKey .space);
288+
289+ final isQuote = textNode.subtype == BuiltInAttributeKey .quote;
290+ expect (isQuote, true );
291+ expect (textNode.toPlainText (), text);
292+ });
293+ });
230294 });
231295}
0 commit comments