-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(cases): refactor test cases and move html data to its own file
- Loading branch information
1 parent
8e30784
commit e4fcb09
Showing
3 changed files
with
201 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
module.exports = [ | ||
// high-level tags | ||
{ | ||
name: 'empty html', | ||
data: '<html></html>' | ||
}, | ||
{ | ||
name: 'html with attribute', | ||
data: '<html lang="en"></html>' | ||
}, | ||
{ | ||
name: 'html with empty head and body', | ||
data: '<html><head></head><body></body></html>' | ||
}, | ||
{ | ||
name: 'html with empty head', | ||
data: '<html><head></head></html>' | ||
}, | ||
{ | ||
name: 'html with empty body', | ||
data: '<html><body></body></html>' | ||
}, | ||
|
||
{ | ||
name: 'empty head', | ||
data: '<head></head>' | ||
}, | ||
{ | ||
name: 'head with title', | ||
data: '<head><title>Page</title></head>' | ||
}, | ||
{ | ||
name: 'empty head and body', | ||
data: '<head></head><body></body>' | ||
}, | ||
{ | ||
name: 'empty body', | ||
data: '<body></body>' | ||
}, | ||
{ | ||
name: 'capitalized body', | ||
data: '<BODY></BODY>' | ||
}, | ||
{ | ||
name: 'body with paragraph', | ||
data: '<body><p>text</p></body>' | ||
}, | ||
|
||
// low-level tags | ||
{ | ||
name: 'empty div', | ||
data: '<div></div>' | ||
}, | ||
{ | ||
name: 'empty paragraph', | ||
data: '<p></p>' | ||
}, | ||
{ | ||
name: 'paragraph with text', | ||
data: '<p>text</p>' | ||
}, | ||
{ | ||
name: 'meta with attribute', | ||
data: '<meta charset="utf-8">' | ||
}, | ||
{ | ||
name: 'textarea with value', | ||
data: '<textarea>value</textarea>' | ||
}, | ||
{ | ||
name: 'multiple spans', | ||
data: '<span>1</span><span>2</span>' | ||
}, | ||
|
||
// void (self-closing) tags | ||
{ | ||
name: 'void', | ||
data: '<br>' | ||
}, | ||
{ | ||
name: 'self-closing void', | ||
data: '<hr/>' | ||
}, | ||
{ | ||
name: 'input with attributes', | ||
data: '<input type="text" value="value">' | ||
}, | ||
{ | ||
name: 'image', | ||
data: '<img src="https://httpbin.org/image/png" alt="Image">' | ||
}, | ||
{ | ||
name: 'multiple void', | ||
data: '<link /><meta/><hr><input type="radio" checked />' | ||
}, | ||
|
||
// tag attributes | ||
{ | ||
name: 'h1 with id attribute', | ||
data: '<h1 id="heading"></h1>' | ||
}, | ||
{ | ||
name: 'h2 with class attribute', | ||
data: '<h2 class="heading"></h2>' | ||
}, | ||
{ | ||
name: 'em with style attribute', | ||
data: '<em style="color: white; z-index: 1; -webkit-appearance: none"></em>' | ||
}, | ||
{ | ||
name: 'data attribute', | ||
data: '<div data-attribute="value"></div>' | ||
}, | ||
{ | ||
name: 'event attribute', | ||
data: '<div onclick="alert();"></div>' | ||
}, | ||
{ | ||
name: 'span with multiple attributes', | ||
data: | ||
'<span id="button" class="big" style="border: 1px solid #000; -moz-appearance: button;" aria-label="Back" />' | ||
}, | ||
{ | ||
name: 'hr with multiple attributes', | ||
data: | ||
'<hr id="foo" class="bar baz" style="background: #fff; text-align: center;" data-foo="bar">' | ||
}, | ||
|
||
// adjacent tags | ||
{ | ||
name: 'sibling', | ||
data: '<li>brother</li><li>sister</li>' | ||
}, | ||
|
||
// nested tags | ||
{ | ||
name: 'nested definition list', | ||
data: '<dl><dt>foo</dt><dd>bar<span>baz</span></dd></dl>' | ||
}, | ||
{ | ||
name: 'nested unordered list', | ||
data: '<ul><li>foo<span>bar</span></li><li>baz</li></ul>' | ||
}, | ||
|
||
// script tag | ||
{ | ||
name: 'script', | ||
data: '<script>console.log(1 < 2);</script>' | ||
}, | ||
|
||
// style tag | ||
{ | ||
name: 'style', | ||
data: '<style>body > .foo { color: #f00; }</style>' | ||
}, | ||
|
||
// special | ||
{ | ||
name: 'directive', | ||
data: '<!doctype html>' | ||
}, | ||
{ | ||
name: 'directive with html', | ||
data: '<!DOCTYPE html><html></html>' | ||
}, | ||
{ | ||
name: 'comment', | ||
data: '<!-- comment -->' | ||
}, | ||
{ | ||
name: 'text', | ||
data: 'text' | ||
}, | ||
{ | ||
name: 'closing tag', | ||
data: '</div>' | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters