Skip to content

Commit

Permalink
Feat: add tests for UICollectionView contentSize
Browse files Browse the repository at this point in the history
  • Loading branch information
Oni-zerone committed Jul 6, 2019
1 parent 100ef49 commit d598b59
Showing 1 changed file with 7 additions and 0 deletions.
Expand Up @@ -48,6 +48,13 @@ class StoriesCollectionViewLayoutSpec: QuickSpec {
collectionView.reloadData()
}

it("calculates contentSize") {
let numberOfItems = CGFloat(collectionView.numberOfItems(inSection: 0))
let contentSize = sut.collectionViewContentSize
expect(contentSize.height).to(equal(collectionView.bounds.height))
expect(contentSize.width).to(equal(collectionView.bounds.width * numberOfItems))
}

it("should always invalidate layout") {
let shouldInvalidate = sut.shouldInvalidateLayout(forBoundsChange: collectionView.bounds)
expect(shouldInvalidate).to(beTrue())
Expand Down

0 comments on commit d598b59

Please sign in to comment.