|
99 | 99 | expect(property2.isEmpty, isFalse); |
100 | 100 | expect(property2.isNotEmpty, isTrue); |
101 | 101 | }); |
| 102 | + test('real and invalid value property', () { |
| 103 | + final result = parser.parse(''':FOOBAR: |
| 104 | +:foo:k |
| 105 | +:foo: bar |
| 106 | +:END:'''); |
| 107 | + final drawer = result.value as OrgDrawer; |
| 108 | + expect(drawer.properties().length, 1); |
| 109 | + final body = drawer.body; |
| 110 | + final invalid = body.children[0] as OrgPlainText; |
| 111 | + expect(invalid.content, ':foo:k\n'); |
| 112 | + final valid = body.children[1] as OrgProperty; |
| 113 | + expect(valid.key, ':foo:'); |
| 114 | + expect(valid.isEmpty, isFalse); |
| 115 | + expect(valid.isNotEmpty, isTrue); |
| 116 | + expect(valid.value!.toMarkup(), 'bar'); |
| 117 | + }); |
| 118 | + test('property and text run', () { |
| 119 | + final result = parser.parse(''':FOOBAR: |
| 120 | +a *b* /c/ |
| 121 | +:foo: bar |
| 122 | +:END:'''); |
| 123 | + final drawer = result.value as OrgDrawer; |
| 124 | + expect(drawer.properties().length, 1); |
| 125 | + final body = drawer.body; |
| 126 | + final first = body.children[0] as OrgPlainText; |
| 127 | + expect(first.content, 'a '); |
| 128 | + final second = body.children[1] as OrgMarkup; |
| 129 | + expect(second.style, OrgStyle.bold); |
| 130 | + expect(second.toMarkup(), '*b*'); |
| 131 | + final third = body.children[3] as OrgMarkup; |
| 132 | + expect(third.style, OrgStyle.italic); |
| 133 | + expect(third.toMarkup(), '/c/'); |
| 134 | + final property = body.children[5] as OrgProperty; |
| 135 | + expect(property.key, ':foo:'); |
| 136 | + expect(property.isEmpty, isFalse); |
| 137 | + expect(property.isNotEmpty, isTrue); |
| 138 | + expect(property.value!.toMarkup(), 'bar'); |
| 139 | + }); |
102 | 140 | }); |
103 | 141 | } |
0 commit comments