travis-ci
4670 of 5656 branches covered (82.57%)
13 of 13 new or added lines in 2 files covered. (100.0%)
10412 of 11525 relevant lines covered (90.34%)
5850.54 hits per line
1 |
module.exports = function nodeFactory(el, context) { |
1 only 2387.2 ✔ |
2 |
var argument = el.argument;
|
16 only 2387.2 ✔ |
3 |
var attributes = el.attributes;
|
16 only 2387.2 ✔ |
4 |
|
|
5 |
if (!argument) {
|
|
6 |
context.addError( |
2 only 2387.2 ✔ |
7 |
"Invalid <else-if> tag. Argument is missing. Example; <if(foo === true)>"
|
|
8 |
); |
|
9 |
return el;
|
2 only 2387.2 ✔ |
10 |
} |
|
11 |
|
|
12 |
if (attributes.length) {
|
|
13 |
context.addError("Invalid <else-if> tag. Attributes not allowed.");
|
2 only 2387.2 ✔ |
14 |
return el;
|
2 only 2387.2 ✔ |
15 |
} |
|
16 |
|
|
17 |
var test;
|
|
18 |
try {
|
12 only 2387.2 ✔ |
19 |
test = context.builder.parseExpression(argument); |
12 only 2387.2 ✔ |
20 |
} catch (e) {
|
|
21 |
test = context.builder.literalFalse(); |
4 only 2387.2 ✔ |
22 |
context.addError( |
4 only 2387.2 ✔ |
23 |
"Invalid expression for else-if statement:\n" + e.message
|
|
24 |
); |
|
25 |
} |
|
26 |
|
|
27 |
var elseIfStatement = context.builder.elseIfStatement(test);
|
12 only 2387.2 ✔ |
28 |
return elseIfStatement;
|
12 only 2387.2 ✔ |
29 |
}; |