Skip to content

Commit

Permalink
Implemented SwiftLint, new PR
Browse files Browse the repository at this point in the history
Replaced force unwraps with explicit fatalErrors

Deleted file.zip

Updated UITestCase spacing

Updated variableName => identifierName

Fill in tbd in changelog

Summary:
Part of Instagram#707

Closes Instagram#729

Reviewed By: rnystrom

Differential Revision: D5036882

Pulled By: jessesquires

fbshipit-source-id: 2fe99b66608fff52bb42cac46073b32d0865d007

Bump pod and project version to 3.0.0

Summary:
Part of Instagram#707
Closes Instagram#731

Reviewed By: rnystrom

Differential Revision: D5036877

Pulled By: jessesquires

fbshipit-source-id: f63ce3369019870df87ebde59d6f6b0e95c8ad87

Proof guides for consisntency and name changes

Summary:
Part of Instagram#707
Closes Instagram#730

Differential Revision: D5039060

Pulled By: rnystrom

fbshipit-source-id: d54259b2dddbaba0fe2e69c6dd08a37fd17fbc4a

Regen example project files

Summary:
Regen example projects w/ pod script file.

Part of Instagram#707

Reviewed By: jessesquires

Differential Revision: D5039135

fbshipit-source-id: d29bcf635aea59aa589bd90644fb1ece6279cc10

Update version number in docs

Summary:
Part of Instagram#707
Closes Instagram#734

Differential Revision: D5046692

Pulled By: jessesquires

fbshipit-source-id: db43f99fd0bbf4186a1bd47070f28a9a446bc2a4

3.0 migration guide

