Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

add snapshot test #5

Merged

Conversation

GeekTree0101
Copy link
Contributor

@GeekTree0101 GeekTree0101 commented Nov 4, 2021

Before run unit test, you must set recordMode as true.

class KarrotFlexSnapshotTestCase: FBSnapshotTestCase {

  var testView: KarrotFlexTestView!

  override func setUp() {
    super.setUp()
    self.testView = KarrotFlexTestView()
    self.testView.backgroundColor = .green
    self.recordMode = false // <- HERE
  }

  func verify() {
    FBSnapshotVerifyView(self.testView)
  }

  func testDefine(parentSize: CGSize, _ closure: @escaping (Flex) -> Void) {
    self.testView.flex.define(closure)
    self.testView.bounds = CGRect(origin: .zero, size: parentSize)
    self.testView.flex.layout()
    self.testView.setNeedsLayout()
  }
}

test_center_X@3x
test_center_Y@3x
test_center_XY@3x

@GeekTree0101 GeekTree0101 added the enhancement A new feature label Nov 4, 2021
@GeekTree0101 GeekTree0101 self-assigned this Nov 4, 2021
@GeekTree0101 GeekTree0101 mentioned this pull request Nov 4, 2021
@GeekTree0101 GeekTree0101 added the in dependent in dependent label Nov 4, 2021
@GeekTree0101
Copy link
Contributor Author

After merging it first, I will take it in the direction of supplementing the snapshot test.

@GeekTree0101 GeekTree0101 merged commit de0872c into feature/david/add-flex-center Nov 4, 2021
@GeekTree0101 GeekTree0101 deleted the feature/david/add-snapshot-test branch November 4, 2021 08:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement A new feature in dependent in dependent
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant