import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('customer html document test', () {
test('paste text from ChatGPT', () {
const html = '''
Key Pain Points & Challenges
-
Accuracy, Hallucinations & Omissions
-
AI may mis-transcribe or “hallucinate” content (i.e. generate text that was never spoken). In high-stakes settings (e.g. medical, legal) this is especially risky. Elite Asia+5AP News+5WIRED+5
-
Technical jargon, acronyms, domain-specific vocabulary, accents, dialects, or overlapping speech still lead to high error rates. blog.huddles.app+3go.verbit.ai+3eff-inc.com+3
-
Silence, nonverbal cues, or pauses are sometimes incorrectly annotated or filled. blog.huddles.app+1
''';
final document = htmlToDocument(html);
final children = document.root.children;
expect(children.length, 2);
// heading 2 - Key Pain Points & Challenges
expect(children[0].type, HeadingBlockKeys.type);
expect(children[0].delta!.toPlainText(), 'Key Pain Points & Challenges');
// numbered list - Accuracy, Hallucinations & Omissions
expect(children[1].type, NumberedListBlockKeys.type);
expect(
children[1].delta!.toPlainText(),
'Accuracy, Hallucinations & Omissions',
);
// its children - 3 bulleted list items
final children1 = children[1].children;
expect(children1.length, 3);
expect(
children1.every((child) => child.type == BulletedListBlockKeys.type),
isTrue,
);
});
test('paste text with an inline HTML comment does not leak comment text',
() {
// Some sites (e.g. Google Search AI Overview) inject an HTML comment
// into copied content as an internal marker. It must not surface as
// visible text, regardless of what the comment contains.
const html = '''
First answer
Second answer
''';
final document = htmlToDocument(html);
final children = document.root.children;
expect(children[0].delta!.toPlainText(), 'First answer');
expect(children[1].delta!.toPlainText(), 'Second answer');
});
});
}