diff --git a/.travis.yml b/.travis.yml index eebd849..65d5a4a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ osx_image: xcode8.1 branches: only: - master - + - develop env: global: - PROJECT_NAME="Spinner.xcodeproj" @@ -31,4 +31,4 @@ script: - xcodebuild -project "$PROJECT_NAME" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Release ONLY_ACTIVE_ARCH=NO build | xcpretty; after_success: -- bash <(curl -s https://codecov.io/bash) \ No newline at end of file +- bash <(curl -s https://codecov.io/bash) diff --git a/SpinnerTests/SpinnerTests.swift b/SpinnerTests/SpinnerTests.swift index 910ac66..65fa911 100644 --- a/SpinnerTests/SpinnerTests.swift +++ b/SpinnerTests/SpinnerTests.swift @@ -119,6 +119,24 @@ class SpinnerTests: XCTestCase { XCTAssertTrue(view.isUserInteractionEnabled) } + func testShowCustomSpinnerInButton() { + _ = SpinnerView.showCustomSpinner(inButton: button, disablesUserInteraction: true) + var hasSpinner = button.subviews.contains {$0 is Spinner} + XCTAssert(hasSpinner && !button.isUserInteractionEnabled) + + _ = SpinnerView.showCustomSpinner(inButton: button, disablesUserInteraction: false) + hasSpinner = button.subviews.contains {$0 is Spinner} + XCTAssert(hasSpinner && button.isUserInteractionEnabled) + } + + func testDismissCustomSpinnerInButton() { + let spinner = SpinnerView.showCustomSpinner(inButton: button, disablesUserInteraction: true) + spinner.dismiss() + let hasSpinner = button.subviews.contains {$0 is Spinner} + XCTAssertFalse(hasSpinner) + XCTAssertTrue(view.isUserInteractionEnabled) + } + func testShowSpinnerInButtonWithAttributedSting() { button.isUserInteractionEnabled = true