Summary:
Will add to this as we close out the [milestone](https://github.com/Instagram/IGListKit/milestone/3).

Issue fixed: Instagram#475
Closes Instagram#661

Differential Revision: D5047071

Pulled By: jessesquires

fbshipit-source-id: 78989529f50c9b281960e5acf843e91198677432

Fix UICollectionView debug dump script

Summary:
Duh, need to import macro

Issue fixed: Instagram#722

- [x] All tests pass. Demo project builds and runs.
Closes Instagram#733

Differential Revision: D5040026

Pulled By: jessesquires

fbshipit-source-id: e9e51137ab4f7fa949667e3f3d644cd5c03abf80

Rename sectionIndex API to just section

Summary:
Quick rename before releasing 3.0 to get this API in parity w/ `isFirstSection` and `isLastSection`. My b I should have caught this in review.

Closes Instagram#720

Reviewed By: jessesquires, amonshiz

Differential Revision: D5031184

fbshipit-source-id: 1cd7b00c8b32084fecd861e78808eea0d0056337

Update CHANGELOG.md

Summary: Closes Instagram#735

Differential Revision: D5048185

Pulled By: jessesquires

fbshipit-source-id: 3f1a6826a4088043d883533f4f933a0a7ea42d60

Regen docs for 3.0

Summary:
~~Land after Instagram#661, Instagram#730 and D5031184~~

Rebuild the docs from script. Couple notes:

- Went from 100% to 99%, does that matter? Script output says
  - > 99% documentation coverage with 2 undocumented symbols
  - Looks like `NS_SWIFT_NAME` throws documentation for a loop on `IGListDiffOption` and `IGListExperiment`
- Swift names are different, will that be a problem?

Part of Instagram#707

Closes Instagram#728

Differential Revision: D5050951

Pulled By: jessesquires

fbshipit-source-id: 19249c1d34e6f253b911965114fd4ae7458d2684

Fixup project, update README and guides

Summary:
- Fix OCMock issues with tvOS tests
- Update README/guides
Closes Instagram#737

Differential Revision: D5052333

Pulled By: jessesquires

fbshipit-source-id: 958444d892c14dd4c75e244f20ae21bbfeec8290

final docs update for 3.0

Summary: Closes Instagram#738

Differential Revision: D5052802

Pulled By: jessesquires

fbshipit-source-id: b1ace763da9edbb7bc65ecb9af34aa791e617aa7
  • Loading branch information
heshamsalman committed May 16, 2017
1 parent 1d140e4 commit e7f04cf
Show file tree
Hide file tree
Showing 245 changed files with 8,136 additions and 2,904 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cache:
- cocoapods
- slather
- danger
- danger-swiftlint

env:
global:
Expand Down Expand Up @@ -48,6 +49,8 @@ env:
before_install:
- gem install slather --no-rdoc --no-ri --no-document --quiet
- gem install danger --version '~> 4.3'
- gem install danger-swiftlint
- ruby scripts/generate_ci_yaml.rb

script:
- set -o pipefail
Expand Down
11 changes: 6 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

The changelog for `IGListKit`. Also see the [releases](https://github.com/instagram/IGListKit/releases) on GitHub.

3.0.0 (**upcoming release**)
3.1.0 (**upcoming release**)
-----

3.0.0
-----

This release closes the [3.0.0 milestone](https://github.com/Instagram/IGListKit/milestone/3).
Expand Down Expand Up @@ -97,7 +100,7 @@ ListDiff(oldArray: [], newArray: [], .equality)
- Added `IGListBindingSectionController` which automatically binds view models to cells and animates updates at the cell level. [Ryan Nystrom](https://github.com/rnystrom) [(#494)](https://github.com/Instagram/IGListKit/pull/494)
- Added `IGListGenericSectionController` to take advantage of Objective-C (and Swift) generics and automatically store strongly-typed references to the object powering your section controller. [Ryan Nystrom](https://github.com/rnystrom) (tbd)
- Added `IGListGenericSectionController` to take advantage of Objective-C (and Swift) generics and automatically store strongly-typed references to the object powering your section controller. [Ryan Nystrom](https://github.com/rnystrom) ([301f147](https://github.com/Instagram/IGListKit/commit/301f1471c9a7a802320e07890f5e98f15ada4e2e))
- Added a debug option for IGListKit that you can print to lldb via `po [IGListDebugger dump]`. [Ryan Nystrom](https://github.com/rnystrom) [(#617)](https://github.com/Instagram/IGListKit/pull/617)
Expand Down Expand Up @@ -129,7 +132,7 @@ ListDiff(oldArray: [], newArray: [], .equality)
- Fix a crash when inserting or deleting from the same index within the same batch-update application. [Ryan Nystrom](https://github.com/rnystrom) [(#616)](https://github.com/Instagram/IGListKit/pull/616)
- `IGListSectionType` protocol was removed and its methods were absorted into the `IGListSectionController` base class with default implementations. [Ryan Nystrom](https://github.com/rnystrom) (tbd)
- `IGListSectionType` protocol was removed and its methods were absorted into the `IGListSectionController` base class with default implementations. [Ryan Nystrom](https://github.com/rnystrom) ([3102852](https://github.com/Instagram/IGListKit/commit/3102852ce258274e8727f9094695a9c331e1abf3))
- When setting the collection view on `IGListAdapter`, its layout is now properly invalidated. [Jesse Squires](https://github.com/jessesquires) [(#677)](https://github.com/Instagram/IGListKit/pull/677)
Expand Down Expand Up @@ -158,8 +161,6 @@ This release closes the [2.1.0 milestone](https://github.com/Instagram/IGListKit
- `-[IGListAdapter updater]` is now public (read-only). [Adlai-Holler](https://github.com/Adlai-Holler) [(#379)](https://github.com/Instagram/IGListKit/pull/379)
### Fixes
- Avoid `UICollectionView` crashes when queueing a reload and insert/delete on the same item as well as reloading an item in a section that is animating. [Ryan Nystrom](https://github.com/rnystrom) [(#325)](https://github.com/Instagram/IGListKit/pull/325)
Expand Down
3 changes: 3 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ has_doc_changes = !git.modified_files.grep(/docs/).empty?
if has_doc_changes
warn("Docs are regenerated when creating new releases.")
end

swiftlint.config_file = '.swiftlint_CI.yml'
swiftlint.lint_files
37 changes: 37 additions & 0 deletions Examples/.swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
opt_in_rules: # some rules are only opt-in
- empty_count
included:
- IGListKitExamples
- IGListKitMessageExample
- IGListKitTodayExample
excluded:
- Pods
force_cast: warning
force_try: warning
weak_delegate: error
line_length: 140
type_body_length:
warning: 300
error: 400
file_length:
warning: 500
error: 1200
type_name:
min_length: 4
max_length:
warning: 40
error: 50
excluded: iPhone
identifier_name:
min_length:
error: 4
excluded:
- id
- URL
- pk
- day
- map
- row
- nib
- GlobalAPIKey
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit, html, emoji)
Original file line number Diff line number Diff line change
Expand Up @@ -15,68 +15,67 @@
import XCTest

final class DemosViewControllerUITests: UITestCase {

func test_whenSelectingTailLoading_thatTailLoadingDetailScreenIsPresented() {
enterAndAssertScreen(withTitle: "Tail Loading")
}

func test_whenSelectingSearchAutocomplete_thatSearchAutocompleteDetailScreenIsPresented() {
enterAndAssertScreen(withTitle: "Search Autocomplete")
}

func test_whenSelectingMixedData_thatMixedDataDetailScreenIsPresented() {
enterAndAssertScreen(withTitle: "Mixed Data")
}

func test_whenSelectingNestedAdapter_thatNestedAdapterDetailScreenIsPresented() {
enterAndAssertScreen(withTitle: "Nested Adapter")
}

func test_whenSelectingEmptyView_thatEmptyViewDetailScreenIsPresented() {
enterAndAssertScreen(withTitle: "Empty View")
}

func test_whenSelectingSingleSectionController_thatSingleSectionControllerScreenIsPresented() {
enterAndAssertScreen(withTitle: "Single Section Controller")
}

func test_whenSelectingStoryboard_thatStoryboardDetailScreenIsPresented() {
enterAndAssertScreen(withTitle: "Storyboard")
}

func test_whenSelectingSingleSectionStoryboard_thatSingleSectionStoryboardDetailScreenIsPresented() {
enterAndAssertScreen(withTitle: "Single Section Storyboard")
}

func test_whenSelectingWorkingRange_thatWorkingRangeDetailScreenIsPresented() {
enterAndAssertScreen(withTitle: "Working Range")
}

func test_whenSelectingDiffAlgorithm_thatDiffAlgorithmDetailScreenIsPresented() {
enterAndAssertScreen(withTitle: "Diff Algorithm")
}

func test_whenSelectingSupplementaryViews_thatSupplementaryViewsDetailScreenIsPresented() {
enterAndAssertScreen(withTitle: "Supplementary Views")
}

func test_whenSelectingSelfSizingCells_thatSelfSizingCellsDetailScreenIsPresented() {
enterAndAssertScreen(withTitle: "Self-sizing cells")
}

func test_whenSelectingDisplayDelegate_thatDisplayDelegateDetailScreenIsPresented() {
enterAndAssertScreen(withTitle: "Display delegate")
}



private func enterAndAssertScreen(withTitle title: String) {
let elem = XCUIApplication().collectionViews.cells.staticTexts[title]
if !elem.exists {
XCUIApplication().collectionViews.element.swipeUp()
}

XCTAssertTrue(elem.exists)
elem.tap()
elem.tap()
XCTAssertTrue(XCUIApplication().navigationBars[title].exists)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@
import XCTest

final class LoadMoreViewControllerUITests: UITestCase {

func test_whenScrollingToTheBottom_thatNewItemsAreLoaded() {
let collectionViews = XCUIApplication().collectionViews
collectionViews.cells.staticTexts["Tail Loading"].tap()

// Swipe up until the last element before loading new data is visible
let lastElem = collectionViews.cells.staticTexts["20"]
while !lastElem.exists || !XCUIApplication().windows.element(boundBy: 0).frame.contains(lastElem.frame) {
collectionViews.element.swipeUp()
}

// Wait for item "21" to be loaded asynchronously
let newlyLoadedElement = collectionViews.cells.staticTexts["21"]
waitToAppear(element: newlyLoadedElement)
waitToAppear(element: newlyLoadedElement)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,91 +15,91 @@
import XCTest

final class MixedDataViewControllerUITests: UITestCase {

override func setUp() {
super.setUp()
enterMixedDataDetailScreen()
}

func test_whenSelectingAll_thatAllSectionTypesArePresent() {
mixedDataNavigationBarElement().buttons["All"].tap()

XCTAssertTrue(expandableSectionElement().exists)
XCTAssertTrue(userSectionElement().exists)
XCTAssertTrue(gridSectionElement().exists)
}

func test_whenSelectingColors_thatOnlyGridSectionsArePresent() {
mixedDataNavigationBarElement().buttons["Colors"].tap()

XCTAssertFalse(expandableSectionElement().exists)
XCTAssertFalse(userSectionElement().exists)
XCTAssertTrue(gridSectionElement().exists)
}

func test_whenSelectingText_thatOnlyExpandableSectionsArePresent() {
mixedDataNavigationBarElement().buttons["Text"].tap()

XCTAssertTrue(expandableSectionElement().exists)
XCTAssertFalse(userSectionElement().exists)
XCTAssertFalse(gridSectionElement().exists)
}

func test_whenSelectingUsers_thatOnlyUserSectionsArePresent() {
mixedDataNavigationBarElement().buttons["Users"].tap()

XCTAssertFalse(expandableSectionElement().exists)
XCTAssertTrue(userSectionElement().exists)
XCTAssertFalse(gridSectionElement().exists)
}

func test_whenExpandingExpandableSection_thatHeightIsIncreased() {
mixedDataNavigationBarElement().buttons["Text"].tap()

let expandableSection = expandableSectionElement()
let collapsedFrame = expandableSection.frame

// Expand
expandableSection.tap()
let expandedFrame = expandableSection.frame

XCTAssertTrue(expandedFrame.size.height > collapsedFrame.size.height)
}

func test_whenCollapsingExpandableSection_thatHeightIsDecreased() {
mixedDataNavigationBarElement().buttons["Text"].tap()

let expandableSection = expandableSectionElement()

// Expand
expandableSection.tap()
let expandedFrame = expandableSection.frame

// Collapse
expandableSection.tap()
let collapsedFrame = expandableSection.frame

XCTAssertTrue(collapsedFrame.size.height < expandedFrame.size.height)
}

private func expandableSectionElement() -> XCUIElement {
return XCUIApplication().collectionViews.cells.staticTexts["Maecenas faucibus mollis interdum. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit."]
}

private func userSectionElement() -> XCUIElement {
return XCUIApplication().collectionViews.cells.staticTexts["@ryanolsonk"]
}

private func gridSectionElement() -> XCUIElement {
return XCUIApplication().collectionViews.cells.staticTexts["1"]
}

private func mixedDataNavigationBarElement() -> XCUIElement {
return XCUIApplication().navigationBars["Mixed Data"]
}

private func enterMixedDataDetailScreen() {
XCUIApplication().collectionViews.cells.staticTexts["Mixed Data"].tap()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,43 @@
import XCTest

final class SearchViewControllerUITests: UITestCase {

var collectionViews: XCUIElementQuery!

override func setUp() {
super.setUp()

collectionViews = XCUIApplication().collectionViews
collectionViews.cells.staticTexts["Search Autocomplete"].tap()
}

func test_whenLoading_thatSomeResultsAreShown() {
let tacos = collectionViews.cells.staticTexts["tacos"]
let small = collectionViews.cells.staticTexts["small"]
XCTAssertTrue(tacos.exists)
XCTAssertTrue(small.exists)
}

func test_whenSearchingForText_thatResultsGetFiltered() {
let searchField = collectionViews.searchFields.element
searchField.tap()
searchField.typeText("tac")

let tacos = collectionViews.cells.staticTexts["tacos"]
let small = collectionViews.cells.staticTexts["small"]
XCTAssertTrue(tacos.exists)
XCTAssertFalse(small.exists)
}

func test_whenClearingText_thatResultsFilterIsRemoved() {
let searchField = collectionViews.searchFields.element
searchField.tap()
searchField.typeText("tac")
searchField.buttons.element.tap()

let tacos = collectionViews.cells.staticTexts["tacos"]
let small = collectionViews.cells.staticTexts["small"]
XCTAssertTrue(tacos.exists)
XCTAssertTrue(small.exists)
XCTAssertTrue(small.exists)
}
}
Loading

0 comments on commit e7f04cf

Please sign in to comment.