|
| 1 | +// |
| 2 | +// JSBUIViewTest.m |
| 3 | +// JavaScriptBridge |
| 4 | +// |
| 5 | +// Created by kishikawa katsumi on 2014/01/25. |
| 6 | +// Copyright (c) 2014 kishikawa katsumi. All rights reserved. |
| 7 | +// |
| 8 | + |
| 9 | +#import <XCTest/XCTest.h> |
| 10 | +#import "JavaScriptBridge.h" |
| 11 | + |
| 12 | +@interface JSBUIViewTest : XCTestCase |
| 13 | + |
| 14 | +@end |
| 15 | + |
| 16 | +@implementation JSBUIViewTest |
| 17 | + |
| 18 | +- (void)setUp |
| 19 | +{ |
| 20 | + [super setUp]; |
| 21 | +} |
| 22 | + |
| 23 | +- (void)tearDown |
| 24 | +{ |
| 25 | + [super tearDown]; |
| 26 | +} |
| 27 | + |
| 28 | +- (void)testExample |
| 29 | +{ |
| 30 | + JSContext *context = [[JSContext alloc] init]; |
| 31 | + [context addScriptingSupport:@"UIKit"]; |
| 32 | + |
| 33 | + JSValue *value = nil; |
| 34 | + |
| 35 | + [context evaluateScript:@"var view = UIView.new();"]; |
| 36 | + |
| 37 | + [context evaluateScript:@"UIView.performWithoutAnimation(view); var a = UIView.new();"]; |
| 38 | + value = context[@"a"]; |
| 39 | + XCTAssertTrue(value && !value.isUndefined); |
| 40 | + |
| 41 | + [context evaluateScript:@"UIView.animateWithDurationDelayOptionsAnimationsCompletion(0.5, 1.0, 0, function() {}, function(sucess) {}); var b = UIView.new();"]; |
| 42 | + value = context[@"b"]; |
| 43 | + XCTAssertTrue(value && !value.isUndefined); |
| 44 | + |
| 45 | + [context evaluateScript:@"UIView.animateWithDurationAnimationsCompletion(0.5, function() {}, function(sucess) {}); var c = UIView.new();"]; |
| 46 | + value = context[@"c"]; |
| 47 | + XCTAssertTrue(value && !value.isUndefined); |
| 48 | + |
| 49 | + [context evaluateScript:@"UIView.animateWithDurationAnimations(0.5, function() {}); var d = UIView.new();"]; |
| 50 | + value = context[@"d"]; |
| 51 | + XCTAssertTrue(value && !value.isUndefined); |
| 52 | + |
| 53 | + [context evaluateScript:@"UIView.animateWithDurationDelayUsingSpringWithDampingInitialSpringVelocityOptionsAnimationsCompletion(0.5, 1.0, 0.5, 0.5, 0, function() {}, function(sucess) {}); var e = UIView.new();"]; |
| 54 | + value = context[@"e"]; |
| 55 | + XCTAssertTrue(value && !value.isUndefined); |
| 56 | + |
| 57 | + [context evaluateScript:@"UIView.transitionWithViewDurationOptionsAnimationsCompletion(view, 0.5, 0, function() {}, function(sucess) {}); var f = UIView.new();"]; |
| 58 | + value = context[@"f"]; |
| 59 | + XCTAssertTrue(value && !value.isUndefined); |
| 60 | + |
| 61 | + [context evaluateScript:@"UIView.transitionFromViewToViewDurationOptionsCompletion(view, UIView.new(), 0.5, 0, function(sucess) {}); var g = UIView.new();"]; |
| 62 | + value = context[@"g"]; |
| 63 | + XCTAssertTrue(value && !value.isUndefined); |
| 64 | + |
| 65 | + [context evaluateScript:@"UIView.performSystemAnimationOnViewsOptionsAnimationsCompletion(0, [view], 0.5, 0, function(sucess) {}); var h = UIView.new();"]; |
| 66 | + value = context[@"h"]; |
| 67 | + XCTAssertTrue(value && !value.isUndefined); |
| 68 | + |
| 69 | + [context evaluateScript:@"UIView.animateKeyframesWithDurationDelayOptionsAnimationsCompletion(0.5, 1.0, 0, function() {}, function(sucess) {}); var i = UIView.new();"]; |
| 70 | + value = context[@"i"]; |
| 71 | + XCTAssertTrue(value && !value.isUndefined); |
| 72 | +#if 0 |
| 73 | + [context evaluateScript:@"UIView.addKeyframeWithRelativeStartTimeRelativeDurationAnimations(0.0, 1.0, function() {}); var j = UIView.new();"]; |
| 74 | + value = context[@"j"]; |
| 75 | + XCTAssertTrue(value && !value.isUndefined); |
| 76 | +#endif |
| 77 | +} |
| 78 | + |
| 79 | +@end |
0 commit comments