Updating HTML template specs #457
Description
In my recent pull request #441, @50Wliu noted,
If you notice, none of the HTML tags are being scoped as HTML. To fix that, I would recommend grouping all the HTML-related specs under a single describe 'HTML strings' (or something), and then adding the following code right after the describe:
beforeEach ->
waitsForPromise ->
atom.packages.activatePackage("language-html")
I did so and the act broke all of the HTML-related specs. Here is the relevant section of javascript-spec.coffee
with the recommended changes.
And the error messages. I only added the second spec, and they're all failing in the same fashion. As is, they all work to verify that their respective grammar patterns are working correctly, but they apparently don't tokenize the internal HTML correctly.
ES6 tagged HTML string templates
it tokenizes them as strings
Expected { value : 'hey ', scopes : [ 'source.js', 'string.quoted.template.html.js' ] } to equal { value : 'hey <b>', scopes : [ 'source.js', 'string.quoted.template.html.js' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:613:27)
Expected { value : '<', scopes : [ 'source.js', 'string.quoted.template.html.js', 'meta.tag.inline.any.html', 'punctuation.definition.tag.begin.html' ] } to equal { value : '${', scopes : [ 'source.js', 'string.quoted.template.html.js', 'source.js.embedded.source', 'punctuation.section.embedded.js' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:614:27)
Expected { value : 'b', scopes : [ 'source.js', 'string.quoted.template.html.js', 'meta.tag.inline.any.html', 'entity.name.tag.inline.any.html' ] } to equal { value : 'name', scopes : [ 'source.js', 'string.quoted.template.html.js', 'source.js.embedded.source' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:615:27)
Expected { value : '>', scopes : [ 'source.js', 'string.quoted.template.html.js', 'meta.tag.inline.any.html', 'punctuation.definition.tag.end.html' ] } to equal { value : '}', scopes : [ 'source.js', 'string.quoted.template.html.js', 'source.js.embedded.source', 'punctuation.section.embedded.js' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:616:27)
Expected { value : '${', scopes : [ 'source.js', 'string.quoted.template.html.js', 'source.js.embedded.source', 'punctuation.section.embedded.js' ] } to equal { value : '</b>', scopes : [ 'source.js', 'string.quoted.template.html.js' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:617:27)
Expected { value : 'name', scopes : [ 'source.js', 'string.quoted.template.html.js', 'source.js.embedded.source' ] } to equal { value : '`', scopes : [ 'source.js', 'string.quoted.template.html.js', 'punctuation.definition.string.end.js' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:618:27)
innerHTML attribute declarations with string template tags
it tokenizes them as strings
Expected { value : 'hey ', scopes : [ 'source.js', 'string.quoted.template.html.js' ] } to equal { value : 'hey <b>', scopes : [ 'source.js', 'string.quoted.template.html.js' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:630:27)
Expected { value : '<', scopes : [ 'source.js', 'string.quoted.template.html.js', 'meta.tag.inline.any.html', 'punctuation.definition.tag.begin.html' ] } to equal { value : '${', scopes : [ 'source.js', 'string.quoted.template.html.js', 'source.js.embedded.source', 'punctuation.section.embedded.js' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:631:27)
Expected { value : 'b', scopes : [ 'source.js', 'string.quoted.template.html.js', 'meta.tag.inline.any.html', 'entity.name.tag.inline.any.html' ] } to equal { value : 'name', scopes : [ 'source.js', 'string.quoted.template.html.js', 'source.js.embedded.source' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:632:27)
Expected { value : '>', scopes : [ 'source.js', 'string.quoted.template.html.js', 'meta.tag.inline.any.html', 'punctuation.definition.tag.end.html' ] } to equal { value : '}', scopes : [ 'source.js', 'string.quoted.template.html.js', 'source.js.embedded.source', 'punctuation.section.embedded.js' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:633:28)
Expected { value : '${', scopes : [ 'source.js', 'string.quoted.template.html.js', 'source.js.embedded.source', 'punctuation.section.embedded.js' ] } to equal { value : '</b>', scopes : [ 'source.js', 'string.quoted.template.html.js' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:634:28)
Expected { value : 'name', scopes : [ 'source.js', 'string.quoted.template.html.js', 'source.js.embedded.source' ] } to equal { value : '`', scopes : [ 'source.js', 'string.quoted.template.html.js', 'punctuation.definition.string.end.js' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:635:28)
ES6 tagged HTML string templates with expanded function name
it tokenizes them as strings
Expected { value : 'hey ', scopes : [ 'source.js', 'string.quoted.template.html.js' ] } to equal { value : 'hey <b>', scopes : [ 'source.js', 'string.quoted.template.html.js' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:642:27)
Expected { value : '<', scopes : [ 'source.js', 'string.quoted.template.html.js', 'meta.tag.inline.any.html', 'punctuation.definition.tag.begin.html' ] } to equal { value : '${', scopes : [ 'source.js', 'string.quoted.template.html.js', 'source.js.embedded.source', 'punctuation.section.embedded.js' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:643:27)
Expected { value : 'b', scopes : [ 'source.js', 'string.quoted.template.html.js', 'meta.tag.inline.any.html', 'entity.name.tag.inline.any.html' ] } to equal { value : 'name', scopes : [ 'source.js', 'string.quoted.template.html.js', 'source.js.embedded.source' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:644:27)
Expected { value : '>', scopes : [ 'source.js', 'string.quoted.template.html.js', 'meta.tag.inline.any.html', 'punctuation.definition.tag.end.html' ] } to equal { value : '}', scopes : [ 'source.js', 'string.quoted.template.html.js', 'source.js.embedded.source', 'punctuation.section.embedded.js' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:645:27)
Expected { value : '${', scopes : [ 'source.js', 'string.quoted.template.html.js', 'source.js.embedded.source', 'punctuation.section.embedded.js' ] } to equal { value : '</b>', scopes : [ 'source.js', 'string.quoted.template.html.js' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:646:27)
Expected { value : 'name', scopes : [ 'source.js', 'string.quoted.template.html.js', 'source.js.embedded.source' ] } to equal { value : '`', scopes : [ 'source.js', 'string.quoted.template.html.js', 'punctuation.definition.string.end.js' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:647:27)
ES6 tagged HTML string templates with expanded function name and white space
it tokenizes them as strings
Expected { value : 'hey ', scopes : [ 'source.js', 'string.quoted.template.html.js' ] } to equal { value : 'hey <b>', scopes : [ 'source.js', 'string.quoted.template.html.js' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:655:27)
Expected { value : '<', scopes : [ 'source.js', 'string.quoted.template.html.js', 'meta.tag.inline.any.html', 'punctuation.definition.tag.begin.html' ] } to equal { value : '${', scopes : [ 'source.js', 'string.quoted.template.html.js', 'source.js.embedded.source', 'punctuation.section.embedded.js' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:656:27)
Expected { value : 'b', scopes : [ 'source.js', 'string.quoted.template.html.js', 'meta.tag.inline.any.html', 'entity.name.tag.inline.any.html' ] } to equal { value : 'name', scopes : [ 'source.js', 'string.quoted.template.html.js', 'source.js.embedded.source' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:657:27)
Expected { value : '>', scopes : [ 'source.js', 'string.quoted.template.html.js', 'meta.tag.inline.any.html', 'punctuation.definition.tag.end.html' ] } to equal { value : '}', scopes : [ 'source.js', 'string.quoted.template.html.js', 'source.js.embedded.source', 'punctuation.section.embedded.js' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:658:27)
Expected { value : '${', scopes : [ 'source.js', 'string.quoted.template.html.js', 'source.js.embedded.source', 'punctuation.section.embedded.js' ] } to equal { value : '</b>', scopes : [ 'source.js', 'string.quoted.template.html.js' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:659:27)
Expected { value : 'name', scopes : [ 'source.js', 'string.quoted.template.html.js', 'source.js.embedded.source' ] } to equal { value : '`', scopes : [ 'source.js', 'string.quoted.template.html.js', 'punctuation.definition.string.end.js' ] }.
at .<anonymous> (file:///D:/github/atom/language-javascript/spec/javascript-spec.coffee:660:27)
So, my first guess is that I did something wrong in implementing the change. I'm not very familiar with spec runners and I only really dabble with CoffeeScript to hack on Atom, so I would appreciate someone going over it and seeing if I had something out of place.