File / Directory |
Mutation score |
# Killed |
# Survived |
# Timeout |
# No coverage |
# Runtime errors |
# Transpile errors |
Total detected |
Total undetected |
Total mutants | |
---|---|---|---|---|---|---|---|---|---|---|---|
get-options.js | 90.16 | 55 | 6 | 0 | 0 | 0 | 0 | 55 | 6 | 61 |
/**
* Get ajax options from form
* @param {HTMLFormElement} form - form element
* @returns {{ajax: {url: string, method: string, enctype: string, sendType: *}}} - options
*/
export function getFormOptions(form) 0{}{
const enctype = form.getAttribute(1""'enctype');
return 2{}{
ajax: 3{}{
enctype,
url: form.getAttribute(4""'action'),
method: form.getAttribute(5""'method'),
sendType: 6enctype !== 'multipart/form-data'7false8trueenctype === 9""'multipart/form-data' ? 10""'formData' : undefined,
},
};
}
/**
* Get validatation options from input attribute of className
* @param {HTMLInputElement|HTMLSelectElement} input - input for validation
* @returns {object} - rules
*/
export function getInputRules(input) 11{}{
const defaultRules = 12[][13""'required', 14""'email', 15""'tel', 16""'url'];
const rules = defaultRules.reduce((inputRules, rule) => 17{}{
const newRules = {};
const newRule = 18(input.hasAttribute(rule) || input.type === rule) && input.classList.contains(rule)19false20true21input.hasAttribute(rule) && input.type === rule22false23trueinput.hasAttribute(rule) || 24input.type !== rule25false26trueinput.type === rule || input.classList.contains(rule);
if (27false28truenewRule) 29{}{
newRules[rule] = newRule;
}
return 30{}{
...inputRules,
...newRules,
};
}, {});
const regexp = input.hasAttribute(31""'pattern') ? new RegExp(input.getAttribute(32""'pattern')) : undefined;
const step = input.hasAttribute(33""'step') ? parseInt(input.getAttribute(34""'step'), 10) : undefined;
if (35false36true37input.type !== 'date'input.type === 38""'date') 39{}{
const min = input.hasAttribute(40""'min') ? new Date(input.getAttribute(41""'min')) : undefined;
const max = input.hasAttribute(42""'max') ? new Date(input.getAttribute(43""'max')) : undefined;
if (44false45truemin) rules.minDate = min;
if (46true47falsemax) rules.maxDate = max;
} else 48{}{
const min = input.hasAttribute(49""'min') ? parseInt(input.getAttribute(50""'min'), 10) : undefined;
const max = input.hasAttribute(51""'max') ? parseInt(input.getAttribute(52""'max'), 10) : undefined;
if (53false54truemin) rules.min = min;
if (55false56truemax) rules.max = max;
}
if (57false58trueregexp) rules.regexp = regexp;
if (59false60truestep) rules.step = step;
return rules;
}
# | Mutator | State | Location | Original | Replacement |
---|---|---|---|---|---|
0 | Block | Killed | 5 : 37 | {
... };
} |
{} |
1 | StringLiteral | Killed | 6 : 38 | ' ' |
"" |
2 | ObjectLiteral | Killed | 8 : 11 | {
... } |
{} |
3 | ObjectLiteral | Killed | 9 : 14 | {
... } |
{} |
4 | StringLiteral | Killed | 11 : 35 | ' ' |
"" |
5 | StringLiteral | Killed | 12 : 38 | ' ' |
"" |
6 | BinaryExpression | Killed | 13 : 22 | === '... ' |
!== '... ' |
7 | ConditionalExpression | Killed | 13 : 22 | === '... ' |
|
8 | ConditionalExpression | Killed | 13 : 22 | === '... ' |
|
9 | StringLiteral | Killed | 13 : 34 | ' ... ' |
"" |
10 | StringLiteral | Killed | 13 : 58 | ' ' |
"" |
11 | Block | Killed | 23 : 37 | {
... ;
} |
{} |
12 | ArrayLiteral | Killed | 24 : 25 | [' ... '] |
[] |
13 | StringLiteral | Killed | 24 : 26 | ' ' |
"" |
14 | StringLiteral | Killed | 24 : 38 | ' ' |
"" |
15 | StringLiteral | Killed | 24 : 47 | ' ' |
"" |
16 | StringLiteral | Killed | 24 : 54 | ' ' |
"" |
17 | Block | Killed | 26 : 60 | {
... } |
{} |
18 | BinaryExpression | Killed | 28 : 24 | . ... ) |
( ... ) |
19 | ConditionalExpression | Killed | 28 : 24 | . ... ) |
|
20 | ConditionalExpression | Killed | 28 : 24 | . ... ) |
|
21 | BinaryExpression | Killed | 28 : 24 | . ... === |
. ... === |
22 | ConditionalExpression | Killed | 28 : 24 | . ... === |
|
23 | ConditionalExpression | Killed | 28 : 24 | . ... === |
|
24 | BinaryExpression | Killed | 28 : 52 | . === |
. !== |
25 | ConditionalExpression | Killed | 28 : 52 | . === |
|
26 | ConditionalExpression | Killed | 28 : 52 | . === |
|
27 | IfStatement | Killed | 30 : 12 |
|
|
28 | IfStatement | Killed | 30 : 12 |
|
|
29 | Block | Killed | 30 : 21 | {
... } |
{} |
30 | ObjectLiteral | Killed | 34 : 15 | {
... } |
{} |
31 | StringLiteral | Killed | 40 : 38 | ' ' |
"" |
32 | StringLiteral | Killed | 40 : 81 | ' ' |
"" |
33 | StringLiteral | Killed | 41 : 36 | ' ' |
"" |
34 | StringLiteral | Killed | 41 : 74 | ' ' |
"" |
35 | IfStatement | Killed | 43 : 8 | . ... ' |
|
36 | IfStatement | Killed | 43 : 8 | . ... ' |
|
37 | BinaryExpression | Killed | 43 : 8 | . ... ' |
. ... ' |
38 | StringLiteral | Killed | 43 : 23 | ' ' |
"" |
39 | Block | Killed | 43 : 31 | {
... } |
{} |
40 | StringLiteral | Killed | 44 : 39 | ' ' |
"" |
41 | StringLiteral | Killed | 44 : 76 | ' ' |
"" |
42 | StringLiteral | Killed | 45 : 39 | ' ' |
"" |
43 | StringLiteral | Killed | 45 : 76 | ' ' |
"" |
44 | IfStatement | Killed | 46 : 12 |
|
|
45 | IfStatement | Survived | 46 : 12 |
|
|
46 | IfStatement | Survived | 47 : 12 |
|
|
47 | IfStatement | Killed | 47 : 12 |
|
|
48 | Block | Killed | 48 : 11 | {
... } |
{} |
49 | StringLiteral | Killed | 49 : 39 | ' ' |
"" |
50 | StringLiteral | Killed | 49 : 76 | ' ' |
"" |
51 | StringLiteral | Killed | 50 : 39 | ' ' |
"" |
52 | StringLiteral | Killed | 50 : 76 | ' ' |
"" |
53 | IfStatement | Killed | 51 : 12 |
|
|
54 | IfStatement | Survived | 51 : 12 |
|
|
55 | IfStatement | Killed | 52 : 12 |
|
|
56 | IfStatement | Survived | 52 : 12 |
|
|
57 | IfStatement | Killed | 55 : 8 |
|
|
58 | IfStatement | Survived | 55 : 8 |
|
|
59 | IfStatement | Killed | 56 : 8 |
|
|
60 | IfStatement | Survived | 56 : 8 |
|
|