Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-webui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-webui
Commits
9c48fb07
Commit
9c48fb07
authored
8 months ago
by
Florian Spreckelsen
Browse files
Options
Downloads
Patches
Plain Diff
TST: Add unit test for
https://gitlab.com/linkahead/linkahead-webui/-/issues/258
parent
29032a59
No related branches found
No related tags found
2 merge requests
!139
FIX: Set horizontal scroll of property names to auto
,
!138
FIX: auto_focus on forms without forms
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/core/js/modules/form_panel.js.js
+40
-7
40 additions, 7 deletions
test/core/js/modules/form_panel.js.js
with
40 additions
and
7 deletions
test/core/js/modules/form_panel.js.js
+
40
−
7
View file @
9c48fb07
...
...
@@ -23,25 +23,24 @@
'
use strict
'
;
QUnit
.
module
(
"
form_panel.js
"
,
{
before
:
function
(
assert
)
{
before
:
function
(
assert
)
{
},
after
:
function
(
assert
)
{
}
after
:
function
(
assert
)
{}
});
QUnit
.
test
(
"
availability
"
,
function
(
assert
)
{
QUnit
.
test
(
"
availability
"
,
function
(
assert
)
{
assert
.
ok
(
form_panel
.
init
,
"
init available
"
);
assert
.
ok
(
form_panel
.
create_show_form_callback
,
"
version available
"
);
assert
.
ok
(
form_panel
.
create_show_form_callback
,
"
version available
"
);
});
QUnit
.
test
(
"
create_show_form_callback
"
,
function
(
assert
)
{
QUnit
.
test
(
"
create_show_form_callback
"
,
function
(
assert
)
{
const
title
=
"
Upload CSV File
"
;
// title of the form and text in the toolbox
const
panel_id
=
"
csv_upload_form_panel
"
;
const
server_side_script
=
"
csv_script.py
"
;
const
tool_box
=
"
Tools
"
;
// Name of the drop-down menu where the button is added in the navbar
const
help_text
=
"
something
"
;
const
accepted_files_formats
=
[
"
.csv
"
,
"
text/tsv
"
,
]
// Mime types and file endings.
const
accepted_files_formats
=
[
"
.csv
"
,
"
text/tsv
"
,
]
// Mime types and file endings.
const
csv_form_config
=
{
script
:
server_side_script
,
...
...
@@ -80,3 +79,37 @@ QUnit.test("create_show_form_callback ", function (assert) {
});
QUnit
.
test
(
"
autofocus_without_form
"
,
function
(
assert
)
{
const
title
=
"
My not-form title
"
;
const
id
=
"
not_form_id
"
;
// callback function that creates a "form" without HTML form
// elements. Trivial here, but could be e.g., the file upload
// from LinkAhead WebUI Core Components.
const
init_not_form_field
=
()
=>
{
const
container
=
$
(
`<div class="row"/>`
);
return
container
[
0
];
};
// This should always work
cb_without_autofocus
=
form_panel
.
create_show_form_callback
(
id
,
title
,
undefined
,
init_not_form_field
,
false
);
const
nav
=
document
.
createElement
(
"
nav
"
);
document
.
body
.
appendChild
(
nav
);
cb_without_autofocus
();
assert
.
ok
(
document
.
querySelector
(
`#
${
id
}
`
),
"
Callback was called without autofocus.
"
);
$
(
`#
${
id
}
`
).
remove
();
cb_with_autofocus
=
form_panel
.
create_show_form_callback
(
id
,
title
,
undefined
,
init_not_form_field
,
true
);
cb_with_autofocus
();
assert
.
ok
(
document
.
querySelector
(
`#
${
id
}
`
),
"
Callback was called with autofocus, bt still okay.
"
);
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment