-
Notifications
You must be signed in to change notification settings - Fork 350
/
Copy pathMarkdownListTests.swift
140 lines (110 loc) · 3.1 KB
/
MarkdownListTests.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#if os(iOS)
import SnapshotTesting
import SwiftUI
import XCTest
import MarkdownUI
final class MarkdownListTests: XCTestCase {
private let layout = SwiftUISnapshotLayout.device(config: .iPhone8)
override func setUpWithError() throws {
try XCTSkipIf(UIDevice.current.userInterfaceIdiom == .pad, "Skipping on Mac Catalyst")
}
func testTaskList() {
let view = Markdown {
#"""
- [x] A finished task
- [ ] An unfinished task
- [ ] Another unfinished task
"""#
}
.border(Color.accentColor)
.padding()
assertSnapshot(of: view, as: .image(layout: layout))
}
func testBulletedList() {
let view = Markdown {
#"""
* Systems
* FFF units
* Great Underground Empire (Zork)
* Potrzebie
* Equals the thickness of Mad issue 26
* Developed by 19-year-old Donald E. Knuth
"""#
}
.border(Color.accentColor)
.padding()
assertSnapshot(of: view, as: .image(layout: layout))
}
func testBulletedDashedList() {
let view = Markdown {
#"""
* Systems
* FFF units
* Great Underground Empire (Zork)
* Potrzebie
* Equals the thickness of Mad issue 26
* Developed by 19-year-old Donald E. Knuth
"""#
}
.border(Color.accentColor)
.padding()
.markdownBulletedListMarker(.dash)
assertSnapshot(of: view, as: .image(layout: layout))
}
func testNumberedList() {
let view = Markdown {
#"""
This is an incomplete list of headgear:
1. Hats
1. Caps
1. Bonnets
Some more:
10. Helmets
1. Hoods
1. Headbands, headscarves, wimples
A list with a high start:
999. The sky above the port was the color of television, tuned to a dead channel.
1. It was a bright cold day in April, and the clocks were striking thirteen.
"""#
}
.border(Color.accentColor)
.padding()
assertSnapshot(of: view, as: .image(layout: layout))
}
func testRomanNumberedList() {
let view = Markdown {
#"""
This is an incomplete list of headgear:
1. Hats
1. Caps
1. Bonnets
A list with a high start:
999. The sky above the port was the color of television, tuned to a dead channel.
1. It was a bright cold day in April, and the clocks were striking thirteen.
"""#
}
.border(Color.accentColor)
.padding()
.markdownNumberedListMarker(.lowerRoman)
assertSnapshot(of: view, as: .image(layout: layout))
}
func testLooseList() {
let view = Markdown {
#"""
A loose list:
1. Hats
1. Caps
1. Bonnets
Another loose list:
1. Hats
1. Caps
1. Bonnets
This paragraph makes the list loose.
"""#
}
.border(Color.accentColor)
.padding()
assertSnapshot(of: view, as: .image(layout: layout))
}
}
#endif