diff --git a/test/qunit/test-app.js b/test/qunit/test-app.js index fd3638b4f77..82065d8d723 100644 --- a/test/qunit/test-app.js +++ b/test/qunit/test-app.js @@ -16,13 +16,14 @@ define([ serverdata, appBase ){ + appBase = appBase.default; return { create: function() { - window.Galaxy = new appBase.default.GalaxyApp( bootstrapped ); + window.Galaxy = new appBase.GalaxyApp( bootstrapped ); window.Galaxy.currHistoryPanel = { model: new Backbone.Model() }; window.Galaxy.emit = { debug : function(){}, - error : function( v ){ window.console.error( v ) } + error : function( v ){ window.console.error( v ); } }; window.WAIT_FADE = 300; window.fakeserver = sinon.fakeServer.create(); diff --git a/test/qunit/tests/form_tests.js b/test/qunit/tests/form_tests.js index 86a96aa9085..93cbb603ebe 100644 --- a/test/qunit/tests/form_tests.js +++ b/test/qunit/tests/form_tests.js @@ -2,6 +2,11 @@ define([ 'test-app', 'QUnit', 'sinon', 'mvc/form/form-input', 'mvc/ui/ui-misc', 'mvc/form/form-data', 'mvc/tool/tool-form', 'utils/utils', ], function( testApp, QUnit, sinon, InputElement, Ui, FormData, ToolForm, Utils ){ 'use strict'; + InputElement = InputElement.default; + Ui = Ui.default; + FormData = FormData.default; + ToolForm = ToolForm.default; + Utils = Utils.default; QUnit.module( 'Form test', { beforeEach: function() { testApp.create(); @@ -14,7 +19,7 @@ define([ 'test-app', 'QUnit', 'sinon', 'mvc/form/form-input', 'mvc/ui/ui-misc', } ); QUnit.test( 'tool-form', function(assert) { - var toolform = new ToolForm.default.View( { id: 'test' } ); + var toolform = new ToolForm.View( { id: 'test' } ); var form = toolform.form; $( 'body' ).prepend( toolform.$el ); window.fakeserver.respond(); @@ -53,8 +58,8 @@ define([ 'test-app', 'QUnit', 'sinon', 'mvc/form/form-input', 'mvc/ui/ui-misc', QUnit.test( 'data', function(assert) { var visits = []; - Utils.default.get( { url: Galaxy.root + 'api/tools/test/build', success: function( response ) { - FormData.default.visitInputs( response.inputs, function( node, name, context ) { + Utils.get( { url: Galaxy.root + 'api/tools/test/build', success: function( response ) { + FormData.visitInputs( response.inputs, function( node, name, context ) { visits.push( { name: name, node: node } ); } ); } } ); @@ -63,8 +68,8 @@ define([ 'test-app', 'QUnit', 'sinon', 'mvc/form/form-input', 'mvc/ui/ui-misc', }); QUnit.test( 'input', function(assert) { - var input = new InputElement.default( {}, { - field: new Ui.default.Input({}) + var input = new InputElement( {}, { + field: new Ui.Input({}) }); $( 'body' ).prepend( input.$el ); assert.ok( input.$field.css( 'display' ) == 'block', 'Input field shown' ); diff --git a/test/qunit/tests/galaxy-app-base.js b/test/qunit/tests/galaxy-app-base.js index 15b558e14f0..2e556243e26 100644 --- a/test/qunit/tests/galaxy-app-base.js +++ b/test/qunit/tests/galaxy-app-base.js @@ -9,7 +9,7 @@ define([ QUnit ){ "use strict"; - + appBase = appBase.default; QUnit.module( "Galaxy client app tests" ); var options = { @@ -43,7 +43,7 @@ define([ }; QUnit.test( "App base construction/initializiation defaults", function(assert) { - var app = new appBase.default.GalaxyApp({}); + var app = new appBase.GalaxyApp({}); assert.ok( app.hasOwnProperty( 'options' ) && typeof app.options === 'object' ); assert.ok( app.hasOwnProperty( 'logger' ) && typeof app.logger === 'object' ); assert.ok( app.hasOwnProperty( 'localize' ) && typeof app.localize === 'function' ); @@ -53,21 +53,21 @@ define([ }); QUnit.test( "App base default options", function(assert) { - var app = new appBase.default.GalaxyApp({}); + var app = new appBase.GalaxyApp({}); assert.ok( app.hasOwnProperty( 'options' ) && typeof app.options === 'object' ); assert.equal( app.options.root, '/' ); assert.equal( app.options.patchExisting, true ); }); QUnit.test( "App base extends from Backbone.Events", function(assert) { - var app = new appBase.default.GalaxyApp({}); + var app = new appBase.GalaxyApp({}); [ 'on', 'off', 'trigger', 'listenTo', 'stopListening' ].forEach( function( fn ){ assert.ok( app.hasOwnProperty( fn ) && typeof app[ fn ] === 'function' ); }); }); QUnit.test( "App base has logging methods from utils/add-logging.js", function(assert) { - var app = new appBase.default.GalaxyApp({}); + var app = new appBase.GalaxyApp({}); [ 'debug', 'info', 'warn', 'error', 'metric' ].forEach( function( fn ){ assert.ok( typeof app[ fn ] === 'function' ); }); @@ -80,17 +80,17 @@ define([ subattr : 1 } }; - var app = new appBase.default.GalaxyApp({}); + var app = new appBase.GalaxyApp({}); assert.ok( typeof app.attribute === 'object' && app.attribute.subattr === 1 ); }); QUnit.test( "App base logger", function(assert) { - var app = new appBase.default.GalaxyApp({}); + var app = new appBase.GalaxyApp({}); assert.ok( app.hasOwnProperty( 'logger' ) && typeof app.config === 'object' ); }); QUnit.test( "App base config", function(assert) { - var app = new appBase.default.GalaxyApp( options ); + var app = new appBase.GalaxyApp( options ); assert.ok( app.hasOwnProperty( 'config' ) && typeof app.config === 'object' ); assert.equal( app.config.allow_user_deletion, false ); assert.equal( app.config.allow_user_creation, true ); @@ -99,7 +99,7 @@ define([ }); QUnit.test( "App base user", function(assert) { - var app = new appBase.default.GalaxyApp({}); + var app = new appBase.GalaxyApp({}); assert.ok( app.hasOwnProperty( 'user' ) && typeof app.user === 'object' ); assert.ok( app.user.isAdmin() === false ); }); diff --git a/test/qunit/tests/graph.js b/test/qunit/tests/graph.js index f1a7e09d53a..fc431f12390 100644 --- a/test/qunit/tests/graph.js +++ b/test/qunit/tests/graph.js @@ -6,7 +6,7 @@ define([ ], function( GRAPH, $, QUnit ){ "use strict"; - + GRAPH = GRAPH.default; QUnit.module( "utils/graph.js library tests" ); ///* function testEmptyObject( assert, o ){ @@ -16,8 +16,8 @@ define([ // ------------------------------------------------------------------------ vertices QUnit.test( "Empty vertex construction", function(assert) { - var vert = new GRAPH.default.Vertex(); - assert.ok( vert instanceof GRAPH.default.Vertex ); + var vert = new GRAPH.Vertex(); + assert.ok( vert instanceof GRAPH.Vertex ); assert.ok( vert.name === '(unnamed)' ); assert.ok( vert.data === null ); testEmptyObject( assert, vert.edges ); @@ -27,8 +27,8 @@ define([ }); QUnit.test( "Vertex construction", function(assert) { - var vert = new GRAPH.default.Vertex( 'blah', { blorp: 1, bleep: 2 }); - assert.ok( vert instanceof GRAPH.default.Vertex ); + var vert = new GRAPH.Vertex( 'blah', { blorp: 1, bleep: 2 }); + assert.ok( vert instanceof GRAPH.Vertex ); assert.ok( vert.name === 'blah' ); assert.deepEqual( vert.data, { blorp: 1, bleep: 2 }); testEmptyObject( assert, vert.edges ); @@ -39,8 +39,8 @@ define([ // ------------------------------------------------------------------------ edges QUnit.test( "Empty edge construction", function(assert) { - var edge = new GRAPH.default.Edge(); - assert.ok( edge instanceof GRAPH.default.Edge ); + var edge = new GRAPH.Edge(); + assert.ok( edge instanceof GRAPH.Edge ); assert.ok( edge.source === null ); assert.ok( edge.target === null ); assert.ok( edge.data === null ); @@ -49,8 +49,8 @@ define([ }); QUnit.test( "Edge construction", function(assert) { - var edge = new GRAPH.default.Edge( 'A', 'B', { one: 1, two: 2 }); - assert.ok( edge instanceof GRAPH.default.Edge ); + var edge = new GRAPH.Edge( 'A', 'B', { one: 1, two: 2 }); + assert.ok( edge instanceof GRAPH.Edge ); assert.ok( edge.source === 'A' ); assert.ok( edge.target === 'B' ); assert.deepEqual( edge.data, { one: 1, two: 2 } ); @@ -60,13 +60,13 @@ define([ // ------------------------------------------------------------------------ graphs function testEmptyGraph( assert, graph ){ - assert.ok( graph instanceof GRAPH.default.Graph ); + assert.ok( graph instanceof GRAPH.Graph ); testEmptyObject( assert, graph.vertices ); assert.ok( graph.numEdges === 0 ); } QUnit.test( "Empty graph construction", function(assert) { - var graph = new GRAPH.default.Graph(); + var graph = new GRAPH.Graph(); assert.ok( graph.directed === false ); assert.ok( graph.allowReflexiveEdges === false ); @@ -75,15 +75,15 @@ define([ }); QUnit.test( "Bad data graph construction", function(assert) { - var graph = new GRAPH.default.Graph( false, {} ); + var graph = new GRAPH.Graph( false, {} ); testEmptyGraph( assert, graph ); - graph = new GRAPH.default.Graph( false, null ); + graph = new GRAPH.Graph( false, null ); testEmptyGraph( assert, graph ); }); QUnit.test( "Test directed and options", function(assert) { - var graph = new GRAPH.default.Graph( true, {}, { allowReflexiveEdges : true }); + var graph = new GRAPH.Graph( true, {}, { allowReflexiveEdges : true }); assert.ok( graph.directed ); assert.ok( graph.allowReflexiveEdges ); @@ -95,9 +95,9 @@ define([ assert.ok( !graph.directed ); assert.ok( Object.keys( graph.vertices ).length === 3 ); - assert.ok( graph.vertices.A instanceof GRAPH.default.Vertex ); - assert.ok( graph.vertices.B instanceof GRAPH.default.Vertex ); - assert.ok( graph.vertices.C instanceof GRAPH.default.Vertex ); + assert.ok( graph.vertices.A instanceof GRAPH.Vertex ); + assert.ok( graph.vertices.B instanceof GRAPH.Vertex ); + assert.ok( graph.vertices.C instanceof GRAPH.Vertex ); assert.deepEqual( Object.keys( graph.vertices.A.edges ), [ 'B', 'C' ] ); assert.deepEqual( Object.keys( graph.vertices.B.edges ), [ 'A', 'C' ] ); @@ -121,9 +121,9 @@ define([ assert.ok( graph.directed ); assert.ok( Object.keys( graph.vertices ).length === 3 ); - assert.ok( graph.vertices.A instanceof GRAPH.default.Vertex ); - assert.ok( graph.vertices.B instanceof GRAPH.default.Vertex ); - assert.ok( graph.vertices.C instanceof GRAPH.default.Vertex ); + assert.ok( graph.vertices.A instanceof GRAPH.Vertex ); + assert.ok( graph.vertices.B instanceof GRAPH.Vertex ); + assert.ok( graph.vertices.C instanceof GRAPH.Vertex ); assert.deepEqual( Object.keys( graph.vertices.A.edges ), [ 'B', 'C' ] ); assert.deepEqual( Object.keys( graph.vertices.B.edges ), [ 'C' ] ); @@ -154,12 +154,12 @@ define([ }; QUnit.test( "Test nodes and links data input on *non-directed* graph", function(assert) { - var graph = new GRAPH.default.Graph( false, nodeLinkData ); + var graph = new GRAPH.Graph( false, nodeLinkData ); testSampleDirectedGraph( assert, graph ); }); QUnit.test( "Test nodes and links data input on *directed* graph", function(assert) { - var graph = new GRAPH.default.Graph( true, nodeLinkData ); + var graph = new GRAPH.Graph( true, nodeLinkData ); testSampleNonDirectedGraph( assert, graph ); }); @@ -177,24 +177,24 @@ define([ }; QUnit.test( "Test vertex and edge data input on *non-directed* graph", function(assert) { - var graph = new GRAPH.default.Graph( false, vertexEdgeData ); + var graph = new GRAPH.Graph( false, vertexEdgeData ); testSampleDirectedGraph( assert, graph ); }); QUnit.test( "Test vertex and edge data input on *directed* graph", function(assert) { - var graph = new GRAPH.default.Graph( true, vertexEdgeData ); + var graph = new GRAPH.Graph( true, vertexEdgeData ); testSampleNonDirectedGraph( assert, graph ); }); QUnit.test( "Test vertex eachEdge", function(assert) { - var graph = new GRAPH.default.Graph( false, nodeLinkData ); + var graph = new GRAPH.Graph( false, nodeLinkData ); assert.ok( typeof graph.vertices.A.eachEdge === 'function' ); assert.deepEqual( graph.vertices.A.eachEdge( function( e ){ return e.target; }), [ 'B', 'C' ] ); assert.ok( graph.vertices.A.eachEdge({ target: 'B' }).length === 1 ); }); QUnit.test( "Test graph eachVertex", function(assert) { - var graph = new GRAPH.default.Graph( true, nodeLinkData ); + var graph = new GRAPH.Graph( true, nodeLinkData ); assert.ok( typeof graph.eachVertex === 'function' ); assert.deepEqual( graph.eachVertex( function( v ){ return { n: v.name, d: v.degree }; }), [ { n: 'A', d: 2 }, @@ -205,9 +205,9 @@ define([ }); QUnit.test( "Test createVertex", function(assert) { - var graph = new GRAPH.default.Graph(); + var graph = new GRAPH.Graph(); var vert1 = graph.createVertex( 'A', { blah: 1 }); - assert.ok( vert1 instanceof GRAPH.default.Vertex ); + assert.ok( vert1 instanceof GRAPH.Vertex ); assert.ok( vert1 === graph.vertices.A ); assert.ok( graph.createVertex( 'A', { blah: 1 } ) === vert1 ); }); @@ -215,11 +215,11 @@ define([ QUnit.test( "Test createEdge", function(assert) { var graph, A, B, edge; - graph = new GRAPH.default.Graph(); + graph = new GRAPH.Graph(); A = graph.createVertex( 'A' ); B = graph.createVertex( 'B' ); edge = graph.createEdge( 'A', 'B' ); - assert.ok( edge instanceof GRAPH.default.Edge ); + assert.ok( edge instanceof GRAPH.Edge ); assert.ok( A.degree === 1 ); assert.ok( B.degree === 1 ); assert.ok( A.edges.B ); @@ -227,7 +227,7 @@ define([ assert.ok( graph.numEdges === 2 ); // bad target - graph = new GRAPH.default.Graph(); + graph = new GRAPH.Graph(); A = graph.createVertex( 'A' ); B = graph.createVertex( 'B' ); edge = graph.createEdge( 'A', 'C' ); @@ -239,21 +239,21 @@ define([ assert.ok( graph.numEdges === 0 ); // bad source - graph = new GRAPH.default.Graph(); + graph = new GRAPH.Graph(); A = graph.createVertex( 'A' ); B = graph.createVertex( 'B' ); edge = graph.createEdge( 'C', 'A' ); assert.ok( graph.numEdges === 0 ); // reflexive - graph = new GRAPH.default.Graph(); + graph = new GRAPH.Graph(); A = graph.createVertex( 'A' ); B = graph.createVertex( 'B' ); edge = graph.createEdge( 'A', 'A' ); assert.ok( graph.numEdges === 0 ); // reflexive (allowed) - graph = new GRAPH.default.Graph( false, {}, { allowReflexiveEdges: true }); + graph = new GRAPH.Graph( false, {}, { allowReflexiveEdges: true }); A = graph.createVertex( 'A' ); edge = graph.createEdge( 'A', 'A' ); // reflexive edges shouldn't mirror @@ -262,34 +262,34 @@ define([ }); QUnit.test( "Test graph.edges", function(assert) { - var graph = new GRAPH.default.Graph( false, nodeLinkData ); + var graph = new GRAPH.Graph( false, nodeLinkData ); assert.ok( graph.edges().length === 6 ); assert.deepEqual( graph.edges( function( e ){ return e.source; }), [ 'A', 'A', 'B', 'B', 'C', 'C' ] ); assert.deepEqual( graph.edges({ source: 'A' }), [ graph.vertices.A.edges.B, graph.vertices.A.edges.C ] ); - graph = new GRAPH.default.Graph( true, nodeLinkData ); + graph = new GRAPH.Graph( true, nodeLinkData ); assert.ok( graph.edges().length === 3 ); assert.deepEqual( graph.edges( function( e ){ return e.source; }), [ 'A', 'A', 'B' ] ); assert.deepEqual( graph.edges({ source: 'A' }), [ graph.vertices.A.edges.B, graph.vertices.A.edges.C ] ); }); QUnit.test( "Test graph.adjacent", function(assert) { - var graph = new GRAPH.default.Graph( true, nodeLinkData ); + var graph = new GRAPH.Graph( true, nodeLinkData ); assert.deepEqual( graph.adjacent( graph.vertices.A ), [ graph.vertices.B, graph.vertices.C ] ); assert.deepEqual( graph.adjacent( graph.vertices.B ), [ graph.vertices.C ] ); assert.deepEqual( graph.adjacent( graph.vertices.C ), [] ); }); QUnit.test( "Test graph.eachAdjacent", function(assert) { - var graph = new GRAPH.default.Graph( true, nodeLinkData ); + var graph = new GRAPH.Graph( true, nodeLinkData ); assert.deepEqual( graph.eachAdjacent( graph.vertices.A, function( v, e ){ return v; }), [ graph.vertices.B, graph.vertices.C ] ); }); // ------------------------------------------------------------------------ breadth first search QUnit.test( "Empty BreadthFirstSearch", function(assert) { - var search = new GRAPH.default.BreadthFirstSearch(); - assert.ok( search instanceof GRAPH.default.BreadthFirstSearch ); + var search = new GRAPH.BreadthFirstSearch(); + assert.ok( search instanceof GRAPH.BreadthFirstSearch ); assert.ok( search.graph === undefined ); assert.ok( typeof search.processFns === 'object' ); assert.ok( typeof search.processFns.vertexEarly === 'function' ); @@ -299,9 +299,9 @@ define([ }); QUnit.test( "BreadthFirstSearch on undirected graph", function(assert) { - var graph = new GRAPH.default.Graph( false, nodeLinkData ), - bfs = new GRAPH.default.BreadthFirstSearch( graph ); - assert.ok( bfs instanceof GRAPH.default.BreadthFirstSearch ); + var graph = new GRAPH.Graph( false, nodeLinkData ), + bfs = new GRAPH.BreadthFirstSearch( graph ); + assert.ok( bfs instanceof GRAPH.BreadthFirstSearch ); assert.ok( bfs.graph === graph ); var search = bfs.search( 'A' ), @@ -313,7 +313,7 @@ define([ { source : 'A', target: 'C' } ] }); - assert.ok( tree instanceof GRAPH.default.Graph ); + assert.ok( tree instanceof GRAPH.Graph ); assert.deepEqual( tree.vertices.A.toJSON(), graph.vertices.A.toJSON() ); assert.deepEqual( tree.eachVertex( function( v ){ return v.degree; }), [ 2, 0, 0 ] ); @@ -330,9 +330,9 @@ define([ }); QUnit.test( "BreadthFirstSearch on directed graph", function(assert) { - var graph = new GRAPH.default.Graph( true, nodeLinkData ), - bfs = new GRAPH.default.BreadthFirstSearch( graph ); - assert.ok( bfs instanceof GRAPH.default.BreadthFirstSearch ); + var graph = new GRAPH.Graph( true, nodeLinkData ), + bfs = new GRAPH.BreadthFirstSearch( graph ); + assert.ok( bfs instanceof GRAPH.BreadthFirstSearch ); assert.ok( bfs.graph === graph ); var search = bfs.search( 'A' ), @@ -344,7 +344,7 @@ define([ { source : 'A', target: 'C' } ] }); - assert.ok( tree instanceof GRAPH.default.Graph ); + assert.ok( tree instanceof GRAPH.Graph ); assert.deepEqual( tree.vertices.A.toJSON(), graph.vertices.A.toJSON() ); assert.deepEqual( tree.eachVertex( function( v ){ return v.degree; }), [ 2, 0, 0 ] ); @@ -380,8 +380,8 @@ define([ }; QUnit.test( "Empty DepthFirstSearch", function(assert) { - var search = new GRAPH.default.DepthFirstSearch(); - assert.ok( search instanceof GRAPH.default.DepthFirstSearch ); + var search = new GRAPH.DepthFirstSearch(); + assert.ok( search instanceof GRAPH.DepthFirstSearch ); assert.ok( search.graph === undefined ); assert.ok( typeof search.processFns === 'object' ); assert.ok( typeof search.processFns.vertexEarly === 'function' ); @@ -391,9 +391,9 @@ define([ }); QUnit.test( "DepthFirstSearch on undirected graph", function(assert) { - var graph = new GRAPH.default.Graph( false, DFSData ), - dfs = new GRAPH.default.DepthFirstSearch( graph ); - assert.ok( dfs instanceof GRAPH.default.DepthFirstSearch ); + var graph = new GRAPH.Graph( false, DFSData ), + dfs = new GRAPH.DepthFirstSearch( graph ); + assert.ok( dfs instanceof GRAPH.DepthFirstSearch ); assert.ok( dfs.graph === graph ); var search = dfs.search( 'A' ), @@ -410,7 +410,7 @@ define([ entryTimes : { A: 0, B: 1, C: 2, D: 3, E: 7, F: 8 }, exitTimes : { A: 11, B: 6, C: 5, D: 4, E: 10, F: 9 } }); - assert.ok( tree instanceof GRAPH.default.Graph ); + assert.ok( tree instanceof GRAPH.Graph ); assert.deepEqual( tree.vertices.A.toJSON(), graph.vertices.A.toJSON() ); assert.deepEqual( tree.eachVertex( function( v ){ return v.degree; }), [ 2, 1, 1, 0, 1, 0 ] ); @@ -427,9 +427,9 @@ define([ }); QUnit.test( "DepthFirstSearch on directed graph", function(assert) { - var graph = new GRAPH.default.Graph( true, DFSData ), - dfs = new GRAPH.default.DepthFirstSearch( graph ); - assert.ok( dfs instanceof GRAPH.default.DepthFirstSearch ); + var graph = new GRAPH.Graph( true, DFSData ), + dfs = new GRAPH.DepthFirstSearch( graph ); + assert.ok( dfs instanceof GRAPH.DepthFirstSearch ); assert.ok( dfs.graph === graph ); var search = dfs.search( 'A' ), @@ -446,7 +446,7 @@ define([ entryTimes : { A: 0, B: 1, C: 2, D: 3, E: 7, F: 8 }, exitTimes : { A: 11, B: 6, C: 5, D: 4, E: 10, F: 9 } }); - assert.ok( tree instanceof GRAPH.default.Graph ); + assert.ok( tree instanceof GRAPH.Graph ); assert.deepEqual( tree.vertices.A.toJSON(), graph.vertices.A.toJSON() ); assert.deepEqual( tree.eachVertex( function( v ){ return v.degree; }), [ 2, 1, 1, 0, 1, 0 ] ); @@ -462,7 +462,7 @@ define([ // ------------------------------------------------------------------------ components //*/ QUnit.test( "weakComponents on undirected graph", function(assert) { - var graph = new GRAPH.default.Graph( false, { + var graph = new GRAPH.Graph( false, { vertices : [ { name : 'A' }, { name : 'B' }, @@ -482,7 +482,7 @@ define([ QUnit.test( "weakComponents on directed graph", function(assert) { var graph, components; - graph = new GRAPH.default.Graph( true, { + graph = new GRAPH.Graph( true, { vertices : [ { name : 'A' }, { name : 'B' }, @@ -500,7 +500,7 @@ define([ components = graph.weakComponents(); assert.equal( components.length, 3 ); - graph = new GRAPH.default.Graph( true, { + graph = new GRAPH.Graph( true, { vertices : [ { name : 'A', data: 100 }, { name : 'B', data: 200 }, diff --git a/test/qunit/tests/hda-base.js b/test/qunit/tests/hda-base.js index 8af8d47ba0e..fe26e6dd513 100644 --- a/test/qunit/tests/hda-base.js +++ b/test/qunit/tests/hda-base.js @@ -13,13 +13,15 @@ define([ QUnit ){ "use strict"; + HDA_MODEL = HDA_MODEL.default; + HDA_BASE = HDA_BASE.default; QUnit.module( "HDA base backbone view tests" ); QUnit.test( "Base HDA view default construction, initialize", function(assert) { - var hda = new HDA_MODEL.default.HistoryDatasetAssociation({ + var hda = new HDA_MODEL.HistoryDatasetAssociation({ id : '123' }), - view = new HDA_BASE.default.HDAListItemView({ model: hda }); + view = new HDA_BASE.HDAListItemView({ model: hda }); assert.strictEqual( view.model, hda ); diff --git a/test/qunit/tests/history_contents_model_tests.js b/test/qunit/tests/history_contents_model_tests.js index ffa9646b838..5782e5c495a 100644 --- a/test/qunit/tests/history_contents_model_tests.js +++ b/test/qunit/tests/history_contents_model_tests.js @@ -10,16 +10,17 @@ define([ sinon, QUnit ){ + HDA_MODEL = HDA_MODEL.default; QUnit.module( "History Contents Model QUnit.Tests" ); QUnit.test( "HDA Constructions with Default Attributes", function(assert) { - var hda = new HDA_MODEL.default.HistoryDatasetAssociation({}); + var hda = new HDA_MODEL.HistoryDatasetAssociation({}); assert.equal( hda.get( 'name' ), "(unnamed dataset)" ); assert.equal( hda.get( 'state' ), "new" ); }); QUnit.test( "HDA Construction with Supplied Attributes", function(assert) { - var hda = new HDA_MODEL.default.HistoryDatasetAssociation({ + var hda = new HDA_MODEL.HistoryDatasetAssociation({ history_content_type : 'dataset', name: "my dataset", state: "ok" @@ -29,7 +30,7 @@ define([ }); QUnit.test( "HDA Deletion", function(assert) { - var hda = new HDA_MODEL.default.HistoryDatasetAssociation({ + var hda = new HDA_MODEL.HistoryDatasetAssociation({ history_content_type : 'dataset', id: "hda1", history_id: "h1", diff --git a/test/qunit/tests/job-dag.js b/test/qunit/tests/job-dag.js index 69d1d49e4a3..ccb403e4efb 100644 --- a/test/qunit/tests/job-dag.js +++ b/test/qunit/tests/job-dag.js @@ -6,13 +6,13 @@ define([ 'test-data/job-dag-1' ], function( JobDAG, $, QUnit, testData ){ "use strict"; - + JobDAG = JobDAG.default; QUnit.module( "mvc/history/job-dag.js tests" ); // ------------------------------------------------------------------------ QUnit.test( "Empty JobDAG construction", function(assert) { - var dag = new JobDAG.default(); - assert.ok( dag instanceof JobDAG.default ); + var dag = new JobDAG(); + assert.ok( dag instanceof JobDAG ); // default options assert.deepEqual( dag.filters, [] ); @@ -36,7 +36,7 @@ define([ QUnit.test( "Empty JobDAG construction - changing options", function(assert) { var dag; - dag = new JobDAG.default({ + dag = new JobDAG({ excludeSetMetadata : true }); @@ -49,7 +49,7 @@ define([ // filters function testFilter( job, index, jobData ){ return true; } - dag = new JobDAG.default({ + dag = new JobDAG({ filters : [ testFilter ] }); assert.equal( dag.filters[0], testFilter ); @@ -62,7 +62,7 @@ define([ var history = testData.historyContents1, jobs = testData.jobs1, dag; - dag = new JobDAG.default({ + dag = new JobDAG({ historyContents : history, tools : testData.tools, jobs : jobs @@ -146,7 +146,7 @@ define([ var history = testData.historyContents2, jobs = testData.jobs2, dag; - dag = new JobDAG.default({ + dag = new JobDAG({ historyContents : history, tools : testData.tools, jobs : jobs, @@ -173,7 +173,7 @@ define([ var history = testData.historyContents3, jobs = testData.jobs3, dag; - dag = new JobDAG.default({ + dag = new JobDAG({ historyContents : history, tools : testData.tools, jobs : jobs @@ -232,7 +232,7 @@ define([ var history = testData.historyContents4, jobs = testData.jobs4, dag; - dag = new JobDAG.default({ + dag = new JobDAG({ historyContents : history, tools : testData.tools, jobs : jobs diff --git a/test/qunit/tests/list-of-pairs-collection-creator.js b/test/qunit/tests/list-of-pairs-collection-creator.js index 4e91299ccfb..4c267d4150d 100644 --- a/test/qunit/tests/list-of-pairs-collection-creator.js +++ b/test/qunit/tests/list-of-pairs-collection-creator.js @@ -13,7 +13,8 @@ define([ QUnit ){ "use strict"; - var PCC = PAIRED_COLLECTION_CREATOR.default.PairedCollectionCreator; + PAIRED_COLLECTION_CREATOR = PAIRED_COLLECTION_CREATOR.default; + var PCC = PAIRED_COLLECTION_CREATOR.PairedCollectionCreator; QUnit.module( "Galaxy client app tests" ); diff --git a/test/qunit/tests/masthead_tests.js b/test/qunit/tests/masthead_tests.js index 989f05ecb39..107f703a32a 100644 --- a/test/qunit/tests/masthead_tests.js +++ b/test/qunit/tests/masthead_tests.js @@ -2,11 +2,12 @@ define([ "test-app", "layout/masthead", "QUnit" ], function( testApp, Masthead, QUnit ){ "use strict"; + Masthead = Masthead.default; QUnit.module( "Masthead test", { beforeEach: function() { testApp.create(); var self = this; - this.masthead = new Masthead.default.View({ + this.masthead = new Masthead.View({ 'brand' : 'brand', 'use_remote_user' : 'use_remote_user', 'remote_user_logout_href' : 'remote_user_logout_href', diff --git a/test/qunit/tests/metrics-logger.js b/test/qunit/tests/metrics-logger.js index 85cea4f2030..aaedff0dc25 100644 --- a/test/qunit/tests/metrics-logger.js +++ b/test/qunit/tests/metrics-logger.js @@ -13,6 +13,7 @@ define([ QUnit ){ "use strict"; + metrics = metrics.default; var MockConsole = function(){ var self = this; @@ -33,10 +34,10 @@ define([ QUnit.module( "Metrics logger tests" ); // ======================================================================== MetricsLogger QUnit.test( "logger construction/initializiation defaults", function(assert) { - var logger = new metrics.default.MetricsLogger({}); + var logger = new metrics.MetricsLogger({}); assert.equal( logger.consoleLogger, null ); - assert.equal( logger.options.logLevel, metrics.default.MetricsLogger.NONE ); - assert.equal( logger.options.consoleLevel, metrics.default.MetricsLogger.NONE ); + assert.equal( logger.options.logLevel, metrics.MetricsLogger.NONE ); + assert.equal( logger.options.consoleLevel, metrics.MetricsLogger.NONE ); assert.equal( logger.options.defaultNamespace, 'Galaxy' ); assert.equal( logger.options.clientPrefix, 'client.' ); assert.equal( logger.options.postSize, 1000 ); @@ -47,18 +48,18 @@ define([ assert.equal( logger.options.onServerResponse, undefined ); assert.equal( logger._postSize, 1000 ); - assert.equal( logger.cache.constructor, metrics.default.LoggingCache ); + assert.equal( logger.cache.constructor, metrics.LoggingCache ); }); QUnit.test( "_parseLevel", function(assert) { - var logger = new metrics.default.MetricsLogger({}); - assert.equal( logger._parseLevel( 'all' ), metrics.default.MetricsLogger.ALL ); - assert.equal( logger._parseLevel( 'debug' ), metrics.default.MetricsLogger.DEBUG ); - assert.equal( logger._parseLevel( 'info' ), metrics.default.MetricsLogger.INFO ); - assert.equal( logger._parseLevel( 'warn' ), metrics.default.MetricsLogger.WARN ); - assert.equal( logger._parseLevel( 'error' ), metrics.default.MetricsLogger.ERROR ); - assert.equal( logger._parseLevel( 'metric' ), metrics.default.MetricsLogger.METRIC ); - assert.equal( logger._parseLevel( 'none' ), metrics.default.MetricsLogger.NONE ); + var logger = new metrics.MetricsLogger({}); + assert.equal( logger._parseLevel( 'all' ), metrics.MetricsLogger.ALL ); + assert.equal( logger._parseLevel( 'debug' ), metrics.MetricsLogger.DEBUG ); + assert.equal( logger._parseLevel( 'info' ), metrics.MetricsLogger.INFO ); + assert.equal( logger._parseLevel( 'warn' ), metrics.MetricsLogger.WARN ); + assert.equal( logger._parseLevel( 'error' ), metrics.MetricsLogger.ERROR ); + assert.equal( logger._parseLevel( 'metric' ), metrics.MetricsLogger.METRIC ); + assert.equal( logger._parseLevel( 'none' ), metrics.MetricsLogger.NONE ); assert.equal( logger._parseLevel( 15 ), 15 ); assert.throws( function(){ @@ -71,18 +72,18 @@ define([ // ------------------------------------------------------------------------ Emit to cache QUnit.test( "emit to cache at level", function(assert) { - var logger = new metrics.default.MetricsLogger({ + var logger = new metrics.MetricsLogger({ logLevel : 'metric' }); logger.cache.empty(); - assert.equal( logger.options.logLevel, metrics.default.MetricsLogger.METRIC ); + assert.equal( logger.options.logLevel, metrics.MetricsLogger.METRIC ); logger.emit( 'metric', 'test', [ 1, 2, { three: 3 }] ); assert.equal( logger.cache.length(), 1 ); var cached = logger.cache.get( 1 )[0]; //console.debug( 'cached:', JSON.stringify( cached ) ); - assert.equal( cached.level, metrics.default.MetricsLogger.METRIC ); + assert.equal( cached.level, metrics.MetricsLogger.METRIC ); assert.equal( cached.namespace, 'client.test' ); assert.equal( cached.args.length, 3 ); assert.equal( cached.args[2].three, 3 ); @@ -91,7 +92,7 @@ define([ }); QUnit.test( "emit to cache below does not cache", function(assert) { - var logger = new metrics.default.MetricsLogger({ + var logger = new metrics.MetricsLogger({ logLevel : 'metric' }); logger.cache.empty(); @@ -101,7 +102,7 @@ define([ }); QUnit.test( "emit to cache (silently) drops non-parsable", function(assert) { - var logger = new metrics.default.MetricsLogger({ + var logger = new metrics.MetricsLogger({ logLevel : 'metric' }); logger.cache.empty(); @@ -117,7 +118,7 @@ define([ QUnit.test( "_postCache success", function (assert) { var callback = sinon.spy(), - logger = new metrics.default.MetricsLogger({ + logger = new metrics.MetricsLogger({ logLevel : 'metric', onServerResponse : function( response ){ callback(); } }); @@ -149,7 +150,7 @@ define([ // metrics were in proper form on server assert.equal( metricsOnServer.length, 1 ); var metric = metricsOnServer[0]; - assert.equal( metric.level, metrics.default.MetricsLogger.METRIC ); + assert.equal( metric.level, metrics.MetricsLogger.METRIC ); assert.equal( metric.namespace, 'client.test' ); assert.equal( metric.args.length, 3 ); assert.equal( metric.args[2].three, 3 ); @@ -161,7 +162,7 @@ define([ QUnit.test( "_postCache failure", function (assert) { var callback = sinon.spy(), - logger = new metrics.default.MetricsLogger({ + logger = new metrics.MetricsLogger({ logLevel : 'metric', onServerResponse : function( response ){ callback(); } }); @@ -192,11 +193,11 @@ define([ // ------------------------------------------------------------------------ Emit to console QUnit.test( "emit to console at level", function(assert) { var mockConsole = new MockConsole(), - logger = new metrics.default.MetricsLogger({ + logger = new metrics.MetricsLogger({ consoleLevel : 'debug', consoleLogger : mockConsole }); - assert.equal( logger.options.consoleLevel, metrics.default.MetricsLogger.DEBUG ); + assert.equal( logger.options.consoleLevel, metrics.MetricsLogger.DEBUG ); assert.equal( logger.consoleLogger.constructor, MockConsole ); logger.emit( 'debug', 'test', [ 1, 2, { three: 3 }] ); @@ -210,7 +211,7 @@ define([ QUnit.test( "emit to console below does not output", function(assert) { var mockConsole = new MockConsole(), - logger = new metrics.default.MetricsLogger({ + logger = new metrics.MetricsLogger({ consoleLevel : 'error', consoleLogger : mockConsole }); @@ -220,12 +221,12 @@ define([ // ------------------------------------------------------------------------ Shortcuts QUnit.test( "logger shortcuts emit to default namespace properly", function(assert) { - var logger = new metrics.default.MetricsLogger({ + var logger = new metrics.MetricsLogger({ logLevel : 'all' }); logger.cache.empty(); - assert.equal( logger.options.logLevel, metrics.default.MetricsLogger.ALL ); + assert.equal( logger.options.logLevel, metrics.MetricsLogger.ALL ); logger.log( 0 ); logger.debug( 1 ); logger.info( 2 ); @@ -259,7 +260,7 @@ define([ // ======================================================================== LoggingCache QUnit.test( "cache construction/initializiation defaults", function(assert) { // use empty to prevent tests stepping on one another due to persistence - var cache = new metrics.default.LoggingCache({ key: 'logs-test' }).empty(); + var cache = new metrics.LoggingCache({ key: 'logs-test' }).empty(); assert.equal( cache.maxSize, 5000 ); assert.equal( window.localStorage.getItem( 'logs-test' ), '[]' ); }); @@ -268,20 +269,20 @@ define([ ////TODO: doesn't work - readonly //window.localStorage = null; //console.debug( 'localStorage:', window.localStorage ); - var oldFn = metrics.default.LoggingCache.prototype._hasStorage; - metrics.default.LoggingCache.prototype._hasStorage = function(){ return false; }; + var oldFn = metrics.LoggingCache.prototype._hasStorage; + metrics.LoggingCache.prototype._hasStorage = function(){ return false; }; assert.throws( function(){ - return new metrics.default.LoggingCache({ key: 'logs-test' }); + return new metrics.LoggingCache({ key: 'logs-test' }); }, /LoggingCache needs localStorage/, 'lack of localStorage throws error' ); - metrics.default.LoggingCache.prototype._hasStorage = oldFn; + metrics.LoggingCache.prototype._hasStorage = oldFn; assert.throws( function(){ - return new metrics.default.LoggingCache(); + return new metrics.LoggingCache(); }, /LoggingCache needs key for localStorage/, 'lack of key throws error' ); }); QUnit.test( "cache construction/initializiation setting max cache size", function(assert) { - var cache = new metrics.default.LoggingCache({ + var cache = new metrics.LoggingCache({ key : 'logs-test', maxSize : 5 }).empty(); @@ -289,7 +290,7 @@ define([ }); QUnit.test( "cache plays well with no data", function(assert) { - var cache = new metrics.default.LoggingCache({ key: 'logs-test' }).empty(); + var cache = new metrics.LoggingCache({ key: 'logs-test' }).empty(); assert.equal( cache.length(), 0 ); var get = cache.get( 10 ); @@ -300,7 +301,7 @@ define([ }); QUnit.test( "cache add properly adds and removes data", function(assert) { - var cache = new metrics.default.LoggingCache({ + var cache = new metrics.LoggingCache({ key : 'logs-test', maxSize : 5 }).empty(); @@ -325,7 +326,7 @@ define([ }); QUnit.test( "cache past max loses oldest", function(assert) { - var cache = new metrics.default.LoggingCache({ + var cache = new metrics.LoggingCache({ key : 'logs-test', maxSize : 5 }).empty(); @@ -343,16 +344,16 @@ define([ }); QUnit.test( "cache is properly persistent", function(assert) { - var cache1 = new metrics.default.LoggingCache({ key : 'logs-test' }).empty(), + var cache1 = new metrics.LoggingCache({ key : 'logs-test' }).empty(), entry = [{ one: 1 }, 'two' ]; cache1.add( entry ); assert.equal( cache1.length(), 1 ); - var cache2 = new metrics.default.LoggingCache({ key : 'logs-test' }); + var cache2 = new metrics.LoggingCache({ key : 'logs-test' }); assert.equal( cache2.length(), 1, 'old key gets previously stored' ); assert.equal( JSON.stringify( cache2.get( 1 )[0] ), JSON.stringify( entry ) ); - var cache3 = new metrics.default.LoggingCache({ key : 'logs-bler' }); + var cache3 = new metrics.LoggingCache({ key : 'logs-bler' }); assert.equal( cache3.length(), 0, 'new key causes new storage' ); }); diff --git a/test/qunit/tests/modal_tests.js b/test/qunit/tests/modal_tests.js index e2fc0366b45..073ef116bc0 100644 --- a/test/qunit/tests/modal_tests.js +++ b/test/qunit/tests/modal_tests.js @@ -2,12 +2,13 @@ define([ "test-app", "mvc/ui/ui-modal", "QUnit", "sinon" ], function( testApp, GalaxyModal, QUnit, sinon ){ "use strict"; + GalaxyModal = GalaxyModal.default; QUnit.module( "Modal dialog test", { beforeEach: function() { testApp.create(); this.clock = sinon.useFakeTimers(); var self = this; - this.app = new GalaxyModal.default.View({ + this.app = new GalaxyModal.View({ title : 'Test title', body : 'Test body', buttons : { @@ -86,4 +87,4 @@ define([ "test-app", "mvc/ui/ui-modal", "QUnit", "sinon" assert.ok( this.app.getButton( 'Cancel' ).prop( 'disabled' ), 'Cancel is still disabled' ); assert.ok( !this.app.getButton( 'Ok' ).prop( 'disabled' ), 'Ok is active again' ); } ); -}); \ No newline at end of file +}); diff --git a/test/qunit/tests/page_tests.js b/test/qunit/tests/page_tests.js index 99ee8f413f5..9b726a5d782 100644 --- a/test/qunit/tests/page_tests.js +++ b/test/qunit/tests/page_tests.js @@ -2,6 +2,8 @@ define([ "test-app", "layout/page", "layout/panel", "QUnit" ], function( testApp, Page, Panel, QUnit ){ "use strict"; + Page = Page.default; + Panel = Panel.default; QUnit.module( "Page test", { beforeEach: function() { testApp.create(); @@ -21,7 +23,7 @@ define([ "test-app", "layout/page", "layout/panel", "QUnit" QUnit.test( "test center/right", function(assert) { this.$container.empty(); - var page = new Page.default.View({ + var page = new Page.View({ Right : Backbone.View.extend({ initialize: function() { this.setElement( $('
') ); @@ -33,12 +35,12 @@ define([ "test-app", "layout/page", "layout/panel", "QUnit" }); QUnit.test( "test center", function(assert) { this.$container.empty(); - var page = new Page.default.View({}).render(); + var page = new Page.View({}).render(); _check( assert, page, { left: 'none', right: 'none' } ); }); QUnit.test( "test left/center", function(assert) { this.$container.empty(); - var page = new Page.default.View({ + var page = new Page.View({ Left : Backbone.View.extend({ initialize: function() { this.setElement( $('') ); @@ -48,4 +50,4 @@ define([ "test-app", "layout/page", "layout/panel", "QUnit" }).render(); _check( assert, page, { left: 'block', right: 'none' } ); }); -}); \ No newline at end of file +}); diff --git a/test/qunit/tests/popover_tests.js b/test/qunit/tests/popover_tests.js index bc9bbef2e8b..f50e07db952 100644 --- a/test/qunit/tests/popover_tests.js +++ b/test/qunit/tests/popover_tests.js @@ -2,18 +2,20 @@ define([ "test-app", "mvc/ui/ui-misc", "mvc/ui/ui-popover", "QUnit" ], function( testApp, Ui, Popover, QUnit ){ "use strict"; + Ui = Ui.default; + Popover = Popover.default; QUnit.module( "Popover test", { beforeEach: function() { testApp.create(); var self = this; - this.button = new Ui.default.Button({ + this.button = new Ui.Button({ title : 'Test button', onclick : function() { self.popover.show(); } }); this.$parent = $( '' ).append( this.button.$el ); - this.popover = new Popover.default.View({ + this.popover = new Popover.View({ title : 'Test Title', body : 'Test Body', placement : 'bottom', diff --git a/test/qunit/tests/ui_tests.js b/test/qunit/tests/ui_tests.js index 5cb4876bd69..e11a378a457 100644 --- a/test/qunit/tests/ui_tests.js +++ b/test/qunit/tests/ui_tests.js @@ -2,6 +2,12 @@ define([ 'QUnit', 'sinon', 'test-app', 'mvc/ui/ui-misc', 'mvc/ui/ui-select-content', 'mvc/ui/ui-drilldown', 'mvc/ui/ui-slider', 'mvc/ui/ui-thumbnails', 'mvc/ui/ui-tabs' ], function( QUnit, sinon, testApp, Ui, SelectContent, Drilldown, Slider, Thumbnails, Tabs ){ 'use strict'; + Ui = Ui.default; + SelectContent = SelectContent.default; + Drilldown = Drilldown.default; + Slider = Slider.default; + Thumbnails = Thumbnails.default; + Tabs = Tabs.default; QUnit.module( 'Ui test', { beforeEach: function() { testApp.create(); @@ -15,7 +21,7 @@ define([ 'QUnit', 'sinon', 'test-app', 'mvc/ui/ui-misc', 'mvc/ui/ui-select-conte QUnit.test( 'tabs', function(assert) { var self = this; - var tabs = new Tabs.default.View({}); + var tabs = new Tabs.View({}); var collection = tabs.collection; collection.add( { id: 'id_a', title: 'title_a', icon: 'icon_a', $el: 'el_a' } ); var _test = function() { @@ -62,7 +68,7 @@ define([ 'QUnit', 'sinon', 'test-app', 'mvc/ui/ui-misc', 'mvc/ui/ui-select-conte assert.ok( $(thumb.$( '.ui-thumbnails-title' )[ options.index || 0 ]).html() == options.title, 'Correct title with icon' ); assert.ok( $(thumb.$( '.ui-thumbnails-description-text' )[ options.index || 0 ]).html() == options.description, 'Correct description' ); }; - var thumb = new Thumbnails.default.View({ + var thumb = new Thumbnails.View({ title_default : 'title_default', title_list : 'title_list', collection : [{ @@ -103,7 +109,7 @@ define([ 'QUnit', 'sinon', 'test-app', 'mvc/ui/ui-misc', 'mvc/ui/ui-select-conte }); QUnit.test( 'button-default', function(assert) { - var button = new Ui.default.Button( { title: 'title' } ); + var button = new Ui.Button( { title: 'title' } ); var model = button.model; $( 'body' ).prepend( button.$el ); assert.ok( button.$title.html() == 'title', 'Has correct title' ); @@ -122,7 +128,7 @@ define([ 'QUnit', 'sinon', 'test-app', 'mvc/ui/ui-misc', 'mvc/ui/ui-select-conte assert.ok( button.$title.html() == model.get( 'title' ), 'Shows correct regular title' ); }); QUnit.test( 'button-default', function(assert) { - var button = new Ui.default.Button( { title: 'title' } ); + var button = new Ui.Button( { title: 'title' } ); var model = button.model; $( 'body' ).prepend( button.$el ); assert.ok( button.$title.html() == 'title', 'Has correct title' ); @@ -142,7 +148,7 @@ define([ 'QUnit', 'sinon', 'test-app', 'mvc/ui/ui-misc', 'mvc/ui/ui-select-conte }); QUnit.test( 'button-icon', function(assert) { - var button = new Ui.default.ButtonIcon( { title: 'title' } ); + var button = new Ui.ButtonIcon( { title: 'title' } ); var model = button.model; $( 'body' ).prepend( button.$el ); assert.ok( button.$title.html() == 'title', 'Has correct title' ); @@ -156,7 +162,7 @@ define([ 'QUnit', 'sinon', 'test-app', 'mvc/ui/ui-misc', 'mvc/ui/ui-select-conte }); QUnit.test( 'button-check', function(assert) { - var button = new Ui.default.ButtonCheck( { title: 'title' } ); + var button = new Ui.ButtonCheck( { title: 'title' } ); var model = button.model; $( 'body' ).prepend( button.$el ); assert.ok( button.$title.html() == 'title', 'Has correct title' ); @@ -195,7 +201,7 @@ define([ 'QUnit', 'sinon', 'test-app', 'mvc/ui/ui-misc', 'mvc/ui/ui-select-conte assert.ok( obj.$menu.find( '.ui-button-check' ).length === ( Boolean( options.all_icon ) ? 1 : 0 ), 'All button available: ' + Boolean( options.all_active ) ); } - var radio = new Ui.default.Radio.View({}); + var radio = new Ui.Radio.View({}); $( 'body' ).prepend( radio.$el ); radio.model.set( 'visible', false ); assert.ok( radio.value() === null, 'Initial value is `null`.' ); @@ -281,7 +287,7 @@ define([ 'QUnit', 'sinon', 'test-app', 'mvc/ui/ui-misc', 'mvc/ui/ui-select-conte length: 3 }); - var check = new Ui.default.Checkbox.View({}); + var check = new Ui.Checkbox.View({}); $( 'body' ).prepend( check.$el ); _test( check, { menu_visible: false, @@ -380,7 +386,7 @@ define([ 'QUnit', 'sinon', 'test-app', 'mvc/ui/ui-misc', 'mvc/ui/ui-select-conte all_icon: 'fa-check-square-o' }); - var radiobutton = new Ui.default.RadioButton.View({}); + var radiobutton = new Ui.RadioButton.View({}); $( 'body' ).prepend( radiobutton.$el ); radiobutton.model.set( 'data', [ { value: 'valuea', label: 'labela' }, { value: 'valueb', label: 'labelb' } ] ); _test( radiobutton, { @@ -401,7 +407,7 @@ define([ 'QUnit', 'sinon', 'test-app', 'mvc/ui/ui-misc', 'mvc/ui/ui-select-conte length: 2 }); - var drilldown = new Drilldown.default.View({}); + var drilldown = new Drilldown.View({}); $( 'body' ).prepend( drilldown.$el ); drilldown.model.set( 'data', [ { value: 'valuea', name: 'labela', options: [ { value: 'valueb', name: 'labelb' }, @@ -436,7 +442,7 @@ define([ 'QUnit', 'sinon', 'test-app', 'mvc/ui/ui-misc', 'mvc/ui/ui-select-conte length: 14, all_icon: 'fa-minus-square-o' }); - var drillradio = new Drilldown.default.View( { display: 'radio' } ); + var drillradio = new Drilldown.View( { display: 'radio' } ); $( 'body' ).prepend( drillradio.$el ); _test( drillradio, { menu_visible: false, @@ -467,7 +473,7 @@ define([ 'QUnit', 'sinon', 'test-app', 'mvc/ui/ui-misc', 'mvc/ui/ui-select-conte assert.ok( Boolean( select.all_button ) === Boolean( options.multiple ), 'Visiblity of select all button correct.' ); options.multiple && assert.ok( select.all_button.$( '.icon' ).hasClass( options.all_icon ), 'All button in correct state: ' + options.all_icon ); } - var select = new Ui.default.Select.View({}); + var select = new Ui.Select.View({}); $( 'body' ).prepend( select.$el ); assert.ok( select.first() === '__null__', 'First select is \'__null__\'' ); assert.ok( select.$dropdown.hasClass( 'fa-caret-down' ), 'Caret down shown.' ); @@ -574,7 +580,7 @@ define([ 'QUnit', 'sinon', 'test-app', 'mvc/ui/ui-misc', 'mvc/ui/ui-select-conte } ); QUnit.test( 'label', function(assert) { - var label = new Ui.default.Label({ + var label = new Ui.Label({ title : '_title' }); $( 'body' ).prepend( label.$el ); @@ -584,23 +590,23 @@ define([ 'QUnit', 'sinon', 'test-app', 'mvc/ui/ui-misc', 'mvc/ui/ui-select-conte } ); QUnit.test( 'slider', function(assert) { - var input = new Slider.default.View( { min: 1, max: 100, value: 10 } ); + var input = new Slider.View( { min: 1, max: 100, value: 10 } ); $( 'body' ).prepend( input.$el ); assert.ok( input.$slider.slider( 'value' ) == 10, 'Correct value.' ); assert.ok( input.value( 1000 ) == 100, 'Correct upper limit.' ); assert.ok( input.$slider.slider( 'value' ) == 100, 'Correct slider value.' ); assert.ok( input.$slider.slider( 'option', 'step' ) == 1, 'Correct default step size.' ); - var input1 = new Slider.default.View( { value: 10 } ); + var input1 = new Slider.View( { value: 10 } ); $( 'body' ).prepend( input1.$el ); assert.ok( input1.$slider.css( 'display' ) == 'none', 'Slider hidden.' ); - var input2 = new Slider.default.View( { min: 0, max: 100, value: 10.1, precise: true } ); + var input2 = new Slider.View( { min: 0, max: 100, value: 10.1, precise: true } ); $( 'body' ).prepend( input2.$el ); assert.ok( input2.$slider.slider( 'option', 'step' ) == 0.01, 'Correct float step size.' ); assert.ok( input2.$slider.slider( 'value' ) == 10.1, 'Correct float slider value.' ); } ); QUnit.test( 'input', function(assert) { - var input = new Ui.default.Input(); + var input = new Ui.Input(); $( 'body' ).prepend( input.$el ); assert.ok( input.tagName === 'input', 'Created input.' ); assert.ok( input.value() === undefined, 'Input empty.' ); @@ -623,7 +629,7 @@ define([ 'QUnit', 'sinon', 'test-app', 'mvc/ui/ui-misc', 'mvc/ui/ui-select-conte } ); QUnit.test( 'textarea', function(assert) { - var input = new Ui.default.Input( { area: true } ); + var input = new Ui.Input( { area: true } ); $( 'body' ).prepend( input.$el ); assert.ok( input.tagName === 'textarea', 'Created textarea.' ); assert.ok( input.value() === undefined, 'Unavailable value.' ); @@ -635,7 +641,7 @@ define([ 'QUnit', 'sinon', 'test-app', 'mvc/ui/ui-misc', 'mvc/ui/ui-select-conte } ); QUnit.test( 'message', function(assert) { - var message = new Ui.default.Message({ + var message = new Ui.Message({ persistent : true, message : '_message', status : 'danger' @@ -651,7 +657,7 @@ define([ 'QUnit', 'sinon', 'test-app', 'mvc/ui/ui-misc', 'mvc/ui/ui-select-conte } ); QUnit.test( 'hidden', function(assert) { - var hidden = new Ui.default.Hidden(); + var hidden = new Ui.Hidden(); $( 'body' ).prepend( hidden.$el ); hidden.model.set( 'info', '_info' ); assert.ok( hidden.$info.css( 'display', 'block' ), 'Info shown.' ); @@ -663,7 +669,7 @@ define([ 'QUnit', 'sinon', 'test-app', 'mvc/ui/ui-misc', 'mvc/ui/ui-select-conte } ); QUnit.test( 'select-content', function(assert) { - var select = new SelectContent.default.View({}); + var select = new SelectContent.View({}); $( 'body' ).prepend( select.$el ); var _testSelect = function( tag, options ) { var field = select.fields[ tag == 'first' ? 0 : select.fields.length - 1 ]; @@ -783,7 +789,7 @@ define([ 'QUnit', 'sinon', 'test-app', 'mvc/ui/ui-misc', 'mvc/ui/ui-select-conte assert.ok( select.config[ select.model.get( 'current' ) ].src == 'hdca', 'Matched collection field' ); assert.ok( JSON.stringify( select.value() ) == '{"values":[{"id":"id2","name":"name2","hid":"hid2"}],"batch":true}', 'Checking collection value' ); - select = new SelectContent.default.View({}); + select = new SelectContent.View({}); $( 'body' ).prepend( select.$el ); var _testEmptySelect = function( tag, txt_extension, txt_label ) { var field = select.fields[ tag == 'first' ? 0 : select.fields.length - 1 ]; diff --git a/test/qunit/tests/upload_dialog_tests.js b/test/qunit/tests/upload_dialog_tests.js index c5d6a3e7dcb..0a0faeace9e 100644 --- a/test/qunit/tests/upload_dialog_tests.js +++ b/test/qunit/tests/upload_dialog_tests.js @@ -2,10 +2,11 @@ define([ "test-app", "mvc/upload/upload-view", "QUnit" ], function( testApp, GalaxyUpload, QUnit ){ "use strict"; + GalaxyUpload = GalaxyUpload.default; QUnit.module( "Upload dialog test", { beforeEach: function( ) { testApp.create(); - this.app = new GalaxyUpload.default(); + this.app = new GalaxyUpload(); }, afterEach: function() { testApp.destroy(); diff --git a/test/qunit/tests/utils_test.js b/test/qunit/tests/utils_test.js index 578e682d704..de4e6a51211 100644 --- a/test/qunit/tests/utils_test.js +++ b/test/qunit/tests/utils_test.js @@ -2,19 +2,20 @@ define([ 'test-app', 'utils/utils', "QUnit" ], function( testApp, Utils, QUnit ){ 'use strict'; + Utils = Utils.default; QUnit.module( 'Utils test', {} ); QUnit.test( 'isEmpty', function(assert) { - assert.ok( Utils.default.isEmpty( [] ), 'Empty array' ); - assert.ok( Utils.default.isEmpty( [ 'data', undefined ] ), 'Array contains `undefined`' ); - assert.ok( Utils.default.isEmpty( [ 'data', null ] ), 'Array contains `null`' ); - assert.ok( Utils.default.isEmpty( [ 'data', '__null__' ] ), 'Array contains `__null__`' ); - assert.ok( Utils.default.isEmpty( [ 'data', '__undefined__' ] ), 'Array contains `__undefined__`' ); - assert.ok( Utils.default.isEmpty( null ), 'Array is null' ); - assert.ok( Utils.default.isEmpty( '__null__' ), 'Array is __null__' ); - assert.ok( Utils.default.isEmpty( '__undefined__' ), 'Array is __undefined__' ); - assert.ok( !Utils.default.isEmpty( [ 'data' ] ), 'Array contains `data`' ); - assert.ok( !Utils.default.isEmpty( 1 ), 'Value is int' ); - assert.ok( !Utils.default.isEmpty( 0 ), 'Value is zero' ); + assert.ok( Utils.isEmpty( [] ), 'Empty array' ); + assert.ok( Utils.isEmpty( [ 'data', undefined ] ), 'Array contains `undefined`' ); + assert.ok( Utils.isEmpty( [ 'data', null ] ), 'Array contains `null`' ); + assert.ok( Utils.isEmpty( [ 'data', '__null__' ] ), 'Array contains `__null__`' ); + assert.ok( Utils.isEmpty( [ 'data', '__undefined__' ] ), 'Array contains `__undefined__`' ); + assert.ok( Utils.isEmpty( null ), 'Array is null' ); + assert.ok( Utils.isEmpty( '__null__' ), 'Array is __null__' ); + assert.ok( Utils.isEmpty( '__undefined__' ), 'Array is __undefined__' ); + assert.ok( !Utils.isEmpty( [ 'data' ] ), 'Array contains `data`' ); + assert.ok( !Utils.isEmpty( 1 ), 'Value is int' ); + assert.ok( !Utils.isEmpty( 0 ), 'Value is zero' ); }); -}); \ No newline at end of file +}); diff --git a/test/qunit/tests/workflow_editor_tests.js b/test/qunit/tests/workflow_editor_tests.js index 17aa6edea15..a376582ab2f 100644 --- a/test/qunit/tests/workflow_editor_tests.js +++ b/test/qunit/tests/workflow_editor_tests.js @@ -23,6 +23,14 @@ define([ Connector ){ "use strict"; + Utils = Utils.default; + App = App.default; + Node = Node.default; + NodeView = NodeView.default; + Terminals = Terminals.default; + TerminalsView = TerminalsView.default; + Connector = Connector.default; + window.show_modal = function(a, b, c) {} window.hide_modal = function() {} @@ -38,7 +46,7 @@ define([ ''); // build app - return new App.default({ + return new App({ id : null, urls : { get_datatypes : Galaxy.root + 'api/datatypes/mapping' }, workflows : [] @@ -48,9 +56,9 @@ define([ QUnit.module( "Input terminal model test", { beforeEach: function( ) { testApp.create(); - this.node = new Node.default( create_app(), { } ); + this.node = new Node( create_app(), { } ); this.input = { extensions: [ "txt" ], multiple: false }; - this.input_terminal = new Terminals.default.InputTerminal( { input: this.input } ); + this.input_terminal = new Terminals.InputTerminal( { input: this.input } ); this.input_terminal.node = this.node; }, afterEach: function() { @@ -61,9 +69,9 @@ define([ this.input_terminal.update( this.input ); }, test_connector: function( ) { - var outputTerminal = new Terminals.default.OutputTerminal( { datatypes: [ 'input' ] } ); + var outputTerminal = new Terminals.OutputTerminal( { datatypes: [ 'input' ] } ); var inputTerminal = this.input_terminal; - var connector = new Connector.default( outputTerminal, inputTerminal ); + var connector = new Connector( outputTerminal, inputTerminal ); return connector; }, with_test_connector: function( f ) { @@ -77,7 +85,7 @@ define([ test_accept: function( other ) { other = other || { node: {}, datatypes: [ "txt" ] }; if( ! other.mapOver ) { - other.mapOver = function() { return Terminals.default.NULL_COLLECTION_TYPE_DESCRIPTION; }; + other.mapOver = function() { return Terminals.NULL_COLLECTION_TYPE_DESCRIPTION; }; } return this.input_terminal.canAccept( other ); }, @@ -212,14 +220,14 @@ define([ } ); QUnit.test( "can accept list collection for empty multiple inputs", function(assert) { - var other = { node: {}, datatypes: [ "tabular" ], mapOver: function() { return new Terminals.default.CollectionTypeDescription( "list" ) } }; + var other = { node: {}, datatypes: [ "tabular" ], mapOver: function() { return new Terminals.CollectionTypeDescription( "list" ) } }; var self = this; this.multiple(); assert.ok( self.test_accept( other ) ); } ); QUnit.test( "cannot accept list collection for multiple input if collection already connected", function(assert) { - var other = { node: {}, datatypes: [ "tabular" ], mapOver: function() { return new Terminals.default.CollectionTypeDescription( "list" ) } }; + var other = { node: {}, datatypes: [ "tabular" ], mapOver: function() { return new Terminals.CollectionTypeDescription( "list" ) } }; var self = this; this.multiple(); this.with_test_connector( function() { @@ -232,12 +240,12 @@ define([ QUnit.test( "connects only if both valid handles", function(assert) { var input = { connect: sinon.spy() }; var output = { connect: sinon.spy() }; - new Connector.default( input, null ); - new Connector.default( null, output ); + new Connector( input, null ); + new Connector( null, output ); // Not attempts to connect... assert.ok( ! input.connect.called ); assert.ok( ! output.connect.called ); - new Connector.default( input, output ); + new Connector( input, output ); assert.ok( input.connect.called ); assert.ok( output.connect.called ); }); @@ -245,7 +253,7 @@ define([ QUnit.test( "default attributes", function(assert) { var input = { connect: sinon.spy() }; var output = { connect: sinon.spy() }; - var connector = new Connector.default( input, output ); + var connector = new Connector( input, output ); assert.equal( connector.dragging, false ); assert.equal( connector.canvas, null ); assert.equal( connector.inner_color, "#FFFFFF" ); @@ -255,7 +263,7 @@ define([ QUnit.test( "destroy", function(assert) { var input = { connect: sinon.spy(), disconnect: sinon.spy() }; var output = { connect: sinon.spy(), disconnect: sinon.spy() }; - var connector = new Connector.default( input, output ); + var connector = new Connector( input, output ); connector.destroy(); assert.ok( input.disconnect.called ); assert.ok( output.disconnect.called ); @@ -264,7 +272,7 @@ define([ QUnit.test( "initial redraw", function(assert) { var input = { connect: sinon.spy(), element: $("