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

can.Mustache: using local helpers inside partials #791

Closed
isadovskiy opened this issue Mar 14, 2014 · 12 comments
Closed

can.Mustache: using local helpers inside partials #791

isadovskiy opened this issue Mar 14, 2014 · 12 comments
Labels
Milestone

Comments

@isadovskiy
Copy link

I tried to use local helpers (defined via can.view("#template", data, helpers)) inside partial. However partial did not find the helper.

Inside mustache.js I see the following code:

// Call into `can.view.render` passing the
// partial and scope.
return can.view.render(partial, scope /*, options*/ );

"Options" are commented for some reason. Uncommenting this piece makes helpers available inside partials. So is there any specific reason why it's commented and if uncommenting this line could cause ant issues?

@isadovskiy
Copy link
Author

Any feedback on this issue?

@justinbmeyer
Copy link
Contributor

Try uncommenting it and seeing if our tests pass.

@isadovskiy
Copy link
Author

For some reason tests does not work for me...

Running "qunit:steal" (qunit) task
Testing http://localhost:8000/test/jquery.html
Warning: PhantomJS timed out, possibly due to a missing QUnit start() call. Use --force to continue.

Aborted due to warnings.

Tests are lunched. I even can open test page in browser. But suddenly it interrupts by timeout...

@daffl
Copy link
Contributor

daffl commented Mar 25, 2014

What operating system are you using?

@isadovskiy
Copy link
Author

Win7

@daffl
Copy link
Contributor

daffl commented Mar 25, 2014

From what I could find out so far, PhantomJS (which doesn't need to be installed btw, grunt-qunit uses the NPM package) runs a little slower on Windows.
I got the tests to start by setting the timeout in https://github.com/bitovi/canjs/blob/master/Gruntfile.js#L218 higher (to e.g. 60000):

screen shot 2014-03-25 at 12 16 22 pm

But now it sometimes hangs when running a different test. This might be solved when migrating from the Grunt QUnit task to Testee which I am planning to do (it didn't stall when I tried it at least).

I will look into it some more but if it keeps stalling for you, too, to develop CanJS and write tests, the workaround would be just running grunt build and then run all the test files (test/index.html and maybe test/dist/jquery.html) in the browser and let Travis do the automated testing when making a pull request.

@isadovskiy
Copy link
Author

I extended timeout to 60,000 ms. It gave time to pass http://localhost:8000/test/jquery.html test in browser:

Tests completed in 25489 milliseconds.
1959 assertions of 1959 passed, 0 failed.

BTW, as for development/contribution to CanJS - do you have any instructions (rules to create branches for fixes, pull requests and etc)?

@isadovskiy
Copy link
Author

I re-compiled the code with uncommented /, options/ param and run the tests in browser. Both test/jquery.html and test/dist/jquery.html worked out fine for me, without errors.

@matthewp
Copy link
Contributor

@isadovskiy Here's the contributing guide.

@isadovskiy
Copy link
Author

To submit a fix, should I create a branch in original canjs repository or in own forked repository?

@matthewp
Copy link
Contributor

Fork.

@isadovskiy
Copy link
Author

Thanks for the clarification, Matthew.

@ccummings ccummings added this to the 2.1.1 milestone May 15, 2014
@ccummings ccummings added the Bug label May 15, 2014
ccummings pushed a commit that referenced this issue May 20, 2014
Helpers are now passed into partials. Fixes #791.
gsmeets pushed a commit to gsmeets/canjs that referenced this issue Aug 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants