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

category: fix (generator.js, line: 67 - properties with empty values omits quotes #157

Closed
wants to merge 1 commit into from

Conversation

Bampye
Copy link

@Bampye Bampye commented Sep 21, 2017

category: fix (generator.js, line: 67 - properties with empty values omits quotes

let app1 = new Moon({
    root: "#app",
    data: {
        msg: "Hello Moon!"
    },
});
<div id="app">
  <p>{{msg}}</p>
  <select name="some" multiple>
	<option value="0" selected>None</option>
	<option value="1">One</option>
  </select>
</div>

Result:

moon.min.js:40 [Moon] ERROR: Could not create render function
    error @ moon.min.js:40
    generate @ moon.min.js:1366
    compile @ moon.min.js:1374
    Moon.compile @ moon.min.js:1720
    Moon.mount @ moon.min.js:1616
    Moon.init @ moon.min.js:1677
    Moon @ moon.min.js:1435
moon.min.js:1624 Uncaught TypeError: Cannot read property 'type' of undefined
    at Moon.mount (moon.min.js:1624)
    at Moon.init (moon.min.js:1677)
    at new Moon (moon.min.js:1435)

Because:

var propsCode = generateProps(node, parent, specialDirectivesAfter, state);
console.log(propsCode)
...
{"attrs": {"id": "smart-view-two"}}, 
{"attrs": {}}, 
{"attrs": {"name": "some", "multiple": }}, 
{"attrs": {"value": "0", "selected": }}, 
{"attrs": {"value": "1"}}, 

@codecov-io
Copy link

Codecov Report

Merging #157 into master will increase coverage by 0.2%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #157     +/-   ##
=========================================
+ Coverage   96.08%   96.29%   +0.2%     
=========================================
  Files           1        1             
  Lines         920      917      -3     
  Branches      171      172      +1     
=========================================
- Hits          884      883      -1     
+ Misses         36       34      -2
Impacted Files Coverage Δ
dist/moon.js 96.29% <ø> (+0.2%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6f5acef...1678ea7. Read the comment docs.

@kbrsh
Copy link
Owner

kbrsh commented Sep 21, 2017

I think this should be fixed in the template compiler, and not the generator. Also, the commit message format is:

category: message

That means that you should have something like:

fix: allow properties with empty values

@kbrsh
Copy link
Owner

kbrsh commented Sep 21, 2017

@Bampye Thanks for bringing it to my attention! I actually fixed this as I rewrote the template compiler, and I'll just push the changes I have so far.

@kbrsh kbrsh closed this in 8aa0f8f Sep 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants