@@ -19,75 +19,75 @@ class RenderBlockContent_CapitalizationTests: XCTestCase {
19
19
// Text, Emphasis, Strong are all auto-capitalized, and everything else defaults to not capitalized.
20
20
21
21
func testRenderInlineContentText( ) {
22
- let text = RenderInlineContent . text ( " hello, world! " ) . withFirstWordCapitalized
22
+ let text = RenderInlineContent . text ( " hello, world! " ) . capitalizingFirstWord ( )
23
23
XCTAssertEqual ( " Hello, world! " , text. plainText)
24
24
}
25
25
26
26
func testRenderInlineContentEmphasis( ) {
27
- let emphasis = RenderInlineContent . emphasis ( inlineContent: [ . text( " hello, world! " ) ] ) . withFirstWordCapitalized
27
+ let emphasis = RenderInlineContent . emphasis ( inlineContent: [ . text( " hello, world! " ) ] ) . capitalizingFirstWord ( )
28
28
XCTAssertEqual ( " Hello, world! " , emphasis. plainText)
29
29
}
30
30
31
31
func testRenderInlineContentStrong( ) {
32
- let strong = RenderInlineContent . strong ( inlineContent: [ . text( " hello, world! " ) ] ) . withFirstWordCapitalized
32
+ let strong = RenderInlineContent . strong ( inlineContent: [ . text( " hello, world! " ) ] ) . capitalizingFirstWord ( )
33
33
XCTAssertEqual ( " Hello, world! " , strong. plainText)
34
34
}
35
35
36
36
func testRenderInlineContentCodeVoice( ) {
37
- let codeVoice = RenderInlineContent . codeVoice ( code: " code voice " ) . withFirstWordCapitalized
37
+ let codeVoice = RenderInlineContent . codeVoice ( code: " code voice " ) . capitalizingFirstWord ( )
38
38
XCTAssertEqual ( " code voice " , codeVoice. plainText)
39
39
}
40
40
41
41
func testRenderInlineContentReference( ) {
42
- let reference = RenderInlineContent . reference ( identifier: . init( " Test " ) , isActive: true , overridingTitle: " hello, world! " , overridingTitleInlineContent: [ . text( " hello, world! " ) ] ) . withFirstWordCapitalized
42
+ let reference = RenderInlineContent . reference ( identifier: . init( " Test " ) , isActive: true , overridingTitle: " hello, world! " , overridingTitleInlineContent: [ . text( " hello, world! " ) ] ) . capitalizingFirstWord ( )
43
43
XCTAssertEqual ( " hello, world! " , reference. plainText)
44
44
}
45
45
46
46
func testRenderInlineContentNewTerm( ) {
47
- let newTerm = RenderInlineContent . newTerm ( inlineContent: [ . text( " helloWorld " ) ] ) . withFirstWordCapitalized
47
+ let newTerm = RenderInlineContent . newTerm ( inlineContent: [ . text( " helloWorld " ) ] ) . capitalizingFirstWord ( )
48
48
XCTAssertEqual ( " helloWorld " , newTerm. plainText)
49
49
}
50
50
51
51
func testRenderInlineContentInlineHead( ) {
52
- let inlineHead = RenderInlineContent . inlineHead ( inlineContent: [ . text( " hello, world! " ) ] ) . withFirstWordCapitalized
52
+ let inlineHead = RenderInlineContent . inlineHead ( inlineContent: [ . text( " hello, world! " ) ] ) . capitalizingFirstWord ( )
53
53
XCTAssertEqual ( " hello, world! " , inlineHead. plainText)
54
54
}
55
55
56
56
func testRenderInlineContentSubscript( ) {
57
- let subscriptContent = RenderInlineContent . subscript ( inlineContent: [ . text( " hello, world! " ) ] ) . withFirstWordCapitalized
57
+ let subscriptContent = RenderInlineContent . subscript ( inlineContent: [ . text( " hello, world! " ) ] ) . capitalizingFirstWord ( )
58
58
XCTAssertEqual ( " hello, world! " , subscriptContent. plainText)
59
59
}
60
60
61
61
func testRenderInlineContentSuperscript( ) {
62
- let superscriptContent = RenderInlineContent . superscript ( inlineContent: [ . text( " hello, world! " ) ] ) . withFirstWordCapitalized
62
+ let superscriptContent = RenderInlineContent . superscript ( inlineContent: [ . text( " hello, world! " ) ] ) . capitalizingFirstWord ( )
63
63
XCTAssertEqual ( " hello, world! " , superscriptContent. plainText)
64
64
}
65
65
66
66
func testRenderInlineContentStrikethrough( ) {
67
- let strikethrough = RenderInlineContent . strikethrough ( inlineContent: [ . text( " hello, world! " ) ] ) . withFirstWordCapitalized
67
+ let strikethrough = RenderInlineContent . strikethrough ( inlineContent: [ . text( " hello, world! " ) ] ) . capitalizingFirstWord ( )
68
68
XCTAssertEqual ( " hello, world! " , strikethrough. plainText)
69
69
}
70
70
71
71
// MARK: - Blocks
72
72
// Paragraphs, asides, headings, and small content are all auto-capitalized, and everything else defaults to not capitalized.
73
73
74
74
func testRenderBlockContentParagraph( ) {
75
- let paragraph = RenderBlockContent . paragraph ( . init( inlineContent: [ . text( " hello, world! " ) ] ) ) . withFirstWordCapitalized
75
+ let paragraph = RenderBlockContent . paragraph ( . init( inlineContent: [ . text( " hello, world! " ) ] ) ) . capitalizingFirstWord ( )
76
76
XCTAssertEqual ( " Hello, world! " , paragraph. rawIndexableTextContent ( references: [ : ] ) )
77
77
}
78
78
79
79
func testRenderBlockContentAside( ) {
80
- let aside = RenderBlockContent . aside ( . init( style: . init( rawValue: " Experiment " ) , content: [ . paragraph( . init( inlineContent: [ . text( " hello, world! " ) ] ) ) ] ) ) . withFirstWordCapitalized
80
+ let aside = RenderBlockContent . aside ( . init( style: . init( rawValue: " Experiment " ) , content: [ . paragraph( . init( inlineContent: [ . text( " hello, world! " ) ] ) ) ] ) ) . capitalizingFirstWord ( )
81
81
XCTAssertEqual ( " Hello, world! " , aside. rawIndexableTextContent ( references: [ : ] ) )
82
82
}
83
83
84
84
func testRenderBlockContentSmall( ) {
85
- let small = RenderBlockContent . small ( . init( inlineContent: [ . text( " hello, world! " ) ] ) ) . withFirstWordCapitalized
85
+ let small = RenderBlockContent . small ( . init( inlineContent: [ . text( " hello, world! " ) ] ) ) . capitalizingFirstWord ( )
86
86
XCTAssertEqual ( " Hello, world! " , small. rawIndexableTextContent ( references: [ : ] ) )
87
87
}
88
88
89
89
func testRenderBlockContentHeading( ) {
90
- let heading = RenderBlockContent . heading ( . init( level: 1 , text: " hello, world! " , anchor: " hi " ) ) . withFirstWordCapitalized
90
+ let heading = RenderBlockContent . heading ( . init( level: 1 , text: " hello, world! " , anchor: " hi " ) ) . capitalizingFirstWord ( )
91
91
XCTAssertEqual ( " Hello, world! " , heading. rawIndexableTextContent ( references: [ : ] ) )
92
92
}
93
93
@@ -99,12 +99,12 @@ class RenderBlockContent_CapitalizationTests: XCTestCase {
99
99
. init( content: [
100
100
. paragraph( . init( inlineContent: [ . text( " world! " ) ] ) ) ,
101
101
] ) ,
102
- ] ) ) . withFirstWordCapitalized
102
+ ] ) ) . capitalizingFirstWord ( )
103
103
XCTAssertEqual ( " hello, world! " , list. rawIndexableTextContent ( references: [ : ] ) )
104
104
}
105
105
106
106
func testRenderBlockContentStep( ) {
107
- let step = RenderBlockContent . step ( . init( content: [ . paragraph( . init( inlineContent: [ . text( " hello, world! " ) ] ) ) ] , caption: [ . paragraph( . init( inlineContent: [ . text( " Step caption " ) ] ) ) ] , media: RenderReferenceIdentifier ( " Media " ) , code: RenderReferenceIdentifier ( " Code " ) , runtimePreview: RenderReferenceIdentifier ( " Preview " ) ) ) . withFirstWordCapitalized
107
+ let step = RenderBlockContent . step ( . init( content: [ . paragraph( . init( inlineContent: [ . text( " hello, world! " ) ] ) ) ] , caption: [ . paragraph( . init( inlineContent: [ . text( " Step caption " ) ] ) ) ] , media: RenderReferenceIdentifier ( " Media " ) , code: RenderReferenceIdentifier ( " Code " ) , runtimePreview: RenderReferenceIdentifier ( " Preview " ) ) ) . capitalizingFirstWord ( )
108
108
XCTAssertEqual ( " hello, world! Step caption " , step. rawIndexableTextContent ( references: [ : ] ) )
109
109
}
110
110
@@ -117,7 +117,7 @@ class RenderBlockContent_CapitalizationTests: XCTestCase {
117
117
. init( content: [
118
118
. paragraph( . init( inlineContent: [ . text( " world! " ) ] ) ) ,
119
119
] ) ,
120
- ] ) ) . withFirstWordCapitalized
120
+ ] ) ) . capitalizingFirstWord ( )
121
121
XCTAssertEqual ( " hello, world! " , list. rawIndexableTextContent ( references: [ : ] ) )
122
122
}
123
123
0 commit comments