mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-30 20:07:36 +00:00
CPPopUpButtonTest test CPContentValuesBinding with value transformer. Currently failing.
This commit is contained in:
1 parent
e5f4a7c39a
commit
c7a8124be8
1 file changed
+30
@@ -398,8 +398,38 @@
|
||||
[self assert:0 equals:[[self button] indexOfSelectedItem]];
|
||||
}
|
||||
|
||||
- (void)testContentValuesWithValueTransformer
|
||||
{
|
||||
var arrayController = [[CPArrayController alloc] init],
|
||||
martin = [CPDictionary dictionaryWithJSObject:{@"name": @"Martin"}],
|
||||
malte = [CPDictionary dictionaryWithJSObject:{@"name": @"Malte"}],
|
||||
johan = [CPDictionary dictionaryWithJSObject:{@"name": @"Johan"}],
|
||||
menuObjects = [martin, malte, johan];
|
||||
|
||||
[arrayController setContent:menuObjects];
|
||||
|
||||
[button bind:CPContentBinding toObject:arrayController withKeyPath:@"arrangedObjects" options:nil];
|
||||
var options = [CPDictionary dictionary];
|
||||
[options setObject:[ContentValuesTransformer new] forKey:CPValueTransformerBindingOption];
|
||||
[button bind:CPContentValuesBinding toObject:arrayController withKeyPath:@"arrangedObjects.name" options:options];
|
||||
|
||||
[self assert:@"Transformed-Malte" equals:[[[self button] itemAtIndex:1] title]];
|
||||
}
|
||||
|
||||
- (void)actionTest:(id)sender
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation ContentValuesTransformer : CPValueTransformer
|
||||
{
|
||||
}
|
||||
|
||||
- (id)transformedValue:(id)aValue
|
||||
{
|
||||
return "Transformed-" + aValue;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user