JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
fix escaped script tags too
[peach-html5-editor.git] / test.coffee
index 9fe1293..58b1ed8 100644 (file)
@@ -7690,11 +7690,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"
        }, {
@@ -7796,7 +7798,12 @@ serialize_els = (els, prefix = '| ') ->
        for el in els
                switch el.type
                        when wheic.TYPE_TAG
-                               ret += "#{prefix}<#{el.name}>\n"
+                               ret += "#{prefix}<"
+                               if el.namespace is wheic.NS_MATHML
+                                       ret += "math "
+                               if el.namespace is wheic.NS_SVG
+                                       ret += "svg "
+                               ret += "#{el.name}>\n"
                                attr_keys = []
                                for k of el.attrs
                                        attr_keys.push k
@@ -7822,14 +7829,17 @@ serialize_els = (els, prefix = '| ') ->
                                ret += "#{prefix}UNKNOWN TAG TYPE #{el.type}"
        return ret
 
-test_results = passed: 0, failed: 0
+test_results = passed: 0, failed: 0, fragment: 0
 test_parser = (args) ->
+       if args.fragment? # hide fragment tests for now
+               test_results.fragment += 1
+               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) ->
@@ -7849,7 +7859,7 @@ test_parser = (args) ->
                console.log "passed \"#{args.name}\""
                test_results.passed += 1
 test_summary = ->
-       console.log "Tests passed: #{test_results.passed}, Tests Failed: #{test_results.failed}"
+       console.log "Tests passed: #{test_results.passed}, Failed: #{test_results.failed}, ignored: #{test_results.fragment}"
 
 
 next_test = 0