Skip to content

Commit

Permalink
Merge pull request #436 from EdgedSword/main
Browse files Browse the repository at this point in the history
  • Loading branch information
JPToroDev authored Jan 30, 2025
2 parents 52fbbe8 + 4a41707 commit 490ba14
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 5 deletions.
33 changes: 31 additions & 2 deletions Tests/IgniteTesting/Modifiers/CornerRadius.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,37 @@ import Testing
@Suite("CornerRadius Tests")
@MainActor
struct CornerRadiusTests {
@Test("ExampleTest")
func example() async throws {
@Test("CornerRadius Modifier with All Edges (String)")
func cornerRadiusWithAllEdgesString() async throws {
let element = Text("Hello").cornerRadius("50%")
let output = element.render()
#expect(output == "<p style=\"border-radius: 50%\">Hello</p>")
}

@Test("CornerRadius Modifier with All Edges (Pixels)")
func cornerRadiusWithAllEdgesPixels() async throws {
let element = Text("Hello").cornerRadius(10)
let output = element.render()
#expect(output == "<p style=\"border-radius: 10px\">Hello</p>")
}

@Test("CornerRadius Modifier with Specific Edges (String)")
func cornerRadiusWithSpecificEdgesString() async throws {
let element = Text("Hello").cornerRadius([.topLeading, .bottomTrailing], "10px")
let output = element.render()
#expect(output.contains("border-top-left-radius: 10px"))
#expect(output.contains("border-bottom-right-radius: 10px"))
#expect(!output.contains("border-top-right-radius"))
#expect(!output.contains("border-bottom-left-radius"))
}

@Test("CornerRadius Modifier with Specific Edges (Pixels)")
func cornerRadiusWithSpecificEdgesPixels() async throws {
let element = Text("Hello").cornerRadius([.topLeading, .bottomTrailing], 10)
let output = element.render()
#expect(output.contains("border-top-left-radius: 10px"))
#expect(output.contains("border-bottom-right-radius: 10px"))
#expect(!output.contains("border-top-right-radius"))
#expect(!output.contains("border-bottom-left-radius"))
}
}
10 changes: 7 additions & 3 deletions Tests/IgniteTesting/Modifiers/FixedSize.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ import Testing
@Suite("FixedSize Tests")
@MainActor
struct FixedSizeTests {
@Test("ExampleTest")
func example() async throws {

@Test("FixedSize Modifier")
func fixedSizeModifier() async throws {
let element = Text("Hello").fixedSize()
let output = element.render()
#expect(
output == "<div style=\"display: inline-block\"><p>Hello</p></div>"
)
}
}

0 comments on commit 490ba14

Please sign in to comment.