Skip to content

Commit

Permalink
Added unit test #1183
Browse files Browse the repository at this point in the history
  • Loading branch information
odrobnik committed Jul 31, 2020
1 parent ce48bdf commit 27ab92f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Test/Source/DTCSSStylesheetTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,35 @@ - (void)testAttributeWithWhitespace
XCTAssertEqualObjects(empty2, @"", @"empty2 should match");
}

// Issue 1183

- (void)testEmptyFontFamily
{
NSString *string = @"span { font-family: ''; empty: ; empty2:; font-size: 16px; line-height: 20 px; font-style: italic }";

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

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

NSString *fontFamily = [styles objectForKey:@""];
XCTAssertNil(fontFamily, @"font-family should be nil");

NSString *fontSize = [styles objectForKey:@"font-size"];
XCTAssertEqualObjects(fontSize, @"16px", @"font-size should match");

NSString *lineHeight = [styles objectForKey:@"line-height"];
XCTAssertEqualObjects(lineHeight, @"20 px", @"line-height should match");

NSString *fontStyle = [styles objectForKey:@"font-style"];
XCTAssertEqualObjects(fontStyle, @"italic", @"font-style should match");

NSString *empty = [styles objectForKey:@"empty"];
XCTAssertEqualObjects(empty, @"", @"empty should match");

NSString *empty2 = [styles objectForKey:@"empty2"];
XCTAssertEqualObjects(empty2, @"", @"empty2 should match");
}

// the !important CSS tag should be ignored
- (void)testImportant
{
Expand Down

0 comments on commit 27ab92f

Please sign in to comment.