Skip to content

Commit

Permalink
Re-enable form qunit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Nov 27, 2017
1 parent 58b9767 commit 2983a04
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
19 changes: 8 additions & 11 deletions client/galaxy/scripts/qunit/tests/form_tests.js
Expand Up @@ -2,14 +2,14 @@
define(
[
"qunit/test-app",
"sinon",
"jquery",
"mvc/form/form-input",
"mvc/ui/ui-misc",
"mvc/form/form-data",
"mvc/tool/tool-form",
"utils/utils"
],
function(testApp, sinon, InputElement, Ui, FormData, ToolForm, Utils) {
function(testApp, $, InputElement, Ui, FormData, ToolForm, Utils) {
"use strict";
InputElement = InputElement.default;
Ui = Ui.default;
Expand All @@ -19,15 +19,19 @@ define(
QUnit.module("Form test", {
beforeEach: function() {
testApp.create();
this.clock = sinon.useFakeTimers();
$.fx.off = true;
},
afterEach: function() {
testApp.destroy();
this.clock.restore();
$.fx.off = false;
}
});

QUnit.test("tool-form", function(assert) {
// Huh? The following seems to be needed by tool-form.js - once the global usage
// is cleaned up in that module this can be deleted I assume.
window.parent.Galaxy = window.Galaxy;

var toolform = new ToolForm.View({ id: "test" });
var form = toolform.form;
$("body").prepend(toolform.$el);
Expand All @@ -36,7 +40,6 @@ define(
for (var property in assert) {
output += property + ": ; ";
}
assert.ok(true, "MooCow");
assert.ok(
form.$(".portlet-title-text").html() == "<b>_name</b> _description (Galaxy Version _version)",
"Title correct"
Expand All @@ -62,14 +65,12 @@ define(
JSON.stringify(mapped_ids) == '["a","b|c","b|i","b|j","k_0|l","k_0|m|n","k_0|m|s","k_0|m|t"]',
"Remapped tour ids correct"
);
this.clock.tick(window.WAIT_FADE);
var dropdown = form.$("#menu > .dropdown-menu");
assert.ok(dropdown.children().length == 2, "Found two menu items");
dropdown
.find(".fa-info-circle")
.parent()
.click();
this.clock.tick(window.WAIT_FADE);
assert.ok(
form.$(".ui-message").html() ===
'<span>This tool requires req_name_a (Version req_version_a) and req_name_b (Version req_version_b). Click <a target="_blank" href="https://galaxyproject.org/tools/requirements/">here</a> for more information.</span>',
Expand All @@ -79,7 +80,6 @@ define(
var $add = form.$(".form-repeat-add");
assert.ok(!$add.attr("disabled"), "Adding new repeat possible");
$add.click();
this.clock.tick(window.WAIT_FADE);
assert.ok($add.attr("disabled"), "Adding new repeat has been disabled");
form.$(".form-repeat-delete").each(function(i, d) {
assert.ok($(d).css("display") == "block", "Delete buttons " + i + " enabled");
Expand All @@ -91,7 +91,6 @@ define(
);
form.$(".form-repeat-delete:first").click();
assert.ok(form.$(".form-repeat-delete").css("display") == "none", "Delete button disabled");
this.clock.tick(window.WAIT_FADE);
assert.ok(
JSON.stringify(form.data.create()) ==
'{"a":"","b|c":"h","b|i":"i","b|j":"j","k_0|l":"l","k_0|m|n":"o","k_0|m|p":"p","k_0|m|q":"q"}',
Expand Down Expand Up @@ -148,9 +147,7 @@ define(
input.model.set("disabled", true);
assert.ok(input.$field.css("display") == "none", "Input field hidden");
input.model.set("disabled", false);
this.clock.tick(window.WAIT_FADE);
assert.ok(input.$field.css("display") == "block", "Input field shown, again");
this.clock.tick(window.WAIT_FADE);
input.model.set("color", "red");
assert.ok(
input.$field
Expand Down
6 changes: 4 additions & 2 deletions client/karma.config.js
Expand Up @@ -15,6 +15,8 @@ var single_pack_mode = function(){
};

var TESTS_SEPARATE_PACKS = [
// Something is funky with form_tests.js - needs to come before other tests.
{pattern: 'galaxy/scripts/qunit/tests/form_tests.js', watched: false},
{pattern: 'galaxy/scripts/qunit/tests/list-of-pairs-collection-creator.js', watched: false},
{pattern: 'galaxy/scripts/qunit/tests/galaxy-app-base.js', watched: false},
{pattern: 'galaxy/scripts/qunit/tests/graph.js', watched: false},
Expand All @@ -26,7 +28,8 @@ var TESTS_SEPARATE_PACKS = [
{pattern: 'galaxy/scripts/qunit/tests/utils_test.js', watched: false},
{pattern: 'galaxy/scripts/qunit/tests/page_tests.js', watched: false},
{pattern: 'galaxy/scripts/qunit/tests/workflow_editor_tests.js', watched: false},
{pattern: 'galaxy/scripts/qunit/tests/modal_tests.js', watched: false},
{pattern: 'galaxy/scripts/qunit/tests/modal_tests.js', watched: false}

// The following tests don't work for state reasons:

// Error: Following test works on its own or with rest but not with
Expand All @@ -37,7 +40,6 @@ var TESTS_SEPARATE_PACKS = [
// 'galaxy/scripts/qunit/tests/modal_tests.js',
// 'galaxy/scripts/qunit/tests/upload_dialog_tests.js',
// Error: Cannot find module "libs/bibtexParse"
// 'galaxy/scripts/qunit/tests/form_tests.js',
// 'galaxy/scripts/qunit/tests/masthead_tests.js',
];

Expand Down

0 comments on commit 2983a04

Please sign in to comment.