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

More tests for coverage #405

Merged
merged 1 commit into from
Jan 25, 2017
Merged

More tests for coverage #405

merged 1 commit into from
Jan 25, 2017

Conversation

miripiruni
Copy link
Contributor

No description provided.

@coveralls
Copy link

coveralls commented Jan 18, 2017

Coverage Status

Coverage increased (+0.5%) to 97.554% when pulling 69b14a0 on more-test into cebda10 on master.

isBEM = entity.block || entity.elem;
else
isBEM = ctx.bem;
isBEM = entity.block || entity.elem;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of bem in line 82 is result of bem() mode execution. And bem() returns this.ctx.bem by default.

@@ -93,7 +90,7 @@ BEMHTML.prototype.render = function render(context,

var addJSInitClass = jsParams && (
this._elemJsInstances ?
(entity.block || entity.elem) :
entity.block :
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of entity.block is always available.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure it's useless case but it works now:

BEMHTML.apply({ elem: 'e1' }); // '<div class="__e1"></div>'

@@ -284,9 +281,6 @@ BEMHTML.prototype.renderMix = function renderMix(entity,
context.elem = oldElem;
context.block = oldBlock;

if (!nestedMix)
continue;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of check in line 278 already the same.

@@ -8,7 +8,7 @@ var ClassBuilder = require('./class-builder').ClassBuilder;
var utils = require('./utils');

function BEMXJST(options) {
this.options = options || {};
this.options = options;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Reuse function if it already has right arguments
if (typeof code === 'function' && code.length === args.length)
return code;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this case is fantastic:

bemxjst.compile(function(block, elem, mod, addMods, content, …) { … })

Nobody wants to enumerate all modes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure. We can generate code with all modes ;-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm, you're right

Copy link
Member

@qfox qfox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest looks good

// Reuse function if it already has right arguments
if (typeof code === 'function' && code.length === args.length)
return code;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure. We can generate code with all modes ;-)

Copy link
Member

@tadatuta tadatuta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -93,7 +90,7 @@ BEMHTML.prototype.render = function render(context,

var addJSInitClass = jsParams && (
this._elemJsInstances ?
(entity.block || entity.elem) :
entity.block :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure it's useless case but it works now:

BEMHTML.apply({ elem: 'e1' }); // '<div class="__e1"></div>'

@@ -146,5 +146,60 @@ describe('API compile', function() {
template.apply({ block: 'b1' });
});
});

it('should throw bem-xjst error on template with no block', function() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without block

@miripiruni miripiruni merged commit 4ed06f1 into master Jan 25, 2017
@miripiruni miripiruni deleted the more-test branch January 29, 2018 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants