mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-12 21:51:28 +00:00
Merge branch '0.9.1' of github.com:280north/cappuccino into 0.9.1
This commit is contained in:
+21
-6
@@ -2167,23 +2167,38 @@ setBoundsOrigin:
|
||||
|
||||
- (CPView)previousValidKeyView
|
||||
{
|
||||
var result = [self previousKeyView];
|
||||
var result = [self previousKeyView],
|
||||
firstResult = result;
|
||||
|
||||
while (result && ![result canBecomeKeyView])
|
||||
{
|
||||
result = [result previousKeyView];
|
||||
|
||||
// Cycled.
|
||||
if (result === firstResult)
|
||||
return nil;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (void)_setPreviousKeyView:(CPView)previous
|
||||
{
|
||||
_previousKeyView = previous;
|
||||
if ([previous isEqual:self])
|
||||
_previousKeyView = nil;
|
||||
else
|
||||
_previousKeyView = previous;
|
||||
}
|
||||
|
||||
- (void)setNextKeyView:(CPView)next
|
||||
{
|
||||
_nextKeyView = next;
|
||||
[_nextKeyView _setPreviousKeyView:self];
|
||||
if ([next isEqual:self])
|
||||
_nextKeyView = nil;
|
||||
else
|
||||
{
|
||||
_nextKeyView = next;
|
||||
[_nextKeyView _setPreviousKeyView:self];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -2732,12 +2747,12 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
|
||||
|
||||
var nextKeyView = [self nextKeyView];
|
||||
|
||||
if (nextKeyView !== nil)
|
||||
if (nextKeyView !== nil && ![nextKeyView isEqual:self])
|
||||
[aCoder encodeConditionalObject:nextKeyView forKey:CPViewNextKeyViewKey];
|
||||
|
||||
var previousKeyView = [self previousKeyView];
|
||||
|
||||
if (previousKeyView !== nil)
|
||||
if (previousKeyView !== nil && ![previousKeyView isEqual:self])
|
||||
[aCoder encodeConditionalObject:previousKeyView forKey:CPViewPreviousKeyViewKey];
|
||||
|
||||
[aCoder encodeObject:[self themeClass] forKey:CPViewThemeClassKey];
|
||||
|
||||
@@ -205,7 +205,20 @@ var concat = Array.prototype.concat,
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the last object in the array. If the array is empty, returns \c nil/
|
||||
Returns the first object in the array. If the array is empty, returns \c nil
|
||||
*/
|
||||
- (id)firstObject
|
||||
{
|
||||
var count = [self count];
|
||||
|
||||
if (count > 0)
|
||||
return [self objectAtIndex:0];
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the last object in the array. If the array is empty, returns \c nil
|
||||
*/
|
||||
- (id)lastObject
|
||||
{
|
||||
|
||||
+1
-2
@@ -189,8 +189,7 @@ CPURLCustomIconKey = @"CPURLCustomIconKey";
|
||||
return YES;
|
||||
|
||||
// Is checking if baseURL isEqual correct? Does "identical" mean same object or equivalent values?
|
||||
return [self relativeString] === [aURL relativeString] &&
|
||||
([self baseURL] === [aURL baseURL] || [[self baseURL] isEqual:[aURL baseURL]]);
|
||||
return [[self absoluteString] isEqual:[aURL absoluteString]];
|
||||
}
|
||||
|
||||
- (CPString)lastPathComponent
|
||||
|
||||
@@ -51,6 +51,14 @@
|
||||
[self assert:[[arrayClass arrayWithObjects:0, 1, nil, 2, nil] count] same:2];
|
||||
}
|
||||
|
||||
- (void)test_firstObject
|
||||
{
|
||||
var arrayClass = [[self class] arrayClass];
|
||||
|
||||
[self assert:[[arrayClass array] firstObject] same:nil];
|
||||
[self assert:[[arrayClass arrayWithObjects:0, 1, 2] firstObject] same:0];
|
||||
}
|
||||
|
||||
- (void)test_lastObject
|
||||
{
|
||||
var arrayClass = [[self class] arrayClass];
|
||||
|
||||
@@ -112,12 +112,14 @@ var exampleProtocol = "http",
|
||||
{
|
||||
var url = [CPURL URLWithString:@"http://www.cappuccino.org"],
|
||||
url2 = [CPURL URLWithString:@"http://www.cappuccino.org"],
|
||||
url3 = [CPURL URLWithString:@"http://www.cappuccino.org/index.html"];
|
||||
url3 = [CPURL URLWithString:@"http://www.cappuccino.org/index.html"],
|
||||
url4 = [CPURL URLWithString:@"http://www.cappuccino.org//index.html"];
|
||||
|
||||
[self assert:url equals:url];
|
||||
[self assert:url equals:url2];
|
||||
[self assert:url notEqual:url3];
|
||||
[self assert:url notEqual:[CPNull null]];
|
||||
[self assert:url3 equals:url4];
|
||||
}
|
||||
|
||||
- (void)testIsEqualToURL
|
||||
|
||||
Reference in New Issue
Block a user