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
bb373146
Commit
bb373146
authored
Aug 15, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: use schema instead schema_url option when rendered
parent
e9ac0240
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
12 deletions
+21
-12
test/jsonform_test.js
test/jsonform_test.js
+15
-10
test/jsonform_test_view.js
test/jsonform_test_view.js
+6
-2
No files found.
test/jsonform_test.js
View file @
bb373146
...
...
@@ -166,7 +166,7 @@
settings
=
test_settings
[
test_id
]
||
{},
key
=
"
foo_key
"
,
schema_orig
;
if
(
schema
)
{
if
(
schema
!==
undefined
)
{
schema_orig
=
JSON
.
parse
(
JSON
.
stringify
(
schema
));
}
if
(
settings
.
invert_valid
)
{
...
...
@@ -182,12 +182,17 @@
}
})
.
push
(
function
(
g
)
{
gadget
=
g
;
return
gadget
.
render
({
var
opt
=
{
key
:
key
,
schema_url
:
schema_url
,
value
:
value
});
};
gadget
=
g
;
if
(
schema
!==
undefined
)
{
opt
.
schema
=
schema
;
}
else
{
opt
.
schema_url
=
schema_url
;
}
return
gadget
.
render
(
opt
);
})
.
push
(
function
(
element
)
{
assert
.
ok
(
element
,
"
gadget rendered
"
);
...
...
@@ -195,7 +200,7 @@
})
.
push
(
function
(
json_document
)
{
var
returned_value
;
if
(
schema_orig
)
{
if
(
schema_orig
!==
undefined
)
{
// if schema used check side error
// if schema_url used we can not check schema_side_error
// because gadget himself download schema
...
...
@@ -248,7 +253,7 @@
z
,
m
,
t
,
//
schema,
schema
,
skip_file
,
skip_module
,
create_test
;
...
...
@@ -258,8 +263,8 @@
m
=
list
[
i
][
k
];
skip_module
=
skip_modules
.
indexOf
(
m
.
description
)
>=
0
;
module
(
m
.
description
);
//
schema = JSON.parse(JSON.stringify(m.schema).replace("http://localhost:1234/",
//
"http://localhost:9000/node_modules/json-schema-test-suite/remotes/"));
schema
=
JSON
.
parse
(
JSON
.
stringify
(
m
.
schema
).
replace
(
"
http://localhost:1234/
"
,
"
http://localhost:9000/node_modules/json-schema-test-suite/remotes/
"
));
for
(
z
=
0
;
z
<
m
.
tests
.
length
;
z
+=
1
)
{
t
=
m
.
tests
[
z
];
if
(
todo_tests
.
indexOf
(
m
.
description
+
'
:
'
+
t
.
description
)
>=
0
)
{
...
...
@@ -271,7 +276,7 @@
}
create_test
(
t
.
description
,
create_callback
(
null
,
//schema
schema
,
url_list
[
i
]
+
'
#/
'
+
k
+
'
/schema
'
,
t
.
data
,
t
.
valid
...
...
test/jsonform_test_view.js
View file @
bb373146
...
...
@@ -65,17 +65,20 @@
k
,
z
,
m
,
schema
,
t
;
for
(
i
=
0
;
i
<
list
.
length
;
i
+=
1
)
{
for
(
k
=
0
;
k
<
list
[
i
].
length
;
k
+=
1
)
{
m
=
list
[
i
][
k
];
g
.
props
.
schemas
.
push
(
m
.
description
);
g
.
props
.
documents
[
m
.
description
]
=
[];
schema
=
JSON
.
parse
(
JSON
.
stringify
(
m
.
schema
).
replace
(
"
http://localhost:1234/
"
,
"
http://localhost:9000/node_modules/json-schema-test-suite/remotes/
"
));
for
(
z
=
0
;
z
<
m
.
tests
.
length
;
z
+=
1
)
{
t
=
m
.
tests
[
z
];
g
.
props
.
documents
[
m
.
description
].
push
(
t
.
description
);
g
.
props
.
test_data
[
m
.
description
+
'
:
'
+
t
.
description
]
=
{
schema
:
m
.
schema
,
schema
:
schema
,
schema_url
:
url_list
[
i
]
+
'
#/
'
+
k
+
'
/schema
'
,
data
:
t
.
data
,
status
:
t
.
valid
...
...
@@ -128,7 +131,7 @@
console
.
log
(
test
.
schema
);
console
.
log
(
test
.
data
);
return
gadget
.
changeState
({
schema
_url
:
test
.
schema_url
,
schema
:
test
.
schema
,
json_document
:
test
.
data
});
}
...
...
@@ -154,6 +157,7 @@
.
push
(
function
(
form_view
)
{
return
form_view
.
render
({
value
:
g
.
state
.
json_document
,
schema
:
g
.
state
.
schema
,
schema_url
:
g
.
state
.
schema_url
})
.
push
(
function
()
{
...
...
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