In #2110 a way to parse YAML-strings to a structured tree is introduced.
We should rewrite the unit tests that build and compare trees to use this new functionality.
Example:
it( "can build a tree from HTML source code", () => {
const html = "<section>This? is a section.</section>";
const paragraph = new Paragraph();
paragraph.sourceStartIndex = 9;
paragraph.sourceEndIndex = 28;
paragraph.text = "This? is a section.";
const section = new StructuredNode( "section" );
section.sourceStartIndex = 0;
section.sourceEndIndex = 38;
section.children = [ paragraph ];
const expected = new StructuredNode( "root" );
expected.sourceStartIndex = 0;
expected.sourceEndIndex = 38;
expected.children = [ section ];
const tree = buildTree( html );
expect( tree.toString() ).toEqual( expected.toString() );
} );
Should be transformed to:
it( "can build a tree from HTML source code", () => {
const html = "<section>This? is a section.</section>";
cons expected = buildTreeFromYaml`
Structured:
tag: root
sourceStartIndex: 9
sourceEndIndex: 38
children:
- Structured:
tag: section
sourceStartIndex: 0
sourceEndIndex: 38
children:
- Paragraph:
sourceStartIndex: 9
sourceEndIndex: 28
text: This? is a section.
`;
const tree = buildTree( html );
expect( tree.toString() ).toEqual( expected.toString() );
} );
In #2110 a way to parse YAML-strings to a structured tree is introduced. We should rewrite the unit tests that build and compare trees to use this new functionality.
Example:
Should be transformed to:
requires #2081