Skip to content

Commit

Permalink
[TextInput-1087] Add intents on snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
robergro committed Oct 24, 2024
1 parent 25997f3 commit 0f00463
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 1 deletion.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct TextEditorConfigurationSnapshotTests {

let scenario: TextEditorScenarioSnapshotTests

let intent: TextEditorIntent = .neutral
let intent: TextEditorIntent

let state: TextEditorState
let content: TextEditorContentResilience
Expand All @@ -35,6 +35,7 @@ struct TextEditorConfigurationSnapshotTests {

init(
scenario: TextEditorScenarioSnapshotTests,
intent: TextEditorIntent,
state: TextEditorState,
content: TextEditorContentResilience,
placeholder: TextEditorPlaceholder,
Expand All @@ -43,6 +44,7 @@ struct TextEditorConfigurationSnapshotTests {
sizes: [UIContentSizeCategory] = Constants.Sizes.default
) {
self.scenario = scenario
self.intent = intent
self.state = state
self.content = content
self.placeholder = placeholder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ enum TextEditorScenarioSnapshotTests: String, CaseIterable {
case test3
case test4
case test5
case test6

// MARK: - Type Alias

Expand All @@ -38,6 +39,8 @@ enum TextEditorScenarioSnapshotTests: String, CaseIterable {
return self.test4()
case .test5:
return self.test5(isSwiftUIComponent: isSwiftUIComponent)
case .test6:
return self.test6()
}
}

Expand All @@ -54,6 +57,7 @@ enum TextEditorScenarioSnapshotTests: String, CaseIterable {
/// - mode : default
/// - height : flexible
/// - placeholder: none
/// - intent: neutral
private func test1(isSwiftUIComponent: Bool) -> [TextEditorConfigurationSnapshotTests] {
let states = TextEditorState.allCases(isSwiftUIComponent: isSwiftUIComponent)
let contentResiliences = TextEditorContentResilience.allCases
Expand All @@ -62,6 +66,7 @@ enum TextEditorScenarioSnapshotTests: String, CaseIterable {
contentResiliences.map { contentResilience in
return .init(
scenario: self,
intent: .neutral,
state: state,
content: contentResilience,
placeholder: .empty,
Expand All @@ -82,12 +87,14 @@ enum TextEditorScenarioSnapshotTests: String, CaseIterable {
/// - mode : default
/// - **height : all**
/// - placeholder: none
/// - intent: neutral
private func test2(isSwiftUIComponent: Bool) -> [TextEditorConfigurationSnapshotTests] {
let heights = TextEditorHeight.allCases

return heights.map { height -> TextEditorConfigurationSnapshotTests in
.init(
scenario: self,
intent: .neutral,
state: .enabled,
content: isSwiftUIComponent ? .multilineText : .smallText,
placeholder: .empty,
Expand All @@ -108,12 +115,14 @@ enum TextEditorScenarioSnapshotTests: String, CaseIterable {
/// - mode : dark
/// - height : flexible
/// - placeholder: none
/// - intent: neutral
private func test3(isSwiftUIComponent: Bool) -> [TextEditorConfigurationSnapshotTests] {
let states = TextEditorState.allCases(isSwiftUIComponent: isSwiftUIComponent)

return states.map { state -> TextEditorConfigurationSnapshotTests in
.init(
scenario: self,
intent: .neutral,
state: state,
content: .smallText,
placeholder: .empty,
Expand All @@ -134,6 +143,7 @@ enum TextEditorScenarioSnapshotTests: String, CaseIterable {
/// - mode : default
/// - **height : all**
/// - placeholder: none
/// - intent: neutral
private func test4() -> [TextEditorConfigurationSnapshotTests] {
let contentResiliences = TextEditorContentResilience.allCases
let heights = TextEditorHeight.allCases
Expand All @@ -142,6 +152,7 @@ enum TextEditorScenarioSnapshotTests: String, CaseIterable {
heights.map { height in
return .init(
scenario: self,
intent: .neutral,
state: .enabled,
content: contentResilience,
placeholder: .empty,
Expand All @@ -162,6 +173,7 @@ enum TextEditorScenarioSnapshotTests: String, CaseIterable {
/// - mode : default
/// - height : flexible
/// - **placeholder: all**
/// - intent: neutral
private func test5(isSwiftUIComponent: Bool) -> [TextEditorConfigurationSnapshotTests] {
let states = TextEditorState.allCases(isSwiftUIComponent: isSwiftUIComponent)
let placeholders = TextEditorPlaceholder.allCases
Expand All @@ -170,6 +182,7 @@ enum TextEditorScenarioSnapshotTests: String, CaseIterable {
placeholders.map { placeholder in
return .init(
scenario: self,
intent: .neutral,
state: state,
content: .empty,
placeholder: placeholder,
Expand All @@ -178,4 +191,31 @@ enum TextEditorScenarioSnapshotTests: String, CaseIterable {
}
}
}

/// Test 6
///
/// Description: To test all intents
///
/// Content:
/// - states : enabled
/// - content resilience : small
/// - a11y sizes : default
/// - mode : default
/// - height : flexible
/// - placeholder: all
/// - **intent: all**
private func test6() -> [TextEditorConfigurationSnapshotTests] {
let intents = TextEditorIntent.allCases

return intents.map { intent in
return .init(
scenario: self,
intent: intent,
state: .enabled,
content: .smallText,
placeholder: .empty,
height: .flexible
)
}
}
}

0 comments on commit 0f00463

Please sign in to comment.