weex-styler
Advanced tools
Comparing version 0.2.7 to 0.3.0
@@ -175,3 +175,3 @@ var util = require('./util') | ||
var LENGTH_REGEXP = /^[-+]?\d*\.?\d+(\S*)$/ | ||
var SUPPORT_CSS_UNIT = ['pt', 'wx'] | ||
var SUPPORT_CSS_UNIT = ['px', 'pt', 'wx'] | ||
@@ -178,0 +178,0 @@ var ANYTHING_VALIDATOR = function ANYTHING_VALIDATOR(v) { |
{ | ||
"name": "weex-styler", | ||
"version": "0.2.7", | ||
"version": "0.3.0", | ||
"description": "Weex <style> transformer", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -16,3 +16,3 @@ var chai = require('chai') | ||
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'}, bar: {background: 'red'}}) | ||
expect(data.jsonStyle).eql({foo: {color: '#FF0000', backgroundColor: 'rgba(255,255,255,0.6)', WebkitTransform: 'rotate(90deg)', width: '200px', left: 0, right: '0px', borderWidth: '1pt', fontWeight: '100'}, bar: {background: 'red'}}) | ||
expect(data.log).eql([ | ||
@@ -22,4 +22,2 @@ {line: 1, column: 1, reason: 'ERROR: Selector `html` is not supported. Weex only support single-classname selector'}, | ||
{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: 5, column: 7, reason: 'WARNING: `background` is not a standard property name (may not be supported), suggest `background-color`'} | ||
@@ -36,3 +34,3 @@ ]) | ||
expect(data).is.an.object | ||
expect(data.jsonStyle).eql({foo: {fontSize: 200}}) | ||
expect(data.jsonStyle).eql({foo: {fontSize: '200px'}}) | ||
done() | ||
@@ -47,3 +45,3 @@ }) | ||
expect(data).is.an.object | ||
expect(data.jsonStyle).eql({foo: {lineHeight: 40}, bar: {lineHeight: 20}}) | ||
expect(data.jsonStyle).eql({foo: {lineHeight: 40}, bar: {lineHeight: '20px'}}) | ||
done() | ||
@@ -207,9 +205,9 @@ }) | ||
expect(data.jsonStyle.foo).eql({ | ||
paddingTop: 20, | ||
paddingRight: 20, | ||
paddingBottom: 20, | ||
paddingLeft: 20, | ||
marginTop: 30, | ||
paddingTop: '20px', | ||
paddingRight: '20px', | ||
paddingBottom: '20px', | ||
paddingLeft: '20px', | ||
marginTop: '30px', | ||
marginRight: 40, | ||
marginBottom: 30, | ||
marginBottom: '30px', | ||
marginLeft: 40 | ||
@@ -219,6 +217,6 @@ }) | ||
paddingTop: 10, | ||
paddingRight: 20, | ||
paddingBottom: 30, | ||
paddingRight: '20px', | ||
paddingBottom: '30px', | ||
paddingLeft: 40, | ||
marginTop: 10, | ||
marginTop: '10px', | ||
marginRight: 20, | ||
@@ -238,11 +236,11 @@ marginBottom: 30, | ||
expect(data.jsonStyle.foo).eql({ | ||
paddingTop: 20, | ||
paddingRight: 20, | ||
paddingBottom: 20, | ||
paddingLeft: 30 | ||
paddingTop: '20px', | ||
paddingRight: '20px', | ||
paddingBottom: '20px', | ||
paddingLeft: '30px' | ||
}) | ||
expect(data.jsonStyle.bar).eql({ | ||
marginTop: 10, | ||
marginTop: '10px', | ||
marginRight: 20, | ||
marginBottom: 30, | ||
marginBottom: '30px', | ||
marginLeft: 20 | ||
@@ -249,0 +247,0 @@ }) |
@@ -44,11 +44,9 @@ var chai = require('chai') | ||
expect(data.jsonStyle).eql({foo: { | ||
width: 200, | ||
width: '200px', | ||
paddingLeft: 300, | ||
borderWidth: '1pt', | ||
left: 0, | ||
right: 0 | ||
right: '0px' | ||
}}) | ||
expect(data.log).eql([ | ||
{reason: 'NOTE: unit `px` is not supported and property value `200px` is autofixed to `200`'}, | ||
{reason: 'NOTE: unit `px` is not supported and property value `0px` is autofixed to `0`'}, | ||
{reason: 'ERROR: property value `asdf` is not supported for `margin-right` (only number and pixel values are supported)'} | ||
@@ -411,3 +409,3 @@ ]) | ||
abc: 123, | ||
def: 456, | ||
def: '456px', | ||
ghi: '789pt', | ||
@@ -441,7 +439,6 @@ AbcDef: 456, | ||
expect(data).is.an.object | ||
expect(data.jsonStyle).eql({foo: {color: '#FF0000', WebkitTransform: 'rotate(90deg)', width: 200}}) | ||
expect(data.jsonStyle).eql({foo: {color: '#FF0000', WebkitTransform: 'rotate(90deg)', width: '200px'}}) | ||
expect(data.log).eql([ | ||
{reason: 'NOTE: property value `red` is autofixed to `#FF0000`'}, | ||
{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`'} | ||
{reason: 'WARNING: `-webkit-transform` is not a standard property name (may not be supported)'} | ||
]) | ||
@@ -448,0 +445,0 @@ done() |
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
62799
1842