@@ -12,7 +12,7 @@ import XCTest
12
12
final class HTMLElementMarkupComponentMarkupStyleVisitorTests : XCTestCase {
13
13
14
14
func testDefaultStyleByDefault( ) {
15
- let visitor = HTMLElementMarkupComponentMarkupStyleVisitor ( policy: . respectMarkupStyleFromCode, components: [ ] , styleAttributes: [ ] , rootStyle: nil )
15
+ let visitor = HTMLElementMarkupComponentMarkupStyleVisitor ( policy: . respectMarkupStyleFromCode, components: [ ] , styleAttributes: [ ] , classAttributes : [ ] , idAttributes : [ ] , rootStyle: nil )
16
16
17
17
let result = visitor. visit ( markup: HeadMarkup ( level: . h1) )
18
18
XCTAssertEqual ( result? . font. size, MarkupStyle . h1. font. size)
@@ -21,7 +21,7 @@ final class HTMLElementMarkupComponentMarkupStyleVisitorTests: XCTestCase {
21
21
func testDefaultStyleByCustomStyle( ) {
22
22
let markup = InlineMarkup ( )
23
23
let customStyle = MarkupStyle ( font: . init( size: 99 ) )
24
- let visitor = HTMLElementMarkupComponentMarkupStyleVisitor ( policy: . respectMarkupStyleFromCode, components: [ . init( markup: markup, value: . init( tag: . init( tagName: H1_HTMLTagName ( ) , customStyle: customStyle) , tagAttributedString: NSAttributedString ( string: " <span>test</span> " ) , attributes: [ : ] ) ) ] , styleAttributes: [ ] , rootStyle: nil )
24
+ let visitor = HTMLElementMarkupComponentMarkupStyleVisitor ( policy: . respectMarkupStyleFromCode, components: [ . init( markup: markup, value: . init( tag: . init( tagName: H1_HTMLTagName ( ) , customStyle: customStyle) , tagAttributedString: NSAttributedString ( string: " <span>test</span> " ) , attributes: [ : ] ) ) ] , styleAttributes: [ ] , classAttributes : [ ] , idAttributes : [ ] , rootStyle: nil )
25
25
26
26
let result = visitor. visit ( markup: markup)
27
27
XCTAssertEqual ( result? . font. size, customStyle. font. size)
@@ -30,15 +30,15 @@ final class HTMLElementMarkupComponentMarkupStyleVisitorTests: XCTestCase {
30
30
func testDefaultStyleShouldOverrideByCustomStyle( ) {
31
31
let markup = HeadMarkup ( level: . h1)
32
32
let customStyle = MarkupStyle ( font: . init( size: 99 ) )
33
- let visitor = HTMLElementMarkupComponentMarkupStyleVisitor ( policy: . respectMarkupStyleFromCode, components: [ . init( markup: markup, value: . init( tag: . init( tagName: H1_HTMLTagName ( ) , customStyle: customStyle) , tagAttributedString: NSAttributedString ( string: " <h1>test</h1> " ) , attributes: [ : ] ) ) ] , styleAttributes: [ ] , rootStyle: nil )
33
+ let visitor = HTMLElementMarkupComponentMarkupStyleVisitor ( policy: . respectMarkupStyleFromCode, components: [ . init( markup: markup, value: . init( tag: . init( tagName: H1_HTMLTagName ( ) , customStyle: customStyle) , tagAttributedString: NSAttributedString ( string: " <h1>test</h1> " ) , attributes: [ : ] ) ) ] , styleAttributes: [ ] , classAttributes : [ ] , idAttributes : [ ] , rootStyle: nil )
34
34
35
35
let result = visitor. visit ( markup: markup)
36
36
XCTAssertEqual ( result? . font. size, customStyle. font. size)
37
37
}
38
38
39
39
func testDefaultStyleShouldOverrideByStyleAttributed( ) {
40
40
let markup = HeadMarkup ( level: . h1)
41
- let visitor = HTMLElementMarkupComponentMarkupStyleVisitor ( policy: . respectMarkupStyleFromCode, components: [ . init( markup: markup, value: . init( tag: . init( tagName: H1_HTMLTagName ( ) ) , tagAttributedString: NSAttributedString ( string: " <h1>test</h1> " ) , attributes: [ " style " : " font-size:99pt " ] ) ) ] , styleAttributes: [ FontSizeHTMLTagStyleAttribute ( ) ] , rootStyle: nil )
41
+ let visitor = HTMLElementMarkupComponentMarkupStyleVisitor ( policy: . respectMarkupStyleFromCode, components: [ . init( markup: markup, value: . init( tag: . init( tagName: H1_HTMLTagName ( ) ) , tagAttributedString: NSAttributedString ( string: " <h1>test</h1> " ) , attributes: [ " style " : " font-size:99pt " ] ) ) ] , styleAttributes: [ FontSizeHTMLTagStyleAttribute ( ) ] , classAttributes : [ ] , idAttributes : [ ] , rootStyle: nil )
42
42
43
43
let result = visitor. visit ( markup: markup)
44
44
XCTAssertEqual ( result? . font. size, 99 )
@@ -47,7 +47,7 @@ final class HTMLElementMarkupComponentMarkupStyleVisitorTests: XCTestCase {
47
47
func testDefaultStylePolicyRespectMarkupStyleFromCode( ) {
48
48
let markup = HeadMarkup ( level: . h1)
49
49
let customStyle = MarkupStyle ( font: . init( size: 109 ) )
50
- let visitor = HTMLElementMarkupComponentMarkupStyleVisitor ( policy: . respectMarkupStyleFromCode, components: [ . init( markup: markup, value: . init( tag: . init( tagName: H1_HTMLTagName ( ) , customStyle: customStyle) , tagAttributedString: NSAttributedString ( string: " <h1>test</h1> " ) , attributes: [ " style " : " font-size:99pt " ] ) ) ] , styleAttributes: [ FontSizeHTMLTagStyleAttribute ( ) ] , rootStyle: nil )
50
+ let visitor = HTMLElementMarkupComponentMarkupStyleVisitor ( policy: . respectMarkupStyleFromCode, components: [ . init( markup: markup, value: . init( tag: . init( tagName: H1_HTMLTagName ( ) , customStyle: customStyle) , tagAttributedString: NSAttributedString ( string: " <h1>test</h1> " ) , attributes: [ " style " : " font-size:99pt " ] ) ) ] , styleAttributes: [ FontSizeHTMLTagStyleAttribute ( ) ] , classAttributes : [ ] , idAttributes : [ ] , rootStyle: nil )
51
51
52
52
let result = visitor. visit ( markup: markup)
53
53
XCTAssertEqual ( result? . font. size, customStyle. font. size)
@@ -56,7 +56,7 @@ final class HTMLElementMarkupComponentMarkupStyleVisitorTests: XCTestCase {
56
56
func testDefaultStylePolicyRespectMarkupStyleFromHTMLStyleAttribute( ) {
57
57
let markup = HeadMarkup ( level: . h1)
58
58
let customStyle = MarkupStyle ( font: . init( size: 109 ) )
59
- let visitor = HTMLElementMarkupComponentMarkupStyleVisitor ( policy: . respectMarkupStyleFromHTMLStyleAttribute, components: [ . init( markup: markup, value: . init( tag: . init( tagName: H1_HTMLTagName ( ) , customStyle: customStyle) , tagAttributedString: NSAttributedString ( string: " <h1>test</h1> " ) , attributes: [ " style " : " font-size:99pt " ] ) ) ] , styleAttributes: [ FontSizeHTMLTagStyleAttribute ( ) ] , rootStyle: nil )
59
+ let visitor = HTMLElementMarkupComponentMarkupStyleVisitor ( policy: . respectMarkupStyleFromHTMLStyleAttribute, components: [ . init( markup: markup, value: . init( tag: . init( tagName: H1_HTMLTagName ( ) , customStyle: customStyle) , tagAttributedString: NSAttributedString ( string: " <h1>test</h1> " ) , attributes: [ " style " : " font-size:99pt " ] ) ) ] , styleAttributes: [ FontSizeHTMLTagStyleAttribute ( ) ] , classAttributes : [ ] , idAttributes : [ ] , rootStyle: nil )
60
60
61
61
let result = visitor. visit ( markup: markup)
62
62
XCTAssertEqual ( result? . font. size, 99 )
0 commit comments