Skip to content

Commit

Permalink
Switch Prefire to a fork that fixes the configuration and templating,… (
Browse files Browse the repository at this point in the history
#63)

* Switch Prefire to a fork that fixes the configuration and templating, add multi-device snapshots

* Try figuring out why the perceptual precission isn't working

* Try running the tests on macos-14

* Switch precision back to 1.0
  • Loading branch information
stefanceriu committed Mar 11, 2024
1 parent dce4984 commit 517311c
Show file tree
Hide file tree
Showing 19 changed files with 270 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:
tests:

runs-on: macos-13
runs-on: macos-14

steps:
- name: Checkout code and snapshots
Expand Down
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
{
"identity" : "prefire",
"kind" : "remoteSourceControl",
"location" : "https://github.com/BarredEwe/Prefire/",
"location" : "https://github.com/stefanceriu/Prefire",
"state" : {
"revision" : "996a192263f8056375eb6809e0ff91f1ace40877"
"revision" : "982b207efafb9c6ff0c7beae38211c37b918d2b9"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let package = Package(
.package(url: "https://github.com/element-hq/compound-design-tokens.git", exact: "1.2.0"),
.package(url: "https://github.com/siteline/SwiftUI-Introspect.git", from: "0.9.0"),
.package(url: "https://github.com/SFSafeSymbols/SFSafeSymbols.git", from: "4.1.1"),
.package(url: "https://github.com/BarredEwe/Prefire", revision: "996a192263f8056375eb6809e0ff91f1ace40877"),
.package(url: "https://github.com/stefanceriu/Prefire", revision: "982b207efafb9c6ff0c7beae38211c37b918d2b9"),
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.13.0")
],
targets: [
Expand Down
1 change: 0 additions & 1 deletion Sources/Compound/BaseStyles/CompoundButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ public struct CompoundButtonStyle_Previews: PreviewProvider, PrefireProvider {
Header(title: "Plain")
}
}
.snapshotWithDefaultPrecision()
}

public static func states(_ size: CompoundButtonStyle.Size) -> some View {
Expand Down
1 change: 0 additions & 1 deletion Sources/Compound/BaseStyles/CompoundToggleStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public struct CompoundToggleStyle_Previews: PreviewProvider, PrefireProvider {
states
}
.padding(32)
.snapshotWithDefaultPrecision()
}

@ViewBuilder
Expand Down
28 changes: 0 additions & 28 deletions Sources/Compound/Extensions/View.swift

This file was deleted.

4 changes: 0 additions & 4 deletions Sources/Compound/Icons/CompoundIcon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -168,18 +168,14 @@ struct CompoundIcon_Previews: PreviewProvider, PrefireProvider {
static var previews: some View {
form
.previewDisplayName("Form")
.snapshotWithDefaultPrecision()
buttons
.padding(8)
.previewLayout(.sizeThatFits)
.previewDisplayName("Buttons")
.snapshotWithDefaultPrecision()
accessibilityIcons
.previewDisplayName("Accessibility Icons Only")
.snapshotWithDefaultPrecision()
accessibilityLabels
.previewDisplayName("Accessibility Labels")
.snapshotWithDefaultPrecision()
}

static var accessibilityIcons: some View {
Expand Down
1 change: 0 additions & 1 deletion Sources/Compound/List/ListInlinePicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ struct ListInlinePicker_Previews: PreviewProvider, PrefireProvider {
.labelsHidden()
}
}
.snapshotWithDefaultPrecision()
}
}
}
2 changes: 0 additions & 2 deletions Sources/Compound/List/ListRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ public struct ListRow_Previews: PreviewProvider, PrefireProvider {
othersSection
}
.compoundList()
.snapshotWithDefaultPrecision()
}

static var labels: some View {
Expand Down Expand Up @@ -434,6 +433,5 @@ struct ListRowLoadingSelection_Previews: PreviewProvider, PrefireProvider {
kind: .selection(isSelected: false) { })
}
.compoundList()
.snapshotWithDefaultPrecision()
}
}
2 changes: 0 additions & 2 deletions Sources/Compound/List/ListRowAccessory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ struct ListRowAccessory_Previews: PreviewProvider, PrefireProvider {
.disabled(true)
}
.previewDisplayName("Accessories")
.snapshotWithDefaultPrecision()
}

static func row(title: String, accessory: ListRowAccessory) -> some View {
Expand All @@ -134,6 +133,5 @@ struct MultiUnselectedAccessory_Previews: PreviewProvider, PrefireProvider {
}
}
.previewDisplayName("Fake circle icon")
.snapshotWithDefaultPrecision()
}
}
1 change: 0 additions & 1 deletion Sources/Compound/List/ListRowButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,5 @@ public struct ListRowButtonStyle_Previews: PreviewProvider, PrefireProvider {
.listRowInsets(EdgeInsets())
}
.compoundList()
.snapshotWithDefaultPrecision()
}
}
1 change: 0 additions & 1 deletion Sources/Compound/List/ListRowLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,5 @@ struct ListRowLabel_Previews: PreviewProvider, PrefireProvider {
}
}
.compoundList()
.snapshotWithDefaultPrecision()
}
}
1 change: 0 additions & 1 deletion Sources/Compound/List/ListRowTrailingSection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ struct ListRowTrailingSection_Previews: PreviewProvider, PrefireProvider {
details
withAccessory
}
.snapshotWithDefaultPrecision()
}

static var details: some View {
Expand Down
2 changes: 0 additions & 2 deletions Sources/Compound/List/ListStyles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ struct ListTextStyles_Previews: PreviewProvider, PrefireProvider {
}
.compoundList()
.previewDisplayName("Form")
.snapshotWithDefaultPrecision()

List {
Section {
Expand All @@ -96,6 +95,5 @@ struct ListTextStyles_Previews: PreviewProvider, PrefireProvider {
}
.compoundList()
.previewDisplayName("List")
.snapshotWithDefaultPrecision()
}
}
2 changes: 0 additions & 2 deletions Sources/Compound/Text Field Styles/SearchFieldStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ struct SearchStyle_Previews: PreviewProvider, PrefireProvider {
}
.tint(.compound.textActionPrimary)
.previewDisplayName("List")
.snapshotWithDefaultPrecision()

NavigationStack {
Form {
Expand All @@ -104,6 +103,5 @@ struct SearchStyle_Previews: PreviewProvider, PrefireProvider {
}
.tint(.compound.textActionPrimary)
.previewDisplayName("Form")
.snapshotWithDefaultPrecision()
}
}
3 changes: 0 additions & 3 deletions Tests/.prefire.yml

This file was deleted.

7 changes: 7 additions & 0 deletions Tests/CompoundTests/.prefire.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
test_configuration:
- simulator_device: "iPhone15"
- required_os: 17
- template_file_path: PreviewTests.stencil
- snapshot_devices:
- iPhone 15
- iPad
Loading

0 comments on commit 517311c

Please sign in to comment.