Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
rjs_json_form
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
rjs_json_form
Commits
fc1ab025
Commit
fc1ab025
authored
Aug 24, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jslint fix
parent
78fce380
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
10 deletions
+20
-10
test/jsonform_test.js
test/jsonform_test.js
+20
-10
No files found.
test/jsonform_test.js
View file @
fc1ab025
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
todo_tests
;
todo_tests
;
QUnit
.
config
.
autostart
=
false
;
QUnit
.
config
.
autostart
=
false
;
QUnit
.
dump
.
maxDepth
=
10
;
function
replaceAll
(
str
,
searchStr
,
replaceStr
)
{
function
replaceAll
(
str
,
searchStr
,
replaceStr
)
{
searchStr
=
searchStr
.
replace
(
/
[\-\/\\\^
$*+?.()|
\[\]
{}
]
/g
,
'
\\
$&
'
);
searchStr
=
searchStr
.
replace
(
/
[\-\/\\\^
$*+?.()|
\[\]
{}
]
/g
,
'
\\
$&
'
);
...
@@ -113,8 +114,10 @@
...
@@ -113,8 +114,10 @@
return
gadget
.
getContent
();
return
gadget
.
getContent
();
})
})
.
push
(
function
(
json_document
)
{
.
push
(
function
(
json_document
)
{
assert
.
deepEqual
(
schema
,
schema_orig
,
"
schema not change (side effect absent)
"
);
assert
.
deepEqual
(
schema
,
schema_orig
,
assert
.
deepEqual
(
JSON
.
parse
(
json_document
[
key
]),
value
,
"
returned value equal
"
);
"
schema not change (side effect absent)
"
);
assert
.
deepEqual
(
JSON
.
parse
(
json_document
[
key
]),
value
,
"
returned value equal
"
);
})
})
.
push
(
undefined
,
function
(
error
)
{
.
push
(
undefined
,
function
(
error
)
{
assert
.
notOk
(
error
,
"
issue in gadget
"
);
assert
.
notOk
(
error
,
"
issue in gadget
"
);
...
@@ -144,7 +147,8 @@
...
@@ -144,7 +147,8 @@
// XXX base URI change based on $id property not realised
// XXX base URI change based on $id property not realised
todo_tests
.
push
(
"
base URI change: base URI change ref valid
"
);
todo_tests
.
push
(
"
base URI change: base URI change ref valid
"
);
todo_tests
.
push
(
"
base URI change - change folder: number is valid
"
);
todo_tests
.
push
(
"
base URI change - change folder: number is valid
"
);
todo_tests
.
push
(
"
base URI change - change folder in subschema: number is valid
"
);
todo_tests
.
push
(
"
base URI change - change folder in subschema:
"
+
"
number is valid
"
);
function
create_callback
(
schema
,
schema_url
,
value
,
valid
)
{
function
create_callback
(
schema
,
schema_url
,
value
,
valid
)
{
return
function
(
assert
)
{
return
function
(
assert
)
{
...
@@ -161,7 +165,7 @@
...
@@ -161,7 +165,7 @@
if
(
settings
.
invert_valid
)
{
if
(
settings
.
invert_valid
)
{
valid
=
!
valid
;
valid
=
!
valid
;
}
}
create_gadget
(
function
(
method_name
,
argument_list
)
{
create_gadget
(
function
(
method_name
)
{
if
(
method_name
===
"
notifyValid
"
)
{
if
(
method_name
===
"
notifyValid
"
)
{
assert
.
ok
(
valid
,
"
form correctly filled
"
);
assert
.
ok
(
valid
,
"
form correctly filled
"
);
}
else
if
(
method_name
===
"
notifyInvalid
"
)
{
}
else
if
(
method_name
===
"
notifyInvalid
"
)
{
...
@@ -196,13 +200,16 @@
...
@@ -196,13 +200,16 @@
// if schema used check side error
// if schema used check side error
// if schema_url used we can not check schema_side_error
// if schema_url used we can not check schema_side_error
// because gadget himself download schema
// because gadget himself download schema
assert
.
ok
(
json_document
.
hasOwnProperty
(
key
),
"
getContent does not content property
"
);
assert
.
ok
(
json_document
.
hasOwnProperty
(
key
),
assert
.
deepEqual
(
schema
,
schema_orig
,
"
schema changed (side effect on schema)
"
);
"
getContent does not content property
"
);
assert
.
deepEqual
(
schema
,
schema_orig
,
"
schema changed (side effect on schema)
"
);
}
}
try
{
try
{
returned_value
=
JSON
.
parse
(
json_document
[
key
]);
returned_value
=
JSON
.
parse
(
json_document
[
key
]);
}
catch
(
error
)
{
}
catch
(
error
)
{
assert
.
notOk
(
"
value not parsable:'
"
+
returned_value
+
"
'
\n
"
+
error
);
assert
.
notOk
(
"
value not parsable:'
"
+
returned_value
+
"
'
\n
"
+
error
);
}
}
if
(
!
changed
)
{
if
(
!
changed
)
{
assert
.
deepEqual
(
returned_value
,
value
,
assert
.
deepEqual
(
returned_value
,
value
,
...
@@ -254,11 +261,14 @@
...
@@ -254,11 +261,14 @@
m
=
list
[
i
][
k
];
m
=
list
[
i
][
k
];
skip_module
=
skip_modules
.
indexOf
(
m
.
description
)
>=
0
;
skip_module
=
skip_modules
.
indexOf
(
m
.
description
)
>=
0
;
module
(
m
.
description
);
module
(
m
.
description
);
schema
=
JSON
.
parse
(
replaceAll
(
JSON
.
stringify
(
m
.
schema
),
"
http://localhost:1234/
"
,
schema
=
JSON
.
parse
(
replaceAll
(
JSON
.
stringify
(
m
.
schema
),
"
http://localhost:9000/node_modules/json-schema-test-suite/remotes/
"
));
"
http://localhost:1234/
"
,
"
http://localhost:9000/node_modules/
"
+
"
json-schema-test-suite/remotes/
"
));
for
(
z
=
0
;
z
<
m
.
tests
.
length
;
z
+=
1
)
{
for
(
z
=
0
;
z
<
m
.
tests
.
length
;
z
+=
1
)
{
t
=
m
.
tests
[
z
];
t
=
m
.
tests
[
z
];
if
(
todo_tests
.
indexOf
(
m
.
description
+
'
:
'
+
t
.
description
)
>=
0
)
{
if
(
todo_tests
.
indexOf
(
m
.
description
+
'
:
'
+
t
.
description
)
>=
0
)
{
create_test
=
QUnit
.
todo
;
create_test
=
QUnit
.
todo
;
}
else
if
(
skip_module
||
skip_file
)
{
}
else
if
(
skip_module
||
skip_file
)
{
create_test
=
QUnit
.
skip
;
create_test
=
QUnit
.
skip
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment