Skip to content

Commit f8f7a20

Browse files
committed
refactor : token color tests ui
1 parent d151ad3 commit f8f7a20

File tree

1 file changed

+64
-48
lines changed

1 file changed

+64
-48
lines changed

Showcase/ShowcaseTests/__Snapshots__/OUDSTokensColorUITests/OUDSTokensColorUITests.swift

+64-48
Original file line numberDiff line numberDiff line change
@@ -26,72 +26,88 @@ import XCTest
2626

2727
final class OUDSTokensColorUITests: XCTestCase {
2828

29-
// MARK: - Orange Theme Color Tests
29+
// MARK: - Orange Theme Light Mode Color Tests
3030

31-
/// This function tests all elevation tokens in the `OrangeTheme` with both the `light` and `dark` color schemes.
31+
/// This function tests all elevation tokens in the `OrangeTheme` with both the `light` color schemes.
3232
/// It iterates through all sections of `NamedColor`, rendering each illustration in a `UIHostingController`,
3333
/// and captures a snapshot for each color. The snapshots are saved with names indicating the color, theme, and color scheme.
34-
@MainActor func testAllColorsOrangeTheme() {
34+
@MainActor func testAllColorsOrangeThemeLight() {
3535
/// Create an instance of the page with a forced OrangeTheme for light mode
36-
let lightColorPage = ColorTokenPage(forceTo: OrangeTheme(), colorScheme: .light)
37-
/// Create an instance of the page with a forced OrangeTheme for dark mode
38-
let darkColorPage = ColorTokenPage(forceTo: OrangeTheme(), colorScheme: .dark)
36+
let colorPage = ColorTokenPage(forceTo: OrangeTheme(), colorScheme: .light)
3937

4038
/// Test all color sections individually for light mode
41-
testBackgroundColors(using: lightColorPage, theme: OrangeTheme(), interfaceStyle: .light, colorScheme: .light)
42-
testActionColors(using: lightColorPage, theme: OrangeTheme(), interfaceStyle: .light, colorScheme: .light)
43-
testAlwaysColors(using: lightColorPage, theme: OrangeTheme(), interfaceStyle: .light, colorScheme: .light)
44-
testContentColors(using: lightColorPage, theme: OrangeTheme(), interfaceStyle: .light, colorScheme: .light)
45-
testContentOnBgColors(using: lightColorPage, theme: OrangeTheme(), interfaceStyle: .light, colorScheme: .light)
46-
testBorderColors(using: lightColorPage, theme: OrangeTheme(), interfaceStyle: .light, colorScheme: .light)
47-
testElevationColors(using: lightColorPage, theme: OrangeTheme(), interfaceStyle: .light, colorScheme: .light)
48-
testDecorativeColors(using: lightColorPage, theme: OrangeTheme(), interfaceStyle: .light, colorScheme: .light)
49-
testChartColors(using: lightColorPage, theme: OrangeTheme(), interfaceStyle: .light, colorScheme: .light)
39+
testBackgroundColors(using: colorPage, theme: OrangeTheme(), interfaceStyle: .light, colorScheme: .light)
40+
testActionColors(using: colorPage, theme: OrangeTheme(), interfaceStyle: .light, colorScheme: .light)
41+
testAlwaysColors(using: colorPage, theme: OrangeTheme(), interfaceStyle: .light, colorScheme: .light)
42+
testContentColors(using: colorPage, theme: OrangeTheme(), interfaceStyle: .light, colorScheme: .light)
43+
testContentOnBgColors(using: colorPage, theme: OrangeTheme(), interfaceStyle: .light, colorScheme: .light)
44+
testBorderColors(using: colorPage, theme: OrangeTheme(), interfaceStyle: .light, colorScheme: .light)
45+
testElevationColors(using: colorPage, theme: OrangeTheme(), interfaceStyle: .light, colorScheme: .light)
46+
testDecorativeColors(using: colorPage, theme: OrangeTheme(), interfaceStyle: .light, colorScheme: .light)
47+
testChartColors(using: colorPage, theme: OrangeTheme(), interfaceStyle: .light, colorScheme: .light)
48+
}
49+
50+
// MARK: - Orange Theme Dark Mode Color Tests
51+
52+
/// This function tests all elevation tokens in the `OrangeTheme` with both the `dark` color schemes.
53+
/// It iterates through all sections of `NamedColor`, rendering each illustration in a `UIHostingController`,
54+
/// and captures a snapshot for each color. The snapshots are saved with names indicating the color, theme, and color scheme.
55+
@MainActor func testAllColorsOrangeThemeDark() {
56+
/// Create an instance of the page with a forced OrangeTheme for dark mode
57+
let colorPage = ColorTokenPage(forceTo: OrangeTheme(), colorScheme: .dark)
5058

5159
/// Test all color sections individually for dark mode
52-
testBackgroundColors(using: darkColorPage, theme: OrangeTheme(), interfaceStyle: .dark, colorScheme: .dark)
53-
testActionColors(using: darkColorPage, theme: OrangeTheme(), interfaceStyle: .dark, colorScheme: .dark)
54-
testAlwaysColors(using: darkColorPage, theme: OrangeTheme(), interfaceStyle: .dark, colorScheme: .dark)
55-
testContentColors(using: darkColorPage, theme: OrangeTheme(), interfaceStyle: .dark, colorScheme: .dark)
56-
testContentOnBgColors(using: darkColorPage, theme: OrangeTheme(), interfaceStyle: .dark, colorScheme: .dark)
57-
testBorderColors(using: darkColorPage, theme: OrangeTheme(), interfaceStyle: .dark, colorScheme: .dark)
58-
testElevationColors(using: darkColorPage, theme: OrangeTheme(), interfaceStyle: .dark, colorScheme: .dark)
59-
testDecorativeColors(using: darkColorPage, theme: OrangeTheme(), interfaceStyle: .dark, colorScheme: .dark)
60-
testChartColors(using: darkColorPage, theme: OrangeTheme(), interfaceStyle: .dark, colorScheme: .dark)
60+
testBackgroundColors(using: colorPage, theme: OrangeTheme(), interfaceStyle: .dark, colorScheme: .dark)
61+
testActionColors(using: colorPage, theme: OrangeTheme(), interfaceStyle: .dark, colorScheme: .dark)
62+
testAlwaysColors(using: colorPage, theme: OrangeTheme(), interfaceStyle: .dark, colorScheme: .dark)
63+
testContentColors(using: colorPage, theme: OrangeTheme(), interfaceStyle: .dark, colorScheme: .dark)
64+
testContentOnBgColors(using: colorPage, theme: OrangeTheme(), interfaceStyle: .dark, colorScheme: .dark)
65+
testBorderColors(using: colorPage, theme: OrangeTheme(), interfaceStyle: .dark, colorScheme: .dark)
66+
testElevationColors(using: colorPage, theme: OrangeTheme(), interfaceStyle: .dark, colorScheme: .dark)
67+
testDecorativeColors(using: colorPage, theme: OrangeTheme(), interfaceStyle: .dark, colorScheme: .dark)
68+
testChartColors(using: colorPage, theme: OrangeTheme(), interfaceStyle: .dark, colorScheme: .dark)
6169
}
6270

63-
// MARK: - Inverse Theme Color Tests
71+
// MARK: - Inverse Theme Light Mode Color Tests
6472

65-
/// This function tests all elevation tokens in the `InverseTheme` with both the `light` and `dark` color schemes.
73+
/// This function tests all elevation tokens in the `InverseTheme` with both the `light` color schemes.
6674
/// It iterates through all sections of `NamedColor`, rendering each illustration in a `UIHostingController`,
6775
/// and captures a snapshot for each color. The snapshots are saved with names indicating the color, theme, and color scheme.
68-
@MainActor func testAllColorsInverseTheme() {
76+
@MainActor func testAllColorsInverseThemeLight() {
6977
/// Create an instance of the page with a forced InverseTheme for light mode
70-
let lightColorPage = ColorTokenPage(forceTo: InverseTheme(), colorScheme: .light)
71-
/// Create an instance of the page with a forced InverseTheme for dark mode
72-
let darkColorPage = ColorTokenPage(forceTo: InverseTheme(), colorScheme: .dark)
78+
let colorPage = ColorTokenPage(forceTo: InverseTheme(), colorScheme: .light)
7379

7480
/// Test all color sections individually for light mode
75-
testBackgroundColors(using: lightColorPage, theme: InverseTheme(), interfaceStyle: .light, colorScheme: .light)
76-
testActionColors(using: lightColorPage, theme: InverseTheme(), interfaceStyle: .light, colorScheme: .light)
77-
testAlwaysColors(using: lightColorPage, theme: InverseTheme(), interfaceStyle: .light, colorScheme: .light)
78-
testContentColors(using: lightColorPage, theme: InverseTheme(), interfaceStyle: .light, colorScheme: .light)
79-
testContentOnBgColors(using: lightColorPage, theme: InverseTheme(), interfaceStyle: .light, colorScheme: .light)
80-
testBorderColors(using: lightColorPage, theme: InverseTheme(), interfaceStyle: .light, colorScheme: .light)
81-
testElevationColors(using: lightColorPage, theme: InverseTheme(), interfaceStyle: .light, colorScheme: .light)
82-
testDecorativeColors(using: lightColorPage, theme: InverseTheme(), interfaceStyle: .light, colorScheme: .light)
83-
testChartColors(using: lightColorPage, theme: InverseTheme(), interfaceStyle: .light, colorScheme: .light)
81+
testBackgroundColors(using: colorPage, theme: InverseTheme(), interfaceStyle: .light, colorScheme: .light)
82+
testActionColors(using: colorPage, theme: InverseTheme(), interfaceStyle: .light, colorScheme: .light)
83+
testAlwaysColors(using: colorPage, theme: InverseTheme(), interfaceStyle: .light, colorScheme: .light)
84+
testContentColors(using: colorPage, theme: InverseTheme(), interfaceStyle: .light, colorScheme: .light)
85+
testContentOnBgColors(using: colorPage, theme: InverseTheme(), interfaceStyle: .light, colorScheme: .light)
86+
testBorderColors(using: colorPage, theme: InverseTheme(), interfaceStyle: .light, colorScheme: .light)
87+
testElevationColors(using: colorPage, theme: InverseTheme(), interfaceStyle: .light, colorScheme: .light)
88+
testDecorativeColors(using: colorPage, theme: InverseTheme(), interfaceStyle: .light, colorScheme: .light)
89+
testChartColors(using: colorPage, theme: InverseTheme(), interfaceStyle: .light, colorScheme: .light)
90+
}
91+
92+
// MARK: - Inverse Theme Dark Mode Color Tests
93+
94+
/// This function tests all elevation tokens in the `InverseTheme` with both the `dark` color schemes.
95+
/// It iterates through all sections of `NamedColor`, rendering each illustration in a `UIHostingController`,
96+
/// and captures a snapshot for each color. The snapshots are saved with names indicating the color, theme, and color scheme.
97+
@MainActor func testAllColorsInverseThemeDark() {
98+
/// Create an instance of the page with a forced InverseTheme for dark mode
99+
let colorPage = ColorTokenPage(forceTo: InverseTheme(), colorScheme: .dark)
84100

85101
/// Test all color sections individually for dark interfaceStyle
86-
testBackgroundColors(using: darkColorPage, theme: InverseTheme(), interfaceStyle: .dark, colorScheme: .dark)
87-
testActionColors(using: darkColorPage, theme: InverseTheme(), interfaceStyle: .dark, colorScheme: .dark)
88-
testAlwaysColors(using: darkColorPage, theme: InverseTheme(), interfaceStyle: .dark, colorScheme: .dark)
89-
testContentColors(using: darkColorPage, theme: InverseTheme(), interfaceStyle: .dark, colorScheme: .dark)
90-
testContentOnBgColors(using: darkColorPage, theme: InverseTheme(), interfaceStyle: .dark, colorScheme: .dark)
91-
testBorderColors(using: darkColorPage, theme: InverseTheme(), interfaceStyle: .dark, colorScheme: .dark)
92-
testElevationColors(using: darkColorPage, theme: InverseTheme(), interfaceStyle: .dark, colorScheme: .dark)
93-
testDecorativeColors(using: darkColorPage, theme: InverseTheme(), interfaceStyle: .dark, colorScheme: .dark)
94-
testChartColors(using: darkColorPage, theme: InverseTheme(), interfaceStyle: .dark, colorScheme: .dark)
102+
testBackgroundColors(using: colorPage, theme: InverseTheme(), interfaceStyle: .dark, colorScheme: .dark)
103+
testActionColors(using: colorPage, theme: InverseTheme(), interfaceStyle: .dark, colorScheme: .dark)
104+
testAlwaysColors(using: colorPage, theme: InverseTheme(), interfaceStyle: .dark, colorScheme: .dark)
105+
testContentColors(using: colorPage, theme: InverseTheme(), interfaceStyle: .dark, colorScheme: .dark)
106+
testContentOnBgColors(using: colorPage, theme: InverseTheme(), interfaceStyle: .dark, colorScheme: .dark)
107+
testBorderColors(using: colorPage, theme: InverseTheme(), interfaceStyle: .dark, colorScheme: .dark)
108+
testElevationColors(using: colorPage, theme: InverseTheme(), interfaceStyle: .dark, colorScheme: .dark)
109+
testDecorativeColors(using: colorPage, theme: InverseTheme(), interfaceStyle: .dark, colorScheme: .dark)
110+
testChartColors(using: colorPage, theme: InverseTheme(), interfaceStyle: .dark, colorScheme: .dark)
95111
}
96112

97113
/// This function tests colors for the `Background` section of the OrangeTheme.

0 commit comments

Comments
 (0)