Skip to content

Commit

Permalink
Added unit test for Cocoanetics#358
Browse files Browse the repository at this point in the history
  • Loading branch information
odrobnik authored and Yifan Zhang committed Mar 25, 2013
1 parent 2e53667 commit c22b7ec
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Core/Test/Source/DTCSSStylesheetTest.m
Expand Up @@ -42,6 +42,25 @@ - (void)testAttributeWithWhitespace
STAssertEqualObjects(empty2, @"", @"empty2 should match");
}

- (void)testImportant
{
NSString *string = @"p {align: center !IMPORTANT;color:blue;}";

DTCSSStylesheet *stylesheet = [[DTCSSStylesheet alloc] initWithStyleBlock:string];

NSDictionary *styles = [stylesheet.styles objectForKey:@"p"];

STAssertEquals([styles count], 2u, @"There should be 2 styles");

NSString *alignStyle = [styles objectForKey:@"align"];

STAssertEqualObjects(alignStyle, @"center", @"Align should be 'center', but is '%@'", alignStyle);

NSString *colorStyle = [styles objectForKey:@"color"];

STAssertEqualObjects(colorStyle, @"blue", @"Color should be 'blue', but is '%@'", colorStyle);
}

- (void)testMerging
{
DTCSSStylesheet *stylesheet = [[DTCSSStylesheet defaultStyleSheet] copy];
Expand Down

0 comments on commit c22b7ec

Please sign in to comment.