-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(SegmentSelector): Fix segment selection after theme changes (#131)
- Loading branch information
Showing
19 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// | ||
// SegmentSelectorTests.swift | ||
// | ||
// Made with ❤️ by Novum | ||
// | ||
// Copyright © Telefonica. All rights reserved. | ||
// | ||
|
||
@testable import Mistica | ||
import SnapshotTesting | ||
import XCTest | ||
|
||
final class SegmentSelectorTests: XCTestCase { | ||
override func setUp() { | ||
super.setUp() | ||
UIView.setAnimationsEnabled(false) | ||
|
||
isRecording = false | ||
} | ||
|
||
func testSegmentsInSegmentSelector() { | ||
assertSnapshotForAllBrandsAndStyles( | ||
as: .image(size: CGSize(width: 320, height: 49)), | ||
viewBuilder: makeSegmentSelector(segments: 5, hasSelectedItem: false) | ||
) | ||
} | ||
|
||
func testSelectedSegmentsInSegmentSelector() { | ||
assertSnapshotForAllBrandsAndStyles( | ||
as: .image(size: CGSize(width: 320, height: 49)), | ||
viewBuilder: makeSegmentSelector(segments: 5, hasSelectedItem: true) | ||
) | ||
} | ||
|
||
func makeSegmentSelector(segments: Int, hasSelectedItem: Bool) -> SegmentSelector { | ||
let segments = (0 ..< segments).map { Segment(id: "\($0)", title: "Segment") } | ||
let segmentSelector = SegmentSelector(segments: segments) | ||
if hasSelectedItem, let segment = segments.first { | ||
segmentSelector.select(segment) | ||
} | ||
return segmentSelector | ||
} | ||
} |
Binary file added
BIN
+10.5 KB
...SegmentSelectorTests/testSegmentsInSegmentSelector.with-movistar-dark-style.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.4 KB
...ts__/SegmentSelectorTests/testSegmentsInSegmentSelector.with-movistar-style.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.5 KB
...ots__/SegmentSelectorTests/testSegmentsInSegmentSelector.with-o2-dark-style.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.5 KB
...napshots__/SegmentSelectorTests/testSegmentsInSegmentSelector.with-o2-style.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.5 KB
...egmentSelectorTests/testSegmentsInSegmentSelector.with-o2Classic-dark-style.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.2 KB
...s__/SegmentSelectorTests/testSegmentsInSegmentSelector.with-o2Classic-style.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.5 KB
...s__/SegmentSelectorTests/testSegmentsInSegmentSelector.with-vivo-dark-style.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.6 KB
...pshots__/SegmentSelectorTests/testSegmentsInSegmentSelector.with-vivo-style.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.3 KB
...electorTests/testSelectedSegmentsInSegmentSelector.with-movistar-dark-style.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14 KB
...mentSelectorTests/testSelectedSegmentsInSegmentSelector.with-movistar-style.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.3 KB
...gmentSelectorTests/testSelectedSegmentsInSegmentSelector.with-o2-dark-style.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.5 KB
...__/SegmentSelectorTests/testSelectedSegmentsInSegmentSelector.with-o2-style.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.3 KB
...lectorTests/testSelectedSegmentsInSegmentSelector.with-o2Classic-dark-style.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.2 KB
...entSelectorTests/testSelectedSegmentsInSegmentSelector.with-o2Classic-style.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.3 KB
...entSelectorTests/testSelectedSegmentsInSegmentSelector.with-vivo-dark-style.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.5 KB
.../SegmentSelectorTests/testSelectedSegmentsInSegmentSelector.with-vivo-style.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.