X-Git-Url: https://jasonwoof.com/gitweb/?p=peach-html5-editor.git;a=blobdiff_plain;f=parser_tests.coffee;h=cc65725f2db984ba2ee32ea0d5b875713c964bf2;hp=5cc99bf18342bbffd84c6b52edd099e691e983c2;hb=e3b396215f59cd45b7d7c510dcddea8354f756aa;hpb=a7cff3a244ba086034aed2f284235b6bcb6b7f98 diff --git a/parser_tests.coffee b/parser_tests.coffee index 5cc99bf..cc65725 100644 --- a/parser_tests.coffee +++ b/parser_tests.coffee @@ -7932,19 +7932,19 @@ tests = [ ] if typeof module isnt 'undefined' and module.exports? - wheic_parser = require './parser.coffee' + peach_parser = require './parser.coffee' else - wheic_parser = window.wheic_parser + peach_parser = window.peach_parser serialize_els = (els, prefix = '| ') -> ret = '' for el in els switch el.type - when wheic_parser.TYPE_TAG + when peach_parser.TYPE_TAG ret += "#{prefix}<" - if el.namespace is wheic_parser.NS_MATHML + if el.namespace is peach_parser.NS_MATHML ret += "math " - if el.namespace is wheic_parser.NS_SVG + if el.namespace is peach_parser.NS_SVG ret += "svg " ret += "#{el.name}>\n" attr_keys = [] @@ -7953,16 +7953,16 @@ serialize_els = (els, prefix = '| ') -> attr_keys.sort() # TODO this should be "lexicographically by UTF-16 code unit" for k in attr_keys ret += "#{prefix} #{k}=\"#{el.attrs[k]}\"\n" - if el.name is 'template' and el.namespace is wheic_parser.NS_HTML + if el.name is 'template' and el.namespace is peach_parser.NS_HTML ret += "#{prefix} content\n" ret += serialize_els el.children, "#{prefix} " else ret += serialize_els el.children, "#{prefix} " - when wheic_parser.TYPE_TEXT + when peach_parser.TYPE_TEXT ret += "#{prefix}\"#{el.text}\"\n" - when wheic_parser.TYPE_COMMENT + when peach_parser.TYPE_COMMENT ret += "#{prefix}\n" - when wheic_parser.TYPE_DOCTYPE + when peach_parser.TYPE_DOCTYPE ret += "#{prefix} 0) or (el.system_identifier? and el.system_identifier.length > 0) ret += " \"#{el.public_identifier ? ''}\"" @@ -7974,17 +7974,17 @@ serialize_els = (els, prefix = '| ') -> test_results = passed: 0, failed: 0 test_parser = (args) -> - wheic_parser.debug_log_reset() + peach_parser.debug_log_reset() parse_errors = [] args.error_cb = (i) -> parse_errors.push i prev_node_id = 0 # reset counter - parsed = wheic_parser.parse args.html, args + parsed = peach_parser.parse args.html, args serialized = serialize_els parsed if serialized isnt args.expected test_results.failed += 1 if test_results.failed is 1 - wheic_parser.debug_log_each (str) -> + peach_parser.debug_log_each (str) -> console.log str console.log "FAILED: \"#{args.name}\"" console.log " Input: #{args.html}"