weex-styler
Advanced tools
Comparing version 0.1.7 to 0.1.8
@@ -535,2 +535,6 @@ var util = require('./util') | ||
var SUGGESTED_PROP_NAME_GROUP = { | ||
background: 'backgroundColor' | ||
} | ||
var validatorMap = {} | ||
@@ -588,3 +592,5 @@ | ||
result = {value: value} | ||
log = {reason: 'WARNING: `' + util.camelCaseToHyphened(name) + '` is not a standard property name'} | ||
var suggestedName = SUGGESTED_PROP_NAME_GROUP[name] | ||
var suggested = suggestedName ? ', suggest `' + util.camelCaseToHyphened(suggestedName) + '`' : '' | ||
log = {reason: 'WARNING: `' + util.camelCaseToHyphened(name) + '` is not a standard property name (may not be supported)' + suggested} | ||
} | ||
@@ -591,0 +597,0 @@ return { |
{ | ||
"name": "weex-styler", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "Weex <style> transformer", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -12,13 +12,14 @@ var chai = require('chai') | ||
it('parse normal style code', function (done) { | ||
var code = 'html {color: #000000;}\n\n.foo {color: red; background-color: rgba(255,255,255,0.6); -webkit-transform: rotate(90deg); width: 200px; left: 0; right: 0px; border-width: 1pt; font-weight: 100}' | ||
var code = 'html {color: #000000;}\n\n.foo {color: red; background-color: rgba(255,255,255,0.6); -webkit-transform: rotate(90deg); width: 200px; left: 0; right: 0px; border-width: 1pt; font-weight: 100}\n\n.bar {background: red}' | ||
styler.parse(code, function (err, data) { | ||
expect(err).is.undefined | ||
expect(data).is.an.object | ||
expect(data.jsonStyle).eql({foo: {color: '#FF0000', backgroundColor: 'rgba(255,255,255,0.6)', WebkitTransform: 'rotate(90deg)', width: 200, left: 0, right: 0, borderWidth: '1pt', fontWeight: '100'}}) | ||
expect(data.jsonStyle).eql({foo: {color: '#FF0000', backgroundColor: 'rgba(255,255,255,0.6)', WebkitTransform: 'rotate(90deg)', width: 200, left: 0, right: 0, borderWidth: '1pt', fontWeight: '100'}, bar: {background: 'red'}}) | ||
expect(data.log).eql([ | ||
{line: 1, column: 1, reason: 'ERROR: Selector `html` is not supported. Weex only support single-classname selector'}, | ||
{line: 3, column: 7, reason: 'NOTE: property value `red` is autofixed to `#FF0000`'}, | ||
{line: 3, column: 60, reason: 'WARNING: `-webkit-transform` is not a standard property name'}, | ||
{line: 3, column: 60, reason: 'WARNING: `-webkit-transform` is not a standard property name (may not be supported)'}, | ||
{line: 3, column: 94, reason: 'NOTE: unit `px` is not supported and property value `200px` is autofixed to `200`'}, | ||
{line: 3, column: 117, reason: 'NOTE: unit `px` is not supported and property value `0px` is autofixed to `0`'} | ||
{line: 3, column: 117, reason: 'NOTE: unit `px` is not supported and property value `0px` is autofixed to `0`'}, | ||
{line: 5, column: 7, reason: 'WARNING: `background` is not a standard property name (may not be supported), suggest `background-color`'} | ||
]) | ||
@@ -25,0 +26,0 @@ done() |
@@ -345,2 +345,3 @@ var chai = require('chai') | ||
foo: { | ||
background: '#ff0000', | ||
abc: '123', | ||
@@ -358,2 +359,3 @@ def: '456px', | ||
foo: { | ||
background: '#ff0000', | ||
abc: 123, | ||
@@ -367,7 +369,8 @@ def: 456, | ||
expect(data.log).eql([ | ||
{reason: 'WARNING: `abc` is not a standard property name'}, | ||
{reason: 'WARNING: `def` is not a standard property name'}, | ||
{reason: 'WARNING: `ghi` is not a standard property name'}, | ||
{reason: 'WARNING: `-abc-def` is not a standard property name'}, | ||
{reason: 'WARNING: `abc-def` is not a standard property name'} | ||
{reason: 'WARNING: `background` is not a standard property name (may not be supported), suggest `background-color`'}, | ||
{reason: 'WARNING: `abc` is not a standard property name (may not be supported)'}, | ||
{reason: 'WARNING: `def` is not a standard property name (may not be supported)'}, | ||
{reason: 'WARNING: `ghi` is not a standard property name (may not be supported)'}, | ||
{reason: 'WARNING: `-abc-def` is not a standard property name (may not be supported)'}, | ||
{reason: 'WARNING: `abc-def` is not a standard property name (may not be supported)'} | ||
]) | ||
@@ -392,3 +395,3 @@ done() | ||
{reason: 'NOTE: property value `red` is autofixed to `#FF0000`'}, | ||
{reason: 'WARNING: `-webkit-transform` is not a standard property name'}, | ||
{reason: 'WARNING: `-webkit-transform` is not a standard property name (may not be supported)'}, | ||
{reason: 'NOTE: unit `px` is not supported and property value `200px` is autofixed to `200`'} | ||
@@ -395,0 +398,0 @@ ]) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
83237
1356