vue-server
Advanced tools
Comparing version 0.4.1 to 0.4.2
{ | ||
"name": "vue-server", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "Vue.js server side version", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -129,5 +129,3 @@ var cssParser = require('../css'); | ||
var valueIsString = typeof value === 'string'; | ||
if (name === 'style' && !valueIsString) { | ||
if (name === 'style') { | ||
// Need to consider element's own styles | ||
@@ -142,3 +140,5 @@ var originalStyle = element.attribs.style; | ||
// Drop value if class is Array | ||
if (Array.isArray(value)) { | ||
if (typeof value === 'string') { | ||
value = cssParser.parse(value); | ||
} else if (Array.isArray(value)) { | ||
value = common.extend.apply(common, value); | ||
@@ -151,3 +151,3 @@ } | ||
if (name === 'class' && !valueIsString) { | ||
if (name === 'class') { | ||
(function () { | ||
@@ -160,4 +160,6 @@ var classList = []; | ||
if (Array.isArray(value)) { | ||
classList = value; | ||
if (typeof value === 'string') { | ||
classList = classList.concat(value.split(' ')); | ||
} else if (Array.isArray(value)) { | ||
classList = classList.concat(value); | ||
} else { | ||
@@ -164,0 +166,0 @@ for (var name in value) { |
@@ -80,3 +80,3 @@ var common = require('./common'); | ||
// If there are many nested $merge | ||
if (elementChild.name === '$merge') { | ||
if (elementChild.name === '$merge' || elementChild.name === 'template') { | ||
return renders.renderTemplate(element.inner); | ||
@@ -103,5 +103,5 @@ } | ||
element.attribs[key] = elementChild.attribs[key]; | ||
} | ||
return renders.renderTag(element); | ||
@@ -108,0 +108,0 @@ }, |
@@ -8,9 +8,9 @@ var wrapComponent = require('./wrapComponent.js'); | ||
'<span id="class-plain" :class="otherProp"></span>', | ||
'<span id="class-object" :class="{test: true, test2: false, test3: someProp}"></span>', | ||
'<span id="class-array" :class="[otherProp, nothing, \'test\', false, 0]"></span>', | ||
'<span id="class-plain" class="own" :class="otherProp"></span>', | ||
'<span id="class-object" class="own" :class="{test: true, test2: false, test3: someProp}"></span>', | ||
'<span id="class-array" class="own" :class="[otherProp, nothing, \'test\', false, 0]"></span>', | ||
'<span id="style-plain" :style="stylePlain"></span>', | ||
'<span id="style-object" :style="{fontSize: 32 + \'px\', \'padding-top\': \'10px\'}"></span>', | ||
'<span id="style-array" :style="[styleObjectOne, styleObjectTwo]"></span>', | ||
'<span id="style-plain" style="overflow: hidden" :style="stylePlain"></span>', | ||
'<span id="style-object" style="overflow: hidden" :style="{fontSize: 32 + \'px\', \'padding-top\': \'10px\'}"></span>', | ||
'<span id="style-array" style="overflow: hidden" :style="[styleObjectOne, styleObjectTwo]"></span>', | ||
'</div>'].join(''), | ||
@@ -49,11 +49,11 @@ data: function () { | ||
it('in plain format ', function () { | ||
expect($('#class-plain').attr('class')).toEqual('yes-of-course'); | ||
expect($('#class-plain').attr('class')).toEqual('own yes-of-course'); | ||
}); | ||
it('in object format', function () { | ||
expect($('#class-object').attr('class')).toEqual('test test3'); | ||
expect($('#class-object').attr('class')).toEqual('own test test3'); | ||
}); | ||
it('in array format', function () { | ||
expect($('#class-array').attr('class')).toEqual('yes-of-course test'); | ||
expect($('#class-array').attr('class')).toEqual('own yes-of-course test'); | ||
}); | ||
@@ -64,2 +64,3 @@ }); | ||
it('in plain format ', function () { | ||
expect($('#style-plain').css('overflow')).toEqual('hidden'); | ||
expect($('#style-plain').css('color')).toEqual('red'); | ||
@@ -69,2 +70,3 @@ }); | ||
it('in object format', function () { | ||
expect($('#style-object').css('overflow')).toEqual('hidden'); | ||
expect($('#style-object').css('font-size')).toEqual('32px'); | ||
@@ -75,2 +77,3 @@ expect($('#style-object').css('padding-top')).toEqual('10px'); | ||
it('in array format', function () { | ||
expect($('#style-array').css('overflow')).toEqual('hidden'); | ||
expect($('#style-array').css('color')).toEqual('red'); | ||
@@ -77,0 +80,0 @@ expect($('#style-array').css('font-size')).toEqual('35px'); |
361484
10071