forked from ashfurrow/Nimble-Snapshots
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DynamicTypeTests.swift
105 lines (84 loc) · 4.47 KB
/
DynamicTypeTests.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import Quick
import Nimble
import Nimble_Snapshots
import Bootstrap
class DynamicTypeTests: QuickSpec {
override func spec() {
describe("in some context", {
var view: UIView!
beforeEach {
setNimbleTolerance(0)
setNimbleTestFolder("tests")
view = DynamicTypeView(frame: CGRect(x: 0, y: 0, width: 500, height: 500))
}
it("has a valid snapshot for all content size categories (iOS 9)") {
let version = NSProcessInfo.processInfo().operatingSystemVersion
guard version.majorVersion == 9 && version.minorVersion == 3 else {
return
}
expect(view).to(haveValidDynamicTypeSnapshot())
let name = "something custom_\(version.majorVersion)_\(version.minorVersion)"
expect(view).to(haveValidDynamicTypeSnapshot(named: name))
}
it("has a valid snapshot for a single content size category (iOS 9)") {
let version = NSProcessInfo.processInfo().operatingSystemVersion
guard version.majorVersion == 9 && version.minorVersion == 3 else {
return
}
expect(view).to(haveValidDynamicTypeSnapshot(sizes: [UIContentSizeCategoryExtraLarge]))
let name = "something custom_\(version.majorVersion)_\(version.minorVersion)"
expect(view).to(haveValidDynamicTypeSnapshot(named: name, sizes: [UIContentSizeCategoryExtraLarge]))
}
it("has a valid snapshot for all content size categories (iOS 10)") {
let version = NSProcessInfo.processInfo().operatingSystemVersion
guard version.majorVersion == 10 && version.minorVersion == 0 else {
return
}
expect(view).to(haveValidDynamicTypeSnapshot())
let name = "something custom_\(version.majorVersion)_\(version.minorVersion)"
expect(view).to(haveValidDynamicTypeSnapshot(named: name))
}
it("has a valid snapshot for a single content size category (iOS 10)") {
let version = NSProcessInfo.processInfo().operatingSystemVersion
guard version.majorVersion == 10 && version.minorVersion == 0 else {
return
}
expect(view).to(haveValidDynamicTypeSnapshot(sizes: [UIContentSizeCategoryExtraLarge]))
let name = "something custom_\(version.majorVersion)_\(version.minorVersion)"
expect(view).to(haveValidDynamicTypeSnapshot(named: name, sizes: [UIContentSizeCategoryExtraLarge]))
}
it("has a valid pretty-syntax snapshot (iOS 9)") {
let version = NSProcessInfo.processInfo().operatingSystemVersion
guard version.majorVersion == 9 && version.minorVersion == 3 else {
return
}
expect(view) == dynamicTypeSnapshot()
}
it("has a valid pretty-syntax snapshot (iOS 10)") {
let version = NSProcessInfo.processInfo().operatingSystemVersion
guard version.majorVersion == 10 && version.minorVersion == 0 else {
return
}
expect(view) == dynamicTypeSnapshot()
}
it("has a valid pretty-syntax snapshot for only one size category (iOS 9)") {
let version = NSProcessInfo.processInfo().operatingSystemVersion
guard version.majorVersion == 9 && version.minorVersion == 3 else {
return
}
expect(view) == dynamicTypeSnapshot(sizes: [UIContentSizeCategoryExtraLarge])
}
it("has a valid pretty-syntax snapshot for only one size category (iOS 10)") {
let version = NSProcessInfo.processInfo().operatingSystemVersion
guard version.majorVersion == 10 && version.minorVersion == 0 else {
return
}
expect(view) == dynamicTypeSnapshot(sizes: [UIContentSizeCategoryExtraLarge])
}
it("has a valid snapshot with model and OS in name") {
expect(view).to(haveValidDynamicTypeSnapshot(isDeviceAgnostic: true))
expect(view).to(haveValidDynamicTypeSnapshot(named: "something custom with model and OS", isDeviceAgnostic: true))
}
})
}
}