aboutsummaryrefslogtreecommitdiff
path: root/node_modules/domhandler/test
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/domhandler/test')
-rw-r--r--node_modules/domhandler/test/cases/01-basic.json41
-rw-r--r--node_modules/domhandler/test/cases/02-single_tag_1.json21
-rw-r--r--node_modules/domhandler/test/cases/03-single_tag_2.json21
-rw-r--r--node_modules/domhandler/test/cases/04-unescaped_in_script.json27
-rw-r--r--node_modules/domhandler/test/cases/05-tags_in_comment.json18
-rw-r--r--node_modules/domhandler/test/cases/06-comment_in_script.json18
-rw-r--r--node_modules/domhandler/test/cases/07-unescaped_in_style.json20
-rw-r--r--node_modules/domhandler/test/cases/08-extra_spaces_in_tag.json20
-rw-r--r--node_modules/domhandler/test/cases/09-unquoted_attrib.json20
-rw-r--r--node_modules/domhandler/test/cases/10-singular_attribute.json15
-rw-r--r--node_modules/domhandler/test/cases/11-text_outside_tags.json20
-rw-r--r--node_modules/domhandler/test/cases/12-text_only.json11
-rw-r--r--node_modules/domhandler/test/cases/13-comment_in_text.json19
-rw-r--r--node_modules/domhandler/test/cases/14-comment_in_text_in_script.json18
-rw-r--r--node_modules/domhandler/test/cases/15-non-verbose.json22
-rw-r--r--node_modules/domhandler/test/cases/16-normalize_whitespace.json47
-rw-r--r--node_modules/domhandler/test/cases/17-xml_namespace.json18
-rw-r--r--node_modules/domhandler/test/cases/18-enforce_empty_tags.json16
-rw-r--r--node_modules/domhandler/test/cases/19-ignore_empty_tags.json20
-rw-r--r--node_modules/domhandler/test/cases/20-template_script_tags.json20
-rw-r--r--node_modules/domhandler/test/cases/21-conditional_comments.json15
-rw-r--r--node_modules/domhandler/test/cases/22-lowercase_tags.json41
-rw-r--r--node_modules/domhandler/test/tests.js59
23 files changed, 0 insertions, 547 deletions
diff --git a/node_modules/domhandler/test/cases/01-basic.json b/node_modules/domhandler/test/cases/01-basic.json
deleted file mode 100644
index e7952ec9e..000000000
--- a/node_modules/domhandler/test/cases/01-basic.json
+++ /dev/null
@@ -1,41 +0,0 @@
-{
- "name": "Basic test",
- "options": {},
- "html": "<!DOCTYPE html><html><title>The Title</title><body>Hello world</body></html>",
- "expected": [
- {
- "name": "!doctype",
- "data": "!DOCTYPE html",
- "type": "directive"
- },
- {
- "type": "tag",
- "name": "html",
- "attribs": {},
- "children": [
- {
- "type": "tag",
- "name": "title",
- "attribs": {},
- "children": [
- {
- "data": "The Title",
- "type": "text"
- }
- ]
- },
- {
- "type": "tag",
- "name": "body",
- "attribs": {},
- "children": [
- {
- "data": "Hello world",
- "type": "text"
- }
- ]
- }
- ]
- }
- ]
-} \ No newline at end of file
diff --git a/node_modules/domhandler/test/cases/02-single_tag_1.json b/node_modules/domhandler/test/cases/02-single_tag_1.json
deleted file mode 100644
index 51ff84577..000000000
--- a/node_modules/domhandler/test/cases/02-single_tag_1.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "name": "Single Tag 1",
- "options": {},
- "html": "<br>text</br>",
- "expected": [
- {
- "type": "tag",
- "name": "br",
- "attribs": {}
- },
- {
- "data": "text",
- "type": "text"
- },
- {
- "type": "tag",
- "name": "br",
- "attribs": {}
- }
- ]
-} \ No newline at end of file
diff --git a/node_modules/domhandler/test/cases/03-single_tag_2.json b/node_modules/domhandler/test/cases/03-single_tag_2.json
deleted file mode 100644
index 1c56dc9d9..000000000
--- a/node_modules/domhandler/test/cases/03-single_tag_2.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "name": "Single Tag 2",
- "options": {},
- "html": "<br>text<br>",
- "expected": [
- {
- "type": "tag",
- "name": "br",
- "attribs": {}
- },
- {
- "data": "text",
- "type": "text"
- },
- {
- "type": "tag",
- "name": "br",
- "attribs": {}
- }
- ]
-} \ No newline at end of file
diff --git a/node_modules/domhandler/test/cases/04-unescaped_in_script.json b/node_modules/domhandler/test/cases/04-unescaped_in_script.json
deleted file mode 100644
index f31f5fad6..000000000
--- a/node_modules/domhandler/test/cases/04-unescaped_in_script.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "name": "Unescaped chars in script",
- "options": {},
- "html": "<head><script language=\"Javascript\">var foo = \"<bar>\"; alert(2 > foo); var baz = 10 << 2; var zip = 10 >> 1; var yap = \"<<>>>><<\";</script></head>",
- "expected": [
- {
- "type": "tag",
- "name": "head",
- "attribs": {},
- "children": [
- {
- "type": "script",
- "name": "script",
- "attribs": {
- "language": "Javascript"
- },
- "children": [
- {
- "data": "var foo = \"<bar>\"; alert(2 > foo); var baz = 10 << 2; var zip = 10 >> 1; var yap = \"<<>>>><<\";",
- "type": "text"
- }
- ]
- }
- ]
- }
- ]
-} \ No newline at end of file
diff --git a/node_modules/domhandler/test/cases/05-tags_in_comment.json b/node_modules/domhandler/test/cases/05-tags_in_comment.json
deleted file mode 100644
index 2d22d9e1d..000000000
--- a/node_modules/domhandler/test/cases/05-tags_in_comment.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "name": "Special char in comment",
- "options": {},
- "html": "<head><!-- commented out tags <title>Test</title>--></head>",
- "expected": [
- {
- "type": "tag",
- "name": "head",
- "attribs": {},
- "children": [
- {
- "data": " commented out tags <title>Test</title>",
- "type": "comment"
- }
- ]
- }
- ]
-} \ No newline at end of file
diff --git a/node_modules/domhandler/test/cases/06-comment_in_script.json b/node_modules/domhandler/test/cases/06-comment_in_script.json
deleted file mode 100644
index 9a21cdabf..000000000
--- a/node_modules/domhandler/test/cases/06-comment_in_script.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "name": "Script source in comment",
- "options": {},
- "html": "<script><!--var foo = 1;--></script>",
- "expected": [
- {
- "type": "script",
- "name": "script",
- "attribs": {},
- "children": [
- {
- "data": "<!--var foo = 1;-->",
- "type": "text"
- }
- ]
- }
- ]
-} \ No newline at end of file
diff --git a/node_modules/domhandler/test/cases/07-unescaped_in_style.json b/node_modules/domhandler/test/cases/07-unescaped_in_style.json
deleted file mode 100644
index 77438fdc1..000000000
--- a/node_modules/domhandler/test/cases/07-unescaped_in_style.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "name": "Unescaped chars in style",
- "options": {},
- "html": "<style type=\"text/css\">\n body > p\n\t{ font-weight: bold; }</style>",
- "expected": [
- {
- "type": "style",
- "name": "style",
- "attribs": {
- "type": "text/css"
- },
- "children": [
- {
- "data": "\n body > p\n\t{ font-weight: bold; }",
- "type": "text"
- }
- ]
- }
- ]
-} \ No newline at end of file
diff --git a/node_modules/domhandler/test/cases/08-extra_spaces_in_tag.json b/node_modules/domhandler/test/cases/08-extra_spaces_in_tag.json
deleted file mode 100644
index 5c2492e22..000000000
--- a/node_modules/domhandler/test/cases/08-extra_spaces_in_tag.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "name": "Extra spaces in tag",
- "options": {},
- "html": "<font\t\n size='14' \n>the text</\t\nfont\t \n>",
- "expected": [
- {
- "type": "tag",
- "name": "font",
- "attribs": {
- "size": "14"
- },
- "children": [
- {
- "data": "the text",
- "type": "text"
- }
- ]
- }
- ]
-} \ No newline at end of file
diff --git a/node_modules/domhandler/test/cases/09-unquoted_attrib.json b/node_modules/domhandler/test/cases/09-unquoted_attrib.json
deleted file mode 100644
index 543cceeed..000000000
--- a/node_modules/domhandler/test/cases/09-unquoted_attrib.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "name": "Unquoted attributes",
- "options": {},
- "html": "<font size= 14>the text</font>",
- "expected": [
- {
- "type": "tag",
- "name": "font",
- "attribs": {
- "size": "14"
- },
- "children": [
- {
- "data": "the text",
- "type": "text"
- }
- ]
- }
- ]
-} \ No newline at end of file
diff --git a/node_modules/domhandler/test/cases/10-singular_attribute.json b/node_modules/domhandler/test/cases/10-singular_attribute.json
deleted file mode 100644
index 544636e49..000000000
--- a/node_modules/domhandler/test/cases/10-singular_attribute.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "name": "Singular attribute",
- "options": {},
- "html": "<option value='foo' selected>",
- "expected": [
- {
- "type": "tag",
- "name": "option",
- "attribs": {
- "value": "foo",
- "selected": ""
- }
- }
- ]
-} \ No newline at end of file
diff --git a/node_modules/domhandler/test/cases/11-text_outside_tags.json b/node_modules/domhandler/test/cases/11-text_outside_tags.json
deleted file mode 100644
index 07a0d296e..000000000
--- a/node_modules/domhandler/test/cases/11-text_outside_tags.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "name": "Text outside tags",
- "options": {},
- "html": "Line one\n<br>\nline two",
- "expected": [
- {
- "data": "Line one\n",
- "type": "text"
- },
- {
- "type": "tag",
- "name": "br",
- "attribs": {}
- },
- {
- "data": "\nline two",
- "type": "text"
- }
- ]
-} \ No newline at end of file
diff --git a/node_modules/domhandler/test/cases/12-text_only.json b/node_modules/domhandler/test/cases/12-text_only.json
deleted file mode 100644
index 342dc45f0..000000000
--- a/node_modules/domhandler/test/cases/12-text_only.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "name": "Only text",
- "options": {},
- "html": "this is the text",
- "expected": [
- {
- "data": "this is the text",
- "type": "text"
- }
- ]
-} \ No newline at end of file
diff --git a/node_modules/domhandler/test/cases/13-comment_in_text.json b/node_modules/domhandler/test/cases/13-comment_in_text.json
deleted file mode 100644
index 672dbbea2..000000000
--- a/node_modules/domhandler/test/cases/13-comment_in_text.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "name": "Comment within text",
- "options": {},
- "html": "this is <!-- the comment --> the text",
- "expected": [
- {
- "data": "this is ",
- "type": "text"
- },
- {
- "data": " the comment ",
- "type": "comment"
- },
- {
- "data": " the text",
- "type": "text"
- }
- ]
-} \ No newline at end of file
diff --git a/node_modules/domhandler/test/cases/14-comment_in_text_in_script.json b/node_modules/domhandler/test/cases/14-comment_in_text_in_script.json
deleted file mode 100644
index b69d04bd1..000000000
--- a/node_modules/domhandler/test/cases/14-comment_in_text_in_script.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "name": "Comment within text within script",
- "options": {},
- "html": "<script>this is <!-- the comment --> the text</script>",
- "expected": [
- {
- "type": "script",
- "name": "script",
- "attribs": {},
- "children": [
- {
- "data": "this is <!-- the comment --> the text",
- "type": "text"
- }
- ]
- }
- ]
-} \ No newline at end of file
diff --git a/node_modules/domhandler/test/cases/15-non-verbose.json b/node_modules/domhandler/test/cases/15-non-verbose.json
deleted file mode 100644
index 069db840a..000000000
--- a/node_modules/domhandler/test/cases/15-non-verbose.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "Option 'verbose' set to 'false'",
- "options": {
- "verbose": false
- },
- "html": "<font\t\n size='14' \n>the text</\t\nfont\t \n>",
- "expected": [
- {
- "type": "tag",
- "name": "font",
- "attribs": {
- "size": "14"
- },
- "children": [
- {
- "data": "the text",
- "type": "text"
- }
- ]
- }
- ]
-} \ No newline at end of file
diff --git a/node_modules/domhandler/test/cases/16-normalize_whitespace.json b/node_modules/domhandler/test/cases/16-normalize_whitespace.json
deleted file mode 100644
index d4490af48..000000000
--- a/node_modules/domhandler/test/cases/16-normalize_whitespace.json
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- "name": "Normalize whitespace",
- "options": {
- "normalizeWhitespace": true
- },
- "html": "Line one\n<br>\t \r\n\f <br>\nline two<font><br> x </font>",
- "expected": [
- {
- "data": "Line one ",
- "type": "text"
- },
- {
- "type": "tag",
- "name": "br",
- "attribs": {}
- },
- {
- "data": " ",
- "type": "text"
- },
- {
- "type": "tag",
- "name": "br",
- "attribs": {}
- },
- {
- "data": " line two",
- "type": "text"
- },
- {
- "type": "tag",
- "name": "font",
- "attribs": {},
- "children": [
- {
- "type": "tag",
- "name": "br",
- "attribs": {}
- },
- {
- "data": " x ",
- "type": "text"
- }
- ]
- }
- ]
-} \ No newline at end of file
diff --git a/node_modules/domhandler/test/cases/17-xml_namespace.json b/node_modules/domhandler/test/cases/17-xml_namespace.json
deleted file mode 100644
index 2171c49ed..000000000
--- a/node_modules/domhandler/test/cases/17-xml_namespace.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "name": "XML Namespace",
- "options": {},
- "html": "<ns:tag>text</ns:tag>",
- "expected": [
- {
- "type": "tag",
- "name": "ns:tag",
- "attribs": {},
- "children": [
- {
- "data": "text",
- "type": "text"
- }
- ]
- }
- ]
-} \ No newline at end of file
diff --git a/node_modules/domhandler/test/cases/18-enforce_empty_tags.json b/node_modules/domhandler/test/cases/18-enforce_empty_tags.json
deleted file mode 100644
index ce6c45554..000000000
--- a/node_modules/domhandler/test/cases/18-enforce_empty_tags.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "name": "Enforce empty tags",
- "options": {},
- "html": "<link>text</link>",
- "expected": [
- {
- "type": "tag",
- "name": "link",
- "attribs": {}
- },
- {
- "data": "text",
- "type": "text"
- }
- ]
-} \ No newline at end of file
diff --git a/node_modules/domhandler/test/cases/19-ignore_empty_tags.json b/node_modules/domhandler/test/cases/19-ignore_empty_tags.json
deleted file mode 100644
index fe59cf913..000000000
--- a/node_modules/domhandler/test/cases/19-ignore_empty_tags.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "name": "Ignore empty tags (xml mode)",
- "options": {
- "xmlMode": true
- },
- "html": "<link>text</link>",
- "expected": [
- {
- "type": "tag",
- "name": "link",
- "attribs": {},
- "children": [
- {
- "data": "text",
- "type": "text"
- }
- ]
- }
- ]
-} \ No newline at end of file
diff --git a/node_modules/domhandler/test/cases/20-template_script_tags.json b/node_modules/domhandler/test/cases/20-template_script_tags.json
deleted file mode 100644
index dae5f1f93..000000000
--- a/node_modules/domhandler/test/cases/20-template_script_tags.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "name": "Template script tags",
- "options": {},
- "html": "<script type=\"text/template\"><h1>Heading1</h1></script>",
- "expected": [
- {
- "type": "script",
- "name": "script",
- "attribs": {
- "type": "text/template"
- },
- "children": [
- {
- "data": "<h1>Heading1</h1>",
- "type": "text"
- }
- ]
- }
- ]
-} \ No newline at end of file
diff --git a/node_modules/domhandler/test/cases/21-conditional_comments.json b/node_modules/domhandler/test/cases/21-conditional_comments.json
deleted file mode 100644
index c034acd1a..000000000
--- a/node_modules/domhandler/test/cases/21-conditional_comments.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "name": "Conditional comments",
- "options": {},
- "html": "<!--[if lt IE 7]> <html class='no-js ie6 oldie' lang='en'> <![endif]--><!--[if lt IE 7]> <html class='no-js ie6 oldie' lang='en'> <![endif]-->",
- "expected": [
- {
- "data": "[if lt IE 7]> <html class='no-js ie6 oldie' lang='en'> <![endif]",
- "type": "comment"
- },
- {
- "data": "[if lt IE 7]> <html class='no-js ie6 oldie' lang='en'> <![endif]",
- "type": "comment"
- }
- ]
-} \ No newline at end of file
diff --git a/node_modules/domhandler/test/cases/22-lowercase_tags.json b/node_modules/domhandler/test/cases/22-lowercase_tags.json
deleted file mode 100644
index b3d70e432..000000000
--- a/node_modules/domhandler/test/cases/22-lowercase_tags.json
+++ /dev/null
@@ -1,41 +0,0 @@
-{
- "name": "lowercase tags",
- "options": {},
- "html": "<!DOCTYPE html><HTML><TITLE>The Title</title><BODY>Hello world</body></html>",
- "expected": [
- {
- "name": "!doctype",
- "data": "!DOCTYPE html",
- "type": "directive"
- },
- {
- "type": "tag",
- "name": "html",
- "attribs": {},
- "children": [
- {
- "type": "tag",
- "name": "title",
- "attribs": {},
- "children": [
- {
- "data": "The Title",
- "type": "text"
- }
- ]
- },
- {
- "type": "tag",
- "name": "body",
- "attribs": {},
- "children": [
- {
- "data": "Hello world",
- "type": "text"
- }
- ]
- }
- ]
- }
- ]
-} \ No newline at end of file
diff --git a/node_modules/domhandler/test/tests.js b/node_modules/domhandler/test/tests.js
deleted file mode 100644
index fc9d2cc87..000000000
--- a/node_modules/domhandler/test/tests.js
+++ /dev/null
@@ -1,59 +0,0 @@
-var fs = require("fs"),
- path = require("path"),
- assert = require("assert"),
- util = require("util"),
- ElementType = require("domelementtype"),
- Parser = require("htmlparser2").Parser,
- Handler = require("../");
-
-var basePath = path.resolve(__dirname, "cases"),
- inspectOpts = { showHidden: true, depth: null };
-
-fs
-.readdirSync(basePath)
-.filter(RegExp.prototype.test, /\.json$/) //only allow .json files
-.map(function(name){
- return path.resolve(basePath, name);
-})
-.map(require)
-.forEach(function(test){
- it(test.name, function(){
- var expected = test.expected;
-
- var handler = new Handler(function(err, actual){
- assert.ifError(err);
- try {
- compare(expected, actual);
- } catch(e){
- e.expected = util.inspect(expected, inspectOpts);
- e.actual = util.inspect(actual, inspectOpts);
- throw e;
- }
- }, test.options);
-
- var data = test.html;
-
- var parser = new Parser(handler, test.options);
-
- //first, try to run the test via chunks
- for(var i = 0; i < data.length; i++){
- parser.write(data.charAt(i));
- }
- parser.done();
-
- //then parse everything
- parser.parseComplete(data);
- });
-});
-
-function compare(expected, result){
- assert.equal(typeof expected, typeof result, "types didn't match");
- if(typeof expected !== "object" || expected === null){
- assert.strictEqual(expected, result, "result doesn't equal expected");
- } else {
- for(var prop in expected){
- assert.ok(prop in result, "result didn't contain property " + prop);
- compare(expected[prop], result[prop]);
- }
- }
-} \ No newline at end of file