fix: html decoder ignores h4-h6 tags (#932)

This commit is contained in:
Lucas 2024-10-16 10:22:40 +08:00 • committed by GitHub
commit 35f0f66370
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -304,4 +304,22 @@ void main() {
],
);
});
test('sample 11', () {
const html = '''
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
''';
final document = htmlToDocument(html);
for (var i = 1; i <= 6; i++) {
final node = document.nodeAtPath([i - 1]);
expect(node!.type, HeadingBlockKeys.type);
expect(node.delta!.toPlainText(), 'Heading $i');
expect(node.attributes[HeadingBlockKeys.level], i);
}
});
}