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

Comments

Projects
None yet
5 participants
@isadovskiy

isadovskiy commented Mar 14, 2014

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

This comment has been minimized.

Show comment
Hide comment
@isadovskiy

isadovskiy Mar 24, 2014

Any feedback on this issue?

isadovskiy commented Mar 24, 2014

Any feedback on this issue?

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Mar 24, 2014

Contributor

Try uncommenting it and seeing if our tests pass.

Contributor

justinbmeyer commented Mar 24, 2014

Try uncommenting it and seeing if our tests pass.

@isadovskiy

This comment has been minimized.

Show comment
Hide comment
@isadovskiy

isadovskiy Mar 25, 2014

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...

isadovskiy commented Mar 25, 2014

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

This comment has been minimized.

Show comment
Hide comment
@daffl

daffl Mar 25, 2014

Contributor

What operating system are you using?

Contributor

daffl commented Mar 25, 2014

What operating system are you using?

@isadovskiy

This comment has been minimized.

Show comment
Hide comment
@isadovskiy

isadovskiy commented Mar 25, 2014

Win7

@daffl

This comment has been minimized.

Show comment
Hide comment
@daffl

daffl Mar 25, 2014

Contributor

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.

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

This comment has been minimized.

Show comment
Hide comment
@isadovskiy

isadovskiy Mar 26, 2014

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 commented Mar 26, 2014

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

This comment has been minimized.

Show comment
Hide comment
@isadovskiy

isadovskiy Mar 26, 2014

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.

isadovskiy commented Mar 26, 2014

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

This comment has been minimized.

Show comment
Hide comment
@matthewp
Contributor

matthewp commented Mar 26, 2014

@isadovskiy

This comment has been minimized.

Show comment
Hide comment
@isadovskiy

isadovskiy Mar 26, 2014

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

isadovskiy commented Mar 26, 2014

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

@matthewp

This comment has been minimized.

Show comment
Hide comment
@matthewp

matthewp Mar 26, 2014

Contributor

Fork.

Contributor

matthewp commented Mar 26, 2014

Fork.

@isadovskiy

This comment has been minimized.

Show comment
Hide comment
@isadovskiy

isadovskiy Mar 26, 2014

Thanks for the clarification, Matthew.

isadovskiy commented Mar 26, 2014

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 added a commit that referenced this issue May 20, 2014

Merge pull request #989 from bitovi/971-enable-helpers-in-partials
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