Use HTMLElement's designated initialiser in tests

Fixes #43
This commit is contained in:
Iskandar Abudiab
2021-04-29 18:14:15 +02:00
parent 26ee9e683f
commit 3333274cfb
5 changed files with 36 additions and 36 deletions
+2 -2
View File
@@ -2217,7 +2217,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.9;
MACOSX_DEPLOYMENT_TARGET = 10.15;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
@@ -2265,7 +2265,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.9;
MACOSX_DEPLOYMENT_TARGET = 10.15;
SDKROOT = macosx;
};
name = Release;
+1 -1
View File
@@ -51,7 +51,7 @@
[_cases addObject:_currentCase];
}
- (void)testCase:(XCTestCase *)testCase didFailWithDescription:(NSString *)description inFile:(NSString *)filePath atLine:(NSUInteger)lineNumber
- (void)testCase:(XCTestCase *)testCase didRecordIssue:(XCTIssue *)issue
{
_currentCase[@"status"] = @"Failed";
}
@@ -28,7 +28,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
parent = [HTMLDocumentFragment new];
XCTAssertNoThrow([parent appendNode:element]);
parent = [HTMLElement new];
parent = [[HTMLElement alloc] initWithTagName:@"div"];
XCTAssertNoThrow([parent appendNode:element]);
parent = [HTMLTemplate new];
@@ -54,7 +54,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
parent = [HTMLDocumentFragment new];
XCTAssertNoThrow([parent insertNode:element beforeChildNode:nil]);
parent = [HTMLElement new];
parent = [[HTMLElement alloc] initWithTagName:@"div"];
XCTAssertNoThrow([parent insertNode:element beforeChildNode:nil]);
parent = [HTMLTemplate new];
@@ -115,9 +115,9 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
XCTAssertNoThrow([document appendNode:[HTMLDocumentFragment new]]);
XCTAssertNoThrow([document appendNode:[HTMLDocumentType new]]);
XCTAssertNoThrow([document appendNode:[HTMLElement new]]);
XCTAssertNoThrow([document appendNode:[[HTMLElement alloc] initWithTagName:@"div"]]);
HTMLElement *element = [HTMLElement new];
HTMLElement *element = [[HTMLElement alloc] initWithTagName:@"div"];
XCTAssertNoThrow([element appendNode:[HTMLTemplate new]]);
XCTAssertNoThrow([element appendNode:[HTMLComment new]]);
@@ -132,7 +132,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
XCTAssertThrows([[HTMLDocumentFragment new] appendNode:doctype]);
XCTAssertThrows([[HTMLDocumentType new] appendNode:doctype]);
XCTAssertThrows([[HTMLElement new] appendNode:doctype]);
XCTAssertThrows([[[HTMLElement alloc] initWithTagName:@"div"] appendNode:doctype]);
XCTAssertThrows([[HTMLTemplate new] appendNode:doctype]);
XCTAssertThrows([[HTMLComment new] appendNode:doctype]);
XCTAssertThrows([[HTMLText new] appendNode:doctype]);
@@ -148,7 +148,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
XCTAssertThrows([[HTMLText new] appendNode:text]);
XCTAssertNoThrow([[HTMLDocumentFragment new] appendNode:text]);
XCTAssertNoThrow([[HTMLElement new] appendNode:text]);
XCTAssertNoThrow([[[HTMLElement alloc] initWithTagName:@"div"] appendNode:text]);
XCTAssertNoThrow([[HTMLTemplate new] appendNode:text]);
}
@@ -172,8 +172,8 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
* Fragment has more than one Element child
*/
reset();
[fragment appendNode:[HTMLElement new]];
[fragment appendNode:[HTMLElement new]];
[fragment appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
[fragment appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
XCTAssertThrows([document appendNode:fragment]);
@@ -182,8 +182,8 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
* Document has an Element child
*/
reset();
[fragment appendNode:[HTMLElement new]];
[document appendNode:[HTMLElement new]];
[fragment appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
[document appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
XCTAssertThrows([document appendNode:fragment]);
/**
@@ -192,7 +192,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
*/
reset();
HTMLDocumentType *doctype = [HTMLDocumentType new];
[fragment appendNode:[HTMLElement new]];
[fragment appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
[document appendNode:doctype];
XCTAssertThrows([document insertNode:fragment beforeChildNode:doctype]);
@@ -202,7 +202,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
*/
reset();
HTMLComment *doctypePreviousSibling = [HTMLComment new];
[fragment appendNode:[HTMLElement new]];
[fragment appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
[document appendNode:doctypePreviousSibling];
[document appendNode:doctype];
XCTAssertThrows([document insertNode:fragment beforeChildNode:doctypePreviousSibling]);
@@ -211,7 +211,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
- (void)testValidElementInsertionIntoDocument
{
HTMLDocument *document = [HTMLDocument new];
HTMLElement *element = [HTMLElement new];
HTMLElement *element = [[HTMLElement alloc] initWithTagName:@"div"];
void (^ reset)(void) = ^ {
[element removeAllChildNodes];
@@ -221,7 +221,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
/**
* Document has an Element child
*/
[document appendNode:[HTMLElement new]];
[document appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
XCTAssertThrows([document appendNode:element]);
/**
@@ -262,7 +262,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
*/
reset();
HTMLComment *secondChild = [HTMLComment new];
[document appendNode:[HTMLElement new]];
[document appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
[document appendNode:secondChild];
XCTAssertThrows([document insertNode:doctype beforeChildNode:secondChild]);
@@ -270,7 +270,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
* Document has an Element child
*/
reset();
[document appendNode:[HTMLElement new]];
[document appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
XCTAssertThrows([document appendNode:doctype]);
}
@@ -296,8 +296,8 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
* Replacement Fragment has more than one Element child
*/
reset();
[replacement appendNode:[HTMLElement new]];
[replacement appendNode:[HTMLElement new]];
[replacement appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
[replacement appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
XCTAssertThrows([document replaceChildNode:child withNode:replacement]);
/**
@@ -305,8 +305,8 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
* Document has an Element child that is not the Replacement
*/
reset();
[replacement appendNode:[HTMLElement new]];
[document appendNode:[HTMLElement new]];
[replacement appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
[document appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
XCTAssertThrows([document replaceChildNode:child withNode:replacement]);
/**
@@ -315,7 +315,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
*/
reset();
HTMLDocumentType *doctype = [HTMLDocumentType new];
[replacement appendNode:[HTMLElement new]];
[replacement appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
[document appendNode:doctype];
XCTAssertThrows([document replaceChildNode:child withNode:replacement]);
}
@@ -324,7 +324,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
{
HTMLDocument *document = [HTMLDocument new];
HTMLComment *child = [HTMLComment new];
HTMLElement *replacement = [HTMLElement new];
HTMLElement *replacement = [[HTMLElement alloc] initWithTagName:@"div"];
void (^ reset)(void) = ^ {
[replacement removeAllChildNodes];
@@ -335,7 +335,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
/**
* Docment has an Element child that is not replacement
*/
[document appendNode:[HTMLElement new]];
[document appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
XCTAssertThrows([document replaceChildNode:child withNode:replacement]);
/**
@@ -369,7 +369,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
* An Element is preceding the child node
*/
reset();
[document insertNode:[HTMLElement new] beforeChildNode:child];
[document insertNode:[[HTMLElement alloc] initWithTagName:@"div"] beforeChildNode:child];
XCTAssertThrows([document replaceChildNode:child withNode:replacement]);
}
+8 -8
View File
@@ -53,8 +53,8 @@
XCTAssertEqual(element.childNodesCount, 1);
XCTAssertEqual(element.firstChild, comment);
HTMLElement *firstElement = [HTMLElement new];
HTMLElement *secondElement = [HTMLElement new];
HTMLElement *firstElement = [[HTMLElement alloc] initWithTagName:@"div"];
HTMLElement *secondElement = [[HTMLElement alloc] initWithTagName:@"div"];
NSArray *nodes = @[firstElement, secondElement];
[element appendNodes:nodes];
@@ -76,8 +76,8 @@
XCTAssertEqual(element.childNodesCount, 2);
XCTAssertEqual(element.firstChild, comment);
HTMLElement *firstElement = [HTMLElement new];
HTMLElement *secondElement = [HTMLElement new];
HTMLElement *firstElement = [[HTMLElement alloc] initWithTagName:@"div"];
HTMLElement *secondElement = [[HTMLElement alloc] initWithTagName:@"div"];
NSArray *nodes = @[firstElement, secondElement];
[element prependNodes:nodes];
@@ -94,8 +94,8 @@
[element appendNode:comment];
HTMLDocumentFragment *fragment = [HTMLDocumentFragment new];
HTMLElement *firstChild = [HTMLElement new];
HTMLElement *secondChild = [HTMLElement new];
HTMLElement *firstChild = [[HTMLElement alloc] initWithTagName:@"div"];
HTMLElement *secondChild = [[HTMLElement alloc] initWithTagName:@"div"];
[fragment appendNode:firstChild];
[fragment appendNode:secondChild];
@@ -494,7 +494,7 @@
XCTAssertTrue([paragraph compareDocumentPositionWithNode:paragraph] == HTMLDocumentPositionEquivalent);
HTMLElement *element = [HTMLElement new];
HTMLElement *element = [[HTMLElement alloc] initWithTagName:@"div"];
XCTAssertTrue([paragraph compareDocumentPositionWithNode:element] == HTMLDocumentPositionPreceding);
XCTAssertTrue([paragraph compareDocumentPositionWithNode:image] == HTMLDocumentPositionPreceding);
@@ -556,7 +556,7 @@
#pragma mark - Bug Fixes
- (void)testBugFix_Issue_20 {
HTMLElement *element = [HTMLElement new];
HTMLElement *element = [[HTMLElement alloc] initWithTagName:@"div"];
element.elementId = @"originalId";
HTMLElement *clone = [element cloneNodeDeep:YES];
+1 -1
View File
@@ -103,7 +103,7 @@
{
HTMLRange *range = [[HTMLRange alloc] initWithDocument:_document];
XCTAssertThrows([range setStartNode:[HTMLElement new] startOffset:0], @"Cannot set boundary to a node outside of the range's document");
XCTAssertThrows([range setStartNode:[[HTMLElement alloc] initWithTagName:@"div"] startOffset:0], @"Cannot set boundary to a node outside of the range's document");
XCTAssertThrows([range setStartNode:[HTMLDocumentType new] startOffset:0], @"DOCTYPE as range boundary is invalid");
XCTAssertThrows([range setStartNode:_firstText startOffset:_firstText.length + 1], @"Offset is outside the boundary node");