Skip to content
Snippets Groups Projects
Commit 9c48fb07 authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files
parent 29032a59
No related branches found
No related tags found
2 merge requests!139FIX: Set horizontal scroll of property names to auto,!138FIX: auto_focus on forms without forms
...@@ -26,8 +26,7 @@ QUnit.module("form_panel.js", { ...@@ -26,8 +26,7 @@ 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) {
...@@ -80,3 +79,37 @@ QUnit.test("create_show_form_callback ", function (assert) { ...@@ -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.");
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment