Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix partial numbers being detected as numbers #235

Merged
merged 2 commits into from
Jan 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function addComponentAttributes ( generator, node, local ) {

if ( value.type === 'Text' ) {
// static attributes
const result = isNaN( parseFloat( value.data ) ) ? JSON.stringify( value.data ) : value.data;
const result = isNaN( value.data ) ? JSON.stringify( value.data ) : value.data;
local.staticAttributes.push({
name: attribute.name,
value: result
Expand Down
1 change: 1 addition & 0 deletions test/generator/attribute-partial-number/Component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p data-value="{{value}}"></p>
3 changes: 3 additions & 0 deletions test/generator/attribute-partial-number/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
html: '<p data-value="10px"></p>'
};
11 changes: 11 additions & 0 deletions test/generator/attribute-partial-number/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Component value="10px"/>

<script>
import Component from './Component.html';

export default {
components: {
Component
}
};
</script>