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 |
"use strict";
|
|
2 |
|
|
3 |
module.exports = function(el, context) { |
1 only 2387.2 ✔ |
4 |
let builder = context.builder; |
353 only 2387.2 ✔ |
5 |
|
|
6 |
if (el.argument) {
|
|
7 |
let args = el.argument && builder.parseJavaScriptArgs(el.argument); |
|
8 |
el.argument = null;
|
263 only 2387.2 ✔ |
9 |
|
|
10 |
let target = args[0];
|
263 only 2387.2 ✔ |
11 |
let arg = args[1];
|
263 only 2387.2 ✔ |
12 |
|
|
13 |
if (target.type === "Literal") { |
|
14 |
target = context.importTemplate(target.value); |
100 only 2387.2 ✔ |
15 |
} |
|
16 |
|
|
17 |
var includeProps = {
|
263 only 2387.2 ✔ |
18 |
_target: target
|
|
19 |
}; |
|
20 |
|
|
21 |
if (arg) {
|
|
22 |
includeProps._arg = arg; |
47 only 2387.2 ✔ |
23 |
} |
|
24 |
|
|
25 |
el.addProps(includeProps); |
263 only 2387.2 ✔ |
26 |
} else if (!el.hasProp("_target")) { |
|
27 |
context.addError( |
2 only 2387.2 ✔ |
28 |
el, |
|
29 |
'The <include(...)> tag must have an argument: <include("./target.marko")/> or <include(data.renderBody)/>'
|
|
30 |
); |
|
31 |
} |
|
32 |
}; |