Fixes #559 - class tag is used for components only

This commit is contained in:
Patrick Steele-Idem 2017-02-08 22:40:45 -08:00
parent 506c547503
commit f3a9014ca7
6 changed files with 31 additions and 2 deletions

View File

@ -0,0 +1 @@
<button class="btn active btn-bar">Click me</button>

View File

@ -0,0 +1,3 @@
<div>
<class>CLASS</class>
</div>

View File

@ -0,0 +1,8 @@
var expect = require('chai').expect;
exports.templateData = {};
exports.checkError = function(e) {
var message = e.toString();
expect(message).to.contain('class is a static tag and can only be declared at the template root');
};

View File

@ -0,0 +1,12 @@
class MyComponent {
onMount() {
}
sayHello(name) {
return 'Hello ' + name + '!';
}
}
<div.root>
</div>

View File

@ -0,0 +1,7 @@
var expect = require('chai').expect;
module.exports = function(helpers) {
var widget = helpers.mount(require('./index'), { });
expect(widget.sayHello('Frank')).to.equal('Hello Frank!');
};

View File

@ -183,8 +183,6 @@ function classToObject(cls, transformHelper) {
}
function handleClassDeclaration(classEl, transformHelper) {
if(!/^class\s*\{/.test(classEl.tagString)) return;
let tree;
var wrappedSrc = '('+classEl.tagString+'\n)';