-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
223 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// | ||
// DTActionSheetTest.m | ||
// DTFoundation | ||
// | ||
// Created by Rene Pirringer on 22.07.14. | ||
// Copyright (c) 2014 Cocoanetics. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
#import <XCTest/XCTest.h> | ||
#import "DTActionSheet.h" | ||
|
||
|
||
@interface DTActionSheet(Private) <UIActionSheetDelegate> | ||
@end | ||
|
||
|
||
@implementation DTActionSheet(Private) | ||
@end | ||
|
||
|
||
@interface DTActionSheetTest : XCTestCase | ||
@end | ||
|
||
|
||
@implementation DTActionSheetTest | ||
|
||
- (void)testInitMethods { | ||
__block BOOL blockExecuted = NO; | ||
DTActionSheet *actionSheet = [[DTActionSheet alloc] init]; | ||
[actionSheet addButtonWithTitle:@"Ok" block:^{ | ||
blockExecuted = YES; | ||
}]; | ||
|
||
[actionSheet actionSheet:actionSheet clickedButtonAtIndex:actionSheet.numberOfButtons - 1]; | ||
|
||
XCTAssertTrue(blockExecuted, @"The ok button block should be executed"); | ||
|
||
blockExecuted = NO; | ||
actionSheet = [[DTActionSheet alloc] initWithTitle:@"Foo"]; | ||
[actionSheet addButtonWithTitle:@"Ok" block:^{ | ||
blockExecuted = YES; | ||
}]; | ||
|
||
[actionSheet actionSheet:actionSheet clickedButtonAtIndex:actionSheet.numberOfButtons - 1]; | ||
|
||
XCTAssertTrue(blockExecuted, @"The ok button block should be executed"); | ||
|
||
blockExecuted = NO; | ||
actionSheet = [[DTActionSheet alloc] initWithTitle:@"Foo" delegate:nil cancelButtonTitle:@"cancel" destructiveButtonTitle:nil otherButtonTitles:@"a", @"b", nil]; | ||
[actionSheet addButtonWithTitle:@"Ok" block:^{ | ||
blockExecuted = YES; | ||
}]; | ||
|
||
[actionSheet actionSheet:actionSheet clickedButtonAtIndex:actionSheet.numberOfButtons - 1]; | ||
|
||
XCTAssertTrue(blockExecuted, @"The ok button block should be executed"); | ||
} | ||
|
||
|
||
@end |
Oops, something went wrong.