Skip to content

Commit

Permalink
Merge pull request #7 from tivac/quoted-properties
Browse files Browse the repository at this point in the history
Fix quoted properties issue (#6)
  • Loading branch information
tivac committed Nov 17, 2015
2 parents 7f96302 + 20fc330 commit 70cfe95
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/objectify.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function getClass(node) {

if(node.arguments[1] && node.arguments[1].type === "ObjectExpression") {
node.arguments[1].properties.some(function(property) {
var key = property.key.name;
var key = property.key.name || property.key.value;

if(key === "class") {
type = "class";
Expand Down Expand Up @@ -119,7 +119,7 @@ function parseAttrs(node, out) {
var className = getClass(node);

node.arguments[1].properties.forEach(function(property) {
var key = property.key.name,
var key = property.key.name || property.key.value,
css;

// Class combinations get weird, so handling specially
Expand Down
10 changes: 10 additions & 0 deletions test/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ test("Non-string attr values", function(t) {
t.end();
});

test("Quoted properties (issue #6)", function(t) {
/* eslint quote-props:0 */
t.looseEqual(
p(`m("div", { "fooga" : 0 })`),
m("div", { "fooga" : 0 })
);

t.end();
});

test("Array.prototype methods", function(t) {
/* eslint brace-style:0, no-unused-expressions:0 */
t.looseEqual(
Expand Down

0 comments on commit 70cfe95

Please sign in to comment.