JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
add scripting flag to tests, fixes
[peach-html5-editor.git] / test.coffee
index 1e27066..289f46d 100644 (file)
@@ -3474,27 +3474,33 @@ tests = [
        }, {
                name: "tests16.dat #84"
                html: "<!doctype html><noscript><!--<noscript></noscript>--></noscript>"
+               scripting: true
                errors: 1
                expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <noscript>\n|       \"<!--<noscript>\"\n|   <body>\n|     \"-->\"\n"
        }, {
                name: "tests16.dat #85"
                html: "<!doctype html><noscript><!--<noscript></noscript>--></noscript>"
+               scripting: false
                expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <noscript>\n|       <!-- <noscript></noscript> -->\n|   <body>\n"
        }, {
                name: "tests16.dat #86"
                html: "<!doctype html><noscript><!--</noscript>X<noscript>--></noscript>"
+               scripting: true
                expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <noscript>\n|       \"<!--\"\n|   <body>\n|     \"X\"\n|     <noscript>\n|       \"-->\"\n"
        }, {
                name: "tests16.dat #87"
                html: "<!doctype html><noscript><!--</noscript>X<noscript>--></noscript>"
+               scripting: false
                expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <noscript>\n|       <!-- </noscript>X<noscript> -->\n|   <body>\n"
        }, {
                name: "tests16.dat #88"
                html: "<!doctype html><noscript><iframe></noscript>X"
+               scripting: true
                expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <noscript>\n|       \"<iframe>\"\n|   <body>\n|     \"X\"\n"
        }, {
                name: "tests16.dat #89"
                html: "<!doctype html><noscript><iframe></noscript>X"
+               scripting: false
                errors: 2
                expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <noscript>\n|   <body>\n|     <iframe>\n|       \"</noscript>X\"\n"
        }, {
@@ -3950,31 +3956,37 @@ tests = [
        }, {
                name: "tests16.dat #181"
                html: "<noscript><!--<noscript></noscript>--></noscript>"
+               scripting: true
                errors: 2
                expected: "| <html>\n|   <head>\n|     <noscript>\n|       \"<!--<noscript>\"\n|   <body>\n|     \"-->\"\n"
        }, {
                name: "tests16.dat #182"
                html: "<noscript><!--<noscript></noscript>--></noscript>"
+               scripting: false
                errors: 1
                expected: "| <html>\n|   <head>\n|     <noscript>\n|       <!-- <noscript></noscript> -->\n|   <body>\n"
        }, {
                name: "tests16.dat #183"
                html: "<noscript><!--</noscript>X<noscript>--></noscript>"
+               scripting: true
                errors: 1
                expected: "| <html>\n|   <head>\n|     <noscript>\n|       \"<!--\"\n|   <body>\n|     \"X\"\n|     <noscript>\n|       \"-->\"\n"
        }, {
                name: "tests16.dat #184"
                html: "<noscript><!--</noscript>X<noscript>--></noscript>"
+               scripting: false
                errors: 1
                expected: "| <html>\n|   <head>\n|     <noscript>\n|       <!-- </noscript>X<noscript> -->\n|   <body>\n"
        }, {
                name: "tests16.dat #185"
                html: "<noscript><iframe></noscript>X"
+               scripting: true
                errors: 1
                expected: "| <html>\n|   <head>\n|     <noscript>\n|       \"<iframe>\"\n|   <body>\n|     \"X\"\n"
        }, {
                name: "tests16.dat #186"
                html: "<noscript><iframe></noscript>X"
+               scripting: false
                errors: 3
                expected: "| <html>\n|   <head>\n|     <noscript>\n|   <body>\n|     <iframe>\n|       \"</noscript>X\"\n"
        }, {
@@ -6389,11 +6401,13 @@ tests = [
        }, {
                name: "tests5.dat #16"
                html: "<noscript><!--</noscript>--></noscript>"
+               scripting: true
                errors: 2
                expected: "| <html>\n|   <head>\n|     <noscript>\n|       \"<!--\"\n|   <body>\n|     \"-->\"\n"
        }, {
                name: "tests5.dat #17"
                html: "<noscript><!--</noscript>--></noscript>"
+               scripting: false
                errors: 1
                expected: "| <html>\n|   <head>\n|     <noscript>\n|       <!-- </noscript> -->\n|   <body>\n"
        }, {
@@ -7690,11 +7704,13 @@ tests = [
        }, {
                name: "webkit02.dat #2"
                html: "<p id=\"status\"><noscript><strong>A</strong></noscript><span>B</span></p>"
+               scripting: true
                errors: 1
                expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       id=\"status\"\n|       <noscript>\n|         \"<strong>A</strong>\"\n|       <span>\n|         \"B\"\n"
        }, {
                name: "webkit02.dat #3"
                html: "<p id=\"status\"><noscript><strong>A</strong></noscript><span>B</span></p>"
+               scripting: false
                errors: 1
                expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       id=\"status\"\n|       <noscript>\n|         <strong>\n|           \"A\"\n|       <span>\n|         \"B\"\n"
        }, {
@@ -7834,10 +7850,10 @@ test_parser = (args) ->
                return
        wheic.debug_log_reset()
        parse_errors = []
-       errors_cb = (i) ->
+       args.error_cb = (i) ->
                parse_errors.push i
        prev_node_id = 0 # reset counter
-       parsed = wheic.parse_html args.html, errors_cb
+       parsed = wheic.parse_html args
        serialized = serialize_els parsed
        if serialized isnt args.expected
                #wheic.debug_log_each (str) ->