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
Show 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 @@
...
@@ -166,7 +166,7 @@
settings
=
test_settings
[
test_id
]
||
{},
settings
=
test_settings
[
test_id
]
||
{},
key
=
"
foo_key
"
,
key
=
"
foo_key
"
,
schema_orig
;
schema_orig
;
if
(
schema
)
{
if
(
schema
!==
undefined
)
{
schema_orig
=
JSON
.
parse
(
JSON
.
stringify
(
schema
));
schema_orig
=
JSON
.
parse
(
JSON
.
stringify
(
schema
));
}
}
if
(
settings
.
invert_valid
)
{
if
(
settings
.
invert_valid
)
{
...
@@ -182,12 +182,17 @@
...
@@ -182,12 +182,17 @@
}
}
})
})
.
push
(
function
(
g
)
{
.
push
(
function
(
g
)
{
gadget
=
g
;
var
opt
=
{
return
gadget
.
render
({
key
:
key
,
key
:
key
,
schema_url
:
schema_url
,
value
:
value
value
:
value
});
};
gadget
=
g
;
if
(
schema
!==
undefined
)
{
opt
.
schema
=
schema
;
}
else
{
opt
.
schema_url
=
schema_url
;
}
return
gadget
.
render
(
opt
);
})
})
.
push
(
function
(
element
)
{
.
push
(
function
(
element
)
{
assert
.
ok
(
element
,
"
gadget rendered
"
);
assert
.
ok
(
element
,
"
gadget rendered
"
);
...
@@ -195,7 +200,7 @@
...
@@ -195,7 +200,7 @@
})
})
.
push
(
function
(
json_document
)
{
.
push
(
function
(
json_document
)
{
var
returned_value
;
var
returned_value
;
if
(
schema_orig
)
{
if
(
schema_orig
!==
undefined
)
{
// 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
...
@@ -248,7 +253,7 @@
...
@@ -248,7 +253,7 @@
z
,
z
,
m
,
m
,
t
,
t
,
//
schema,
schema
,
skip_file
,
skip_file
,
skip_module
,
skip_module
,
create_test
;
create_test
;
...
@@ -258,8 +263,8 @@
...
@@ -258,8 +263,8 @@
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(JSON.stringify(m.schema).replace("http://localhost:1234/",
schema
=
JSON
.
parse
(
JSON
.
stringify
(
m
.
schema
).
replace
(
"
http://localhost:1234/
"
,
//
"http://localhost:9000/node_modules/json-schema-test-suite/remotes/"));
"
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
)
{
...
@@ -271,7 +276,7 @@
...
@@ -271,7 +276,7 @@
}
}
create_test
(
t
.
description
,
create_callback
(
create_test
(
t
.
description
,
create_callback
(
null
,
//schema
schema
,
url_list
[
i
]
+
'
#/
'
+
k
+
'
/schema
'
,
url_list
[
i
]
+
'
#/
'
+
k
+
'
/schema
'
,
t
.
data
,
t
.
data
,
t
.
valid
t
.
valid
...
...
test/jsonform_test_view.js
View file @
bb373146
...
@@ -65,17 +65,20 @@
...
@@ -65,17 +65,20 @@
k
,
k
,
z
,
z
,
m
,
m
,
schema
,
t
;
t
;
for
(
i
=
0
;
i
<
list
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
list
.
length
;
i
+=
1
)
{
for
(
k
=
0
;
k
<
list
[
i
].
length
;
k
+=
1
)
{
for
(
k
=
0
;
k
<
list
[
i
].
length
;
k
+=
1
)
{
m
=
list
[
i
][
k
];
m
=
list
[
i
][
k
];
g
.
props
.
schemas
.
push
(
m
.
description
);
g
.
props
.
schemas
.
push
(
m
.
description
);
g
.
props
.
documents
[
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
)
{
for
(
z
=
0
;
z
<
m
.
tests
.
length
;
z
+=
1
)
{
t
=
m
.
tests
[
z
];
t
=
m
.
tests
[
z
];
g
.
props
.
documents
[
m
.
description
].
push
(
t
.
description
);
g
.
props
.
documents
[
m
.
description
].
push
(
t
.
description
);
g
.
props
.
test_data
[
m
.
description
+
'
:
'
+
t
.
description
]
=
{
g
.
props
.
test_data
[
m
.
description
+
'
:
'
+
t
.
description
]
=
{
schema
:
m
.
schema
,
schema
:
schema
,
schema_url
:
url_list
[
i
]
+
'
#/
'
+
k
+
'
/schema
'
,
schema_url
:
url_list
[
i
]
+
'
#/
'
+
k
+
'
/schema
'
,
data
:
t
.
data
,
data
:
t
.
data
,
status
:
t
.
valid
status
:
t
.
valid
...
@@ -128,7 +131,7 @@
...
@@ -128,7 +131,7 @@
console
.
log
(
test
.
schema
);
console
.
log
(
test
.
schema
);
console
.
log
(
test
.
data
);
console
.
log
(
test
.
data
);
return
gadget
.
changeState
({
return
gadget
.
changeState
({
schema
_url
:
test
.
schema_url
,
schema
:
test
.
schema
,
json_document
:
test
.
data
json_document
:
test
.
data
});
});
}
}
...
@@ -154,6 +157,7 @@
...
@@ -154,6 +157,7 @@
.
push
(
function
(
form_view
)
{
.
push
(
function
(
form_view
)
{
return
form_view
.
render
({
return
form_view
.
render
({
value
:
g
.
state
.
json_document
,
value
:
g
.
state
.
json_document
,
schema
:
g
.
state
.
schema
,
schema_url
:
g
.
state
.
schema_url
schema_url
:
g
.
state
.
schema_url
})
})
.
push
(
function
()
{
.
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