babel-plugin-styletron
Advanced tools
Comparing version 2.0.0-beta.4 to 2.0.1-beta.0
@@ -9,3 +9,3 @@ module.exports = function (ref) { | ||
path.node.openingElement.attributes.forEach(function (node) { | ||
if (node.name.name === 'style') { | ||
if (node.name.name === 'style' && path.scope.hasBinding('styletron')) { | ||
node.name.name = 'className'; | ||
@@ -12,0 +12,0 @@ node.value = t.JSXExpressionContainer( |
@@ -10,3 +10,3 @@ var fs = require('fs'); | ||
test('basic', function (t) { | ||
test('no styletron binding', function (t) { | ||
var output = babel.transformFileSync(fixturesDir + '/basic.source', { | ||
@@ -21,1 +21,12 @@ plugins: ['syntax-jsx', pluginPath] | ||
}); | ||
test('styletron in context', function (t) { | ||
var output = babel.transformFileSync(fixturesDir + '/context.source', { | ||
plugins: ['syntax-jsx', pluginPath] | ||
}); | ||
var expected = fs.readFileSync(fixturesDir + '/context.expected', 'utf-8'); | ||
t.equal(output.code.trim(), expected.trim(), 'output matches expected'); | ||
t.end(); | ||
}); |
{ | ||
"name": "babel-plugin-styletron", | ||
"version": "2.0.0-beta.4", | ||
"version": "2.0.1-beta.0", | ||
"description": "A universal stylesheet manager for node.js and browsers", | ||
@@ -5,0 +5,0 @@ "author": "Ryan Tsao <ryan.j.tsao@gmail.com>", |
@@ -7,3 +7,3 @@ module.exports = function ({types: t}) { | ||
path.node.openingElement.attributes.forEach(node => { | ||
if (node.name.name === 'style') { | ||
if (node.name.name === 'style' && path.scope.hasBinding('styletron')) { | ||
node.name.name = 'className'; | ||
@@ -10,0 +10,0 @@ node.value = t.JSXExpressionContainer( |
@@ -10,3 +10,3 @@ const fs = require('fs'); | ||
test('basic', (t) => { | ||
test('no styletron binding', (t) => { | ||
var output = babel.transformFileSync(fixturesDir + '/basic.source', { | ||
@@ -21,1 +21,12 @@ plugins: ['syntax-jsx', pluginPath] | ||
}); | ||
test('styletron in context', (t) => { | ||
var output = babel.transformFileSync(fixturesDir + '/context.source', { | ||
plugins: ['syntax-jsx', pluginPath] | ||
}); | ||
var expected = fs.readFileSync(fixturesDir + '/context.expected', 'utf-8'); | ||
t.equal(output.code.trim(), expected.trim(), 'output matches expected'); | ||
t.end(); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
4090
9
89