-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test in light and dark mode #265
base: master
Are you sure you want to change the base?
Changes from 8 commits
b377cc7
f1c1094
a2bc4c0
9f01fee
f5ca942
fac3fbe
61dd0c6
3fb008d
585d835
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,4 @@ build | |
.swiftpm | ||
|
||
.DS_Store | ||
.build/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,19 +12,31 @@ final class BootstrapCustomFormatTests: QuickSpec { | |
beforeEach { | ||
setNimbleTestFolder("CustomFolder") | ||
view = UIView(frame: CGRect(origin: .zero, size: CGSize(width: 44, height: 44))) | ||
view.backgroundColor = .blue | ||
view.backgroundColor = UIColor { traits -> UIColor in | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here about the else |
||
if traits.userInterfaceStyle == .dark { | ||
return .brown | ||
} else { | ||
return .blue | ||
} | ||
} | ||
} | ||
|
||
it("fails to find the snapshots due to the custom folder") { | ||
expect(view).notTo(haveValidSnapshot(named: "something custom")) | ||
expect(view).notTo(haveValidSnapshot(named: "something custom")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Duplicated? |
||
} | ||
|
||
it("finds the snapshots using a custom images directory") { | ||
expect(view).to(haveValidSnapshot()) | ||
expect(view).to(recordSnapshot()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leftovers? |
||
} | ||
|
||
it("finds device agnostic snapshots with custom images directory") { | ||
expect(view).to(haveValidDeviceAgnosticSnapshot()) | ||
expect(view).to(recordDeviceAgnosticSnapshot()) | ||
} | ||
|
||
it("find the snapshot using a custom image directory for light and dark mode") { | ||
expect(view).to(recordSnapshot(userInterfaceStyle: .light)) | ||
expect(view).to(recordSnapshot(userInterfaceStyle: .dark)) | ||
Comment on lines
+34
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess all of those also should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't get this test to run properly, we still need to record images for this test, that is why I left it like that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we should stick to AAA (A.K.A Arrange, Act, and Assert) principles, and as we expect two different outputs , should be two isolated unit tests |
||
} | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,11 +16,18 @@ final class BootstrapTests: QuickSpec { | |
setNimbleTolerance(0.1) | ||
setNimbleTestFolder("tests") | ||
view = UIView(frame: CGRect(origin: .zero, size: CGSize(width: 44, height: 44))) | ||
view.backgroundColor = .blue | ||
view.backgroundColor = UIColor { traits -> UIColor in | ||
if traits.userInterfaceStyle == .dark { | ||
return .brown | ||
} else { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same about the else statement |
||
return .blue | ||
} | ||
} | ||
} | ||
|
||
it("has a valid snapshot") { | ||
expect(view).to(haveValidSnapshot()) | ||
expect(view).to(haveValidSnapshot(userInterfaceStyle: .light)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same about the expectations |
||
expect(view).to(haveValidSnapshot(userInterfaceStyle: .dark)) | ||
expect(view).to(haveValidSnapshot(named: "something custom")) | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,14 +27,28 @@ final class DynamicSizeTests: QuickSpec { | |
|
||
beforeEach { | ||
view = UIView(frame: CGRect(x: 0, y: 0, width: 500, height: 500)) | ||
view.backgroundColor = .blue | ||
view.backgroundColor = UIColor { traits -> UIColor in | ||
if traits.userInterfaceStyle == .dark { | ||
return .brown | ||
} else { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same about the else statement |
||
return .blue | ||
} | ||
} | ||
} | ||
|
||
it("has a valid snapshot to all sizes") { | ||
expect(view).to(haveValidDynamicSizeSnapshot(sizes: sizes)) | ||
// expect(view).to(recordDynamicSizeSnapshot(sizes: sizes)) | ||
} | ||
|
||
it("has a valid snapshot to all sizes in light and dark mode") { | ||
expect(view).to(haveValidDynamicSizeSnapshot(sizes: sizes, userInterfaceStyle: .light)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same about expectations |
||
expect(view).to(haveValidDynamicSizeSnapshot(sizes: sizes, userInterfaceStyle: .dark)) | ||
// expect(view).to(recordDynamicSizeSnapshot(sizes: sizes, userInterfaceStyle: .light)) | ||
// expect(view).to(recordDynamicSizeSnapshot(sizes: sizes, userInterfaceStyle: .dark)) | ||
} | ||
|
||
|
||
it("has a valid snapshot to all sizes with identifier") { | ||
// expect(view).to(recordDynamicSizeSnapshot(identifier: "bootstrap", sizes: sizes)) | ||
expect(view).to(haveValidDynamicSizeSnapshot(identifier: "bootstrap", sizes: sizes)) | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don´t need the else here