mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-12-02 11:12:58 +00:00
Fix a few failing tests, and a bad import.
Reviewed by me.
This commit is contained in:
1 parent
f8ffb4abbd
commit
e964c60830
3 files changed
+30
-7
No files matched your search
@@ -182,7 +182,7 @@
|
||||
|
||||
- (CPArray)selectedObjects
|
||||
{
|
||||
return [[_CPObservableArray alloc] initWithObjects:[_contentObject] count:1];
|
||||
return [[_CPObservableArray alloc] initWithArray:[_contentObject]];
|
||||
}
|
||||
|
||||
- (id)selection
|
||||
@@ -367,10 +367,10 @@ var CPObjectControllerContentKey = @"CPObjectControllerCo
|
||||
|
||||
- (id)initWithArray:(CPArray)anArray
|
||||
{
|
||||
if (self = [super initWithArray:anArray])
|
||||
{
|
||||
_observationProxies = [];
|
||||
}
|
||||
self = [super initWithArray:anArray];
|
||||
|
||||
self.isa = [_CPObservableArray class];
|
||||
self._observationProxies = [];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
@import <Foundation/Foundation.j>
|
||||
@import <AppKit/AppKit.j>
|
||||
@import "../../Foundation/CPUserDefaults.j"
|
||||
|
||||
|
||||
CPUserDefaultsTestKey1 = @"KEY1";
|
||||
CPUserDefaultsTestKey2 = @"KEY2";
|
||||
@@ -136,7 +136,7 @@ CPUserDefaultsTestKey2 = @"KEY2";
|
||||
- (void)testArray
|
||||
{
|
||||
[target setObject:[@"a", @"b", 3] forKey:CPUserDefaultsTestKey1];
|
||||
[self assert:[[target arrayForKey:CPUserDefaultsTestKey1] class] equals:CPArray];
|
||||
[self assertTrue:[[target arrayForKey:CPUserDefaultsTestKey1] isKindOfClass:CPArray]];
|
||||
[self assert:[[target arrayForKey:CPUserDefaultsTestKey1] objectAtIndex:1] equals:@"b"];
|
||||
[self assert:[[target arrayForKey:CPUserDefaultsTestKey1] objectAtIndex:2] equals:3];
|
||||
[self assert:[target stringArrayForKey:CPUserDefaultsTestKey1] equals:nil];
|
||||
|
||||
@@ -102,6 +102,29 @@
|
||||
@end
|
||||
|
||||
@implementation MyArray : CPArray
|
||||
{
|
||||
CPArray _storage;
|
||||
}
|
||||
|
||||
- (id)initWithObjects:(id)anObject, ...
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
if (self)
|
||||
_storage = [[CPArray alloc] initWithObjects:Array.prototype.slice.call(arguments, 2)];
|
||||
|
||||
return self
|
||||
}
|
||||
|
||||
- (id)objectAtIndex:(CPUInteger)anIndex
|
||||
{
|
||||
return [_storage objectAtIndex:anIndex];
|
||||
}
|
||||
|
||||
- (CPUInteger)count
|
||||
{
|
||||
return [_storage count];
|
||||
}
|
||||
|
||||
- (id)newMessage
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user