Skip to content

Commit

Permalink
swiftui-snapshot-testing deprecation: use assertSnapshot(of:…) (#284
Browse files Browse the repository at this point in the history
)
  • Loading branch information
kirkbig authored Dec 31, 2023
1 parent 8f6affc commit 4ffe814
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 33 deletions.
12 changes: 6 additions & 6 deletions Tests/MarkdownUITests/MarkdownImageTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
.border(Color.accentColor)
.padding()

assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testRelativeImage() {
Expand Down Expand Up @@ -49,7 +49,7 @@
)
)

assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testImageLink() {
Expand All @@ -66,7 +66,7 @@
.padding()
.markdownImageProvider(AssetImageProvider(bundle: .module))

assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testMultipleImages() throws {
Expand All @@ -89,7 +89,7 @@
.padding()
.markdownImageProvider(AssetImageProvider(bundle: .module))

assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testMultipleImagesSize() throws {
Expand All @@ -109,7 +109,7 @@
.padding()
.markdownImageProvider(AssetImageProvider(bundle: .module))

assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testColorScheme() {
Expand All @@ -136,7 +136,7 @@
}
.markdownImageProvider(AssetImageProvider(bundle: .module))

assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}
}
#endif
12 changes: 6 additions & 6 deletions Tests/MarkdownUITests/MarkdownListTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
.border(Color.accentColor)
.padding()

assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testBulletedList() {
Expand All @@ -36,7 +36,7 @@
.border(Color.accentColor)
.padding()

assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testBulletedDashedList() {
Expand All @@ -54,7 +54,7 @@
.padding()
.markdownBulletedListMarker(.dash)

assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testNumberedList() {
Expand All @@ -81,7 +81,7 @@
.border(Color.accentColor)
.padding()

assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testRomanNumberedList() {
Expand All @@ -103,7 +103,7 @@
.padding()
.markdownNumberedListMarker(.lowerRoman)

assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testLooseList() {
Expand All @@ -129,7 +129,7 @@
.border(Color.accentColor)
.padding()

assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}
}

Expand Down
24 changes: 12 additions & 12 deletions Tests/MarkdownUITests/MarkdownTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
.border(Color.accentColor)
.padding()

assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testCodeBlock() {
Expand All @@ -60,7 +60,7 @@
.border(Color.accentColor)
.padding()

assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testVerbatimHTML() {
Expand All @@ -79,7 +79,7 @@
.border(Color.accentColor)
.padding()

assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testOpenCodeBlock() {
Expand All @@ -93,7 +93,7 @@
.border(Color.accentColor)
.padding()

assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testParagraphs() {
Expand All @@ -111,7 +111,7 @@
.border(Color.accentColor)
.padding()

assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testCenteredParagraphs() {
Expand All @@ -130,7 +130,7 @@
.padding()
.multilineTextAlignment(.center)

assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testTrailingParagraphs() {
Expand All @@ -149,7 +149,7 @@
.padding()
.multilineTextAlignment(.trailing)

assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testSpacing() {
Expand All @@ -171,7 +171,7 @@
.markdownMargin(bottom: .zero)
}

assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testHeadings() {
Expand All @@ -194,7 +194,7 @@
.border(Color.accentColor)
.padding()

assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testThematicBreak() {
Expand All @@ -220,7 +220,7 @@
.border(Color.accentColor)
.padding()

assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testInlines() {
Expand Down Expand Up @@ -250,7 +250,7 @@
.border(Color.accentColor)
.padding()

assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testInlinesStyling() {
Expand Down Expand Up @@ -294,7 +294,7 @@
UnderlineStyle(.init(pattern: .dot))
}

assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}
}
#endif
18 changes: 9 additions & 9 deletions Tests/MarkdownUITests/ThemeDocCTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
Use `git status` to list all new or modified files that haven't yet been committed.
"""#
}
assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testHeadings() {
Expand All @@ -45,7 +45,7 @@
Paragraph.
"""#
}
assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testParagraph() {
Expand All @@ -60,7 +60,7 @@
It was a bright cold day in April, and the clocks were striking thirteen.
"""#
}
assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testBlockquote() {
Expand All @@ -73,7 +73,7 @@
It was a bright cold day in April, and the clocks were striking thirteen.
"""#
}
assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testCodeBlock() {
Expand All @@ -93,7 +93,7 @@
It was a bright cold day in April, and the clocks were striking thirteen.
"""#
}
assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testImage() throws {
Expand All @@ -116,7 +116,7 @@
"""#
}
.markdownImageProvider(AssetImageProvider(bundle: .module))
assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testList() {
Expand All @@ -143,7 +143,7 @@
- [ ] An unfinished task
"""#
}
assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testTable() throws {
Expand All @@ -162,7 +162,7 @@
| `fast` | Moves faster than a hare. |
"""#
}
assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}

func testThematicBreak() {
Expand All @@ -175,7 +175,7 @@
It was a bright cold day in April, and the clocks were striking thirteen.
"""#
}
assertSnapshot(matching: view, as: .image(layout: layout))
assertSnapshot(of: view, as: .image(layout: layout))
}
}

Expand Down

0 comments on commit 4ffe814

Please sign in to comment.