Browse Source

[core] Bumped Jasmine to 1.3.1 and fixed desktop tests

Enrico Berti 10 years ago
parent
commit
8e93210b54

+ 0 - 71
apps/jobsub/src/jobsub/static/jobsub/jasmine/jobsubSpec.js

@@ -1,71 +0,0 @@
-/*
- Licensed to Cloudera, Inc. under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  Cloudera, Inc. licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
-     http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-describe("Designs", function(){
-  var viewModel;
-
-  function getSampleDesign(id, name, node_type, is_shared, is_trashed, is_editable){
-    return {
-      "is_shared": is_shared,
-      "node_type": node_type, 
-      "last_modified": 1366678126.0, 
-      "name": name, 
-      "owner": "hdfs", 
-      "editable": is_editable, 
-      "id": id, 
-      "is_trashed": is_trashed, 
-      "description": ""
-    };
-  }
-
-
-  var models = [
-    getSampleDesign(1, 'test1', 'mapreduce', true, false, true),
-    getSampleDesign(2, 'test2', 'java', true, false, true),
-    getSampleDesign(3, 'test3', 'shell', true, false, true),
-  ];
-
-  beforeEach(function(){
-    viewModel = new Designs({models: models});
-    ko.applyBindings(viewModel);
-  });
-
-  describe("When clicking select all", function(){
-
-    it("should select all designs and deselect them all", function(){
-      viewModel.selectAll();
-      expect(viewModel.selectedDesignObjects().length).toEqual(viewModel.designs().length);
-      viewModel.deselectAll();
-      expect(viewModel.selectedDesignObjects().length).toEqual(0);
-      viewModel.toggleSelectAll();
-      expect(viewModel.selectedDesignObjects().length).toEqual(viewModel.designs().length);
-      viewModel.toggleSelectAll();
-      expect(viewModel.selectedDesignObjects().length).toEqual(0);
-    });
-
-  });
-
-  describe("When selecting a design", function(){
-
-    it("should return a selectedDesign", function(){
-      viewModel.designs()[0].selected(true);
-      expect(viewModel.selectedDesign().name).toEqual(viewModel.designs()[0].design().name);
-    });
-
-  });
-});

+ 0 - 22
apps/jobsub/src/jobsub/templates/jasmine.mako

@@ -1,22 +0,0 @@
-<%namespace name="listDesigns" file="designs.mako" />
-<%inherit file="common_jasmine.mako"/>
-
-<%block name="specs">
-    <script src="${ static('desktop/ext/js/mustache.js') }" type="text/javascript" charset="utf-8"></script>
-    <script src="${ static('desktop/ext/js/routie-0.3.0.min.js') }" type="text/javascript" charset="utf-8"></script>
-    <script src="${ static('desktop/ext/js/knockout-min.js') }" type="text/javascript" charset="utf-8"></script>
-    <script src="${ static('desktop/ext/js/knockout.mapping-2.3.2.js') }" type="text/javascript" charset="utf-8"></script>
-    <script src="${ static('desktop/ext/js/moment-with-locales.min.js') }" type="text/javascript" charset="utf-8"></script>
-    <script src="${ static('oozie/js/workflow.models.js') }" type="text/javascript" charset="utf-8"></script>
-    <script src="${ static('oozie/js/workflow.node-fields.js') }" type="text/javascript" charset="utf-8"></script>
-    <script src="${ static('jobsub/js/jobsub.templates.js') }" type="text/javascript" charset="utf-8"></script>
-    <script src="${ static('jobsub/js/jobsub.ko.js') }" type="text/javascript" charset="utf-8"></script>
-    <script src="${ static('jobsub/js/jobsub.js') }" type="text/javascript" charset="utf-8"></script>
-    <script src="${ static('jobsub/jasmine/jobsubSpec.js') }"></script>
-</%block>
-
-
-<%block name="fixtures">
-  <div style="display:none">
-  </div>
-</%block>

+ 0 - 3
apps/jobsub/src/jobsub/urls.py

@@ -31,7 +31,4 @@ urlpatterns = patterns(
   url(r'^designs/(?P<design_id>\d+)/clone$', 'clone_design'),
   url(r'^designs/(?P<design_id>\d+)/delete$', 'delete_design'),
   url(r'^designs/(?P<design_id>\d+)/restore$', 'restore_design'),
-
-  # Jasmine - Skip until rewritten
-  url(r'^jasmine', 'jasmine'),
 )

+ 0 - 4
apps/jobsub/src/jobsub/views.py

@@ -280,7 +280,3 @@ def clone_design(request, design_id):
   cloned_action.save()
 
   return get_design(request, clone.id)
-
-
-def jasmine(request):
-  return render('jasmine.mako', request, None)

+ 0 - 279
apps/oozie/src/oozie/static/oozie/jasmine/workflow.js

@@ -1,279 +0,0 @@
-/*
- Licensed to Cloudera, Inc. under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  Cloudera, Inc. licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
-     http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-
-function getFileBrowseButton() {}
-
-
-describe("WorkflowModel", function(){
-
-  function create_three_step_workflow(workflow_id) {
-    var workflow_model = new WorkflowModel({
-      "id": workflow_id,
-      "name": "Test-Three-Step-Workflow",
-      "start": 1,
-      "end": 5,
-      "nodes":[{
-          "description":"",
-          "workflow":workflow_id,
-          "child_links":[{
-              "comment":"",
-              "name":"to",
-              "parent":1,
-              "child":2
-            },{
-              "comment":"",
-              "name":"related",
-              "parent":1,
-              "child":5
-          }],
-          "node_type":"start",
-          "id":1,
-          "name":"start"
-        },{
-          "id":2,
-          "name":"Sleep-1",
-          "workflow":workflow_id,
-          "node_type":"mapreduce",
-          "jar_path":"/user/hue/oozie/workspaces/lib/hadoop-examples.jar",
-          "child_links":[{
-              "comment":"",
-              "name":"ok",
-              "parent":2,
-              "child":3
-            },{
-              "comment":"",
-              "name":"error",
-              "parent":2,
-              "child":6
-            }],
-      },{
-        "id":3,
-        "name":"Sleep-2",
-        "workflow":workflow_id,
-        "node_type":"mapreduce",
-        "jar_path":"/user/hue/oozie/workspaces/lib/hadoop-examples.jar",
-        "child_links":[{
-            "comment":"",
-            "name":"ok",
-            "parent":3,
-            "child":4
-          },{
-            "comment":"",
-            "name":"error",
-            "parent":3,
-            "child":6
-          }],
-      },{
-        "id":4,
-        "name":"Sleep-3",
-        "workflow":workflow_id,
-        "node_type":"mapreduce",
-        "jar_path":"/user/hue/oozie/workspaces/lib/hadoop-examples.jar",
-        "child_links":[{
-            "comment":"",
-            "name":"ok",
-            "parent":4,
-            "child":5
-          },{
-            "comment":"",
-            "name":"error",
-            "parent":4,
-            "child":6
-          }],
-      },{
-        "id":6,
-        "name":"kill",
-        "workflow":workflow_id,
-        "node_type":"kill",
-        "child_links":[],
-        "message":"Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]",
-      },{
-        "id":5,
-        "name":"end",
-        "workflow":workflow_id,
-        "node_type":"end",
-        "child_links":[],
-      }],
-    });
-    var registry = new Registry();
-    var workflow = new Workflow({
-      model: workflow_model,
-      registry: registry
-    });
-    return workflow;
-  }
-
-  function create_pig_workflow(workflow_id) {
-    var workflow_model = new WorkflowModel({
-      "id": workflow_id,
-      "name": "Test-pig-Workflow",
-      "start": 1,
-      "end": 5,
-      "nodes":[{
-          "description":"",
-          "workflow":workflow_id,
-          "child_links":[{
-              "comment":"",
-              "name":"to",
-              "parent":1,
-              "child":2
-            },{
-              "comment":"",
-              "name":"related",
-              "parent":1,
-              "child":5
-          }],
-          "node_type":"start",
-          "id":1,
-          "name":"start"
-        },{
-          "id":2,
-          "name":"Pig-1",
-          "workflow":workflow_id,
-          "node_type":"pig",
-          "script_path":"test.pig",
-          "child_links":[{
-              "comment":"",
-              "name":"ok",
-              "parent":2,
-              "child":3
-            },{
-              "comment":"",
-              "name":"error",
-              "parent":2,
-              "child":4
-            }],
-      },{
-        "id":4,
-        "name":"kill",
-        "workflow":workflow_id,
-        "node_type":"kill",
-        "child_links":[],
-        "message":"Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]",
-      },{
-        "id":3,
-        "name":"end",
-        "workflow":workflow_id,
-        "node_type":"end",
-        "child_links":[],
-      }],
-    })
-    var registry = new Registry();
-    var workflow = new Workflow({
-      model: workflow_model,
-      registry: registry
-    });
-    return workflow;
-  }
-
-  describe("Workflow operations", function(){
-    var json = '{"id":1,"name":"Test-pig-Workflow","start":1,"end":5,"nodes":[{"description":"","workflow":1,"child_links":[{"comment":"","name":"to","parent":1,"child":2},{"comment":"","name":"related","parent":1,"child":5}],"node_type":"start","id":1,"name":"start"},{"id":2,"name":"Pig-1","workflow":1,"node_type":"pig","script_path":"test.pig","child_links":[{"comment":"","name":"ok","parent":2,"child":3},{"comment":"","name":"error","parent":2,"child":4}],"description":"","files":"[]","archives":"[]","job_properties":"[]","prepares":"[]","job_xml":"","params":"[]"},{"id":3,"name":"end","workflow":1,"node_type":"end","child_links":[],"description":""},{"id":4,"name":"kill","workflow":1,"node_type":"kill","child_links":[],"message":"Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]","description":""}],"parameters":[],"description":"","schema_version":0.4,"deployment_dir":"","is_shared":true,"job_xml":""}';
-    var node = null;
-    var viewModel = create_pig_workflow(1);
-    viewModel.rebuild();
-
-    it("Ensure serialized data sent to server is proper", function() {
-      expect(viewModel.toJSON()).toEqual(ko.toJSON($.parseJSON(json)));
-    });
-
-    it("Ensure data received from server can be loaded", function() {
-      viewModel.reload($.parseJSON(json.replace('test.pig','test1.pig')));
-      expect(viewModel.id()).toEqual(1);
-      expect(viewModel.name()).toEqual('Test-pig-Workflow');
-      expect(viewModel.start()).toEqual(1);
-      expect(viewModel.description()).toEqual("");
-      expect(viewModel.schema_version()).toEqual(0.4);
-      expect(viewModel.deployment_dir()).toEqual("");
-      expect(viewModel.is_shared()).toEqual(true);
-      expect(viewModel.parameters().length).toEqual(0);
-      expect(viewModel.job_xml()).toEqual("");
-      expect(viewModel.nodes().length).toEqual(3);
-      expect(viewModel.nodes()[1].script_path()).toEqual('test1.pig');
-    });
-  });
-
-  describe("Node APIs", function(){
-    var node = null;
-    var viewModel = create_three_step_workflow(2);
-    viewModel.rebuild();
-
-    it("Should be able to detach a node", function() {
-      node = viewModel.nodes()[2];
-      node.detach();
-      viewModel.rebuild();
-      expect(viewModel.nodes().length).toEqual(4);
-    });
-
-    it("Should be able to append a node", function() {
-      viewModel.nodes()[1].append(node);
-      viewModel.rebuild();
-      expect(viewModel.nodes().length).toEqual(5);
-    });
-
-    it("Should be able to fail when appending the same node", function() {
-      viewModel.nodes()[1].append(node);
-      viewModel.rebuild();
-      expect(viewModel.nodes().length).toEqual(5);
-    });
-
-    it("Should be able to add error node", function() {
-      viewModel.nodes()[1].putErrorChild(viewModel.nodes()[2]);
-      viewModel.rebuild();
-      expect(viewModel.nodes().length).toEqual(5);
-      expect(viewModel.nodes()[1].meta_links().length).toEqual(1);
-      expect(viewModel.nodes()[1].meta_links()[0].name()).toEqual("error");
-      expect(viewModel.nodes()[1].meta_links()[0].parent()).toEqual(viewModel.nodes()[1].id());
-      expect(viewModel.nodes()[1].meta_links()[0].child()).toEqual(viewModel.nodes()[2].id());
-    });
-
-    it("Should be able to get error node", function() {
-      viewModel.nodes()[1].putErrorChild(viewModel.nodes()[2]);
-      viewModel.rebuild();
-      expect(viewModel.nodes().length).toEqual(5);
-      expect(viewModel.nodes()[1].getErrorChild().id()).toEqual(viewModel.nodes()[2].id());
-    });
-  });
-
-  describe("Workflow node modal", function(){
-    var node = null;
-    var viewModel = create_three_step_workflow(2);
-    var modal = new Modal($('#node-modal'));
-    viewModel.rebuild();
-
-    it("Ensure can open and close modal", function() {
-      edit_node_modal(modal, viewModel, viewModel.nodes()[1]);
-      expect(modal.el.is(":visible"));
-      $('.doneButton').click();
-      expect(!modal.el.is(":visible"));
-
-      edit_node_modal(modal, viewModel, viewModel.nodes()[1]);
-      expect(modal.el.is(":visible"));
-      $('.cancelButton').click();
-      expect(!modal.el.is(":visible"));
-    });
-
-    it("Ensure can change kill node of existing node", function() {
-      edit_node_modal(modal, viewModel, viewModel.nodes()[1]);
-      modal.context().error_node(viewModel.nodes()[0].id());
-      expect(viewModel.nodes()[1].getErrorChild().id()).toEqual(viewModel.nodes()[0].id());
-      $('.done').click();
-      expect(viewModel.nodes()[1].getErrorChild().id()).toEqual(viewModel.nodes()[0].id());
-    });
-  });
-});

+ 0 - 130
apps/oozie/src/oozie/static/oozie/jasmine/workflow.json

@@ -1,130 +0,0 @@
-{
-  "job_xml":"",
-  "is_shared":true,
-  "end":2,
-  "description":"Example of MapReduce action that sleeps",
-  "parameters":"[]",
-  "is_single":false,
-  "schema_version":"uri:oozie:workflow:0.4",
-  "start":1,
-  "last_modified":"2012-12-21 15:46:57.639664",
-  "owner":1,
-  "nodes":[{
-      "description":"",
-      "workflow":21,
-      "child_links":[{
-          "comment":"",
-          "name":"to",
-          "id":115,
-          "parent":91,
-          "child":92
-        },{
-          "comment":"",
-          "name":"related",
-          "id":116,
-          "parent":91,
-          "child":90
-      }],
-      "node_type":"start",
-      "node_ptr":91,
-      "id":91,
-      "name":"start"
-    },{
-      "files":"[]",
-      "job_xml":"",
-      "description":"Sleep for some time",
-      "workflow":21,
-      "jar_path":"/user/hue/oozie/workspaces/lib/hadoop-examples.jar",
-      "job_properties":"[{\"name\":\"mapred.reduce.tasks\",\"value\":\"1\"},{\"name\":\"mapred.mapper.class\",\"value\":\"org.apache.hadoop.examples.SleepJob\"},{\"name\":\"mapred.reducer.class\",\"value\":\"org.apache.hadoop.examples.SleepJob\"},{\"name\":\"mapred.mapoutput.key.class\",\"value\":\"org.apache.hadoop.io.IntWritable\"},{\"name\":\"mapred.mapoutput.value.class\",\"value\":\"org.apache.hadoop.io.NullWritable\"},{\"name\":\"mapred.output.format.class\",\"value\":\"org.apache.hadoop.mapred.lib.NullOutputFormat\"},{\"name\":\"mapred.input.format.class\",\"value\":\"org.apache.hadoop.examples.SleepJob$SleepInputFormat\"},{\"name\":\"mapred.partitioner.class\",\"value\":\"org.apache.hadoop.examples.SleepJob\"},{\"name\":\"mapred.speculative.execution\",\"value\":\"false\"},{\"name\":\"sleep.job.map.sleep.time\",\"value\":\"0\"},{\"name\":\"sleep.job.reduce.sleep.time\",\"value\":\"${REDUCER_SLEEP_TIME}\"}]",
-      "node_type":"mapreduce",
-      "archives":"[]",
-      "node_ptr":92,
-      "prepares":"[]",
-      "child_links":[{
-          "comment":"",
-          "name":"ok",
-          "id":117,
-          "parent":92,
-          "child":94
-        },{
-          "comment":"",
-          "name":"error",
-          "id":118,
-          "parent":92,
-          "child":89
-        }],
-    "id":92,
-    "name":"Sleep"
-  },{
-    "files":"[]",
-    "job_xml":"",
-    "description":"Sleep for some time",
-    "workflow":21,
-    "jar_path":"/user/hue/oozie/workspaces/lib/hadoop-examples.jar",
-    "job_properties":"[{\"name\":\"mapred.reduce.tasks\",\"value\":\"1\"},{\"name\":\"mapred.mapper.class\",\"value\":\"org.apache.hadoop.examples.SleepJob\"},{\"name\":\"mapred.reducer.class\",\"value\":\"org.apache.hadoop.examples.SleepJob\"},{\"name\":\"mapred.mapoutput.key.class\",\"value\":\"org.apache.hadoop.io.IntWritable\"},{\"name\":\"mapred.mapoutput.value.class\",\"value\":\"org.apache.hadoop.io.NullWritable\"},{\"name\":\"mapred.output.format.class\",\"value\":\"org.apache.hadoop.mapred.lib.NullOutputFormat\"},{\"name\":\"mapred.input.format.class\",\"value\":\"org.apache.hadoop.examples.SleepJob$SleepInputFormat\"},{\"name\":\"mapred.partitioner.class\",\"value\":\"org.apache.hadoop.examples.SleepJob\"},{\"name\":\"mapred.speculative.execution\",\"value\":\"false\"},{\"name\":\"sleep.job.map.sleep.time\",\"value\":\"0\"},{\"name\":\"sleep.job.reduce.sleep.time\",\"value\":\"${REDUCER_SLEEP_TIME}\"}]",
-    "node_type":"mapreduce",
-    "archives":"[]",
-    "node_ptr":94,
-    "prepares":"[]",
-    "child_links":[{
-        "comment":"",
-        "name":"ok",
-        "id":121,
-        "parent":94,
-        "child":93
-      },{
-        "comment":"",
-        "name":"error",
-        "id":122,
-        "parent":94,
-        "child":89
-      }],
-    "id":94,
-    "name":"Sleep-copy"
-  },{
-    "files":"[]",
-    "job_xml":"",
-    "description":"Sleep for some time",
-    "workflow":21,
-    "jar_path":"/user/hue/oozie/workspaces/lib/hadoop-examples.jar",
-    "job_properties":"[{\"name\":\"mapred.reduce.tasks\",\"value\":\"1\"},{\"name\":\"mapred.mapper.class\",\"value\":\"org.apache.hadoop.examples.SleepJob\"},{\"name\":\"mapred.reducer.class\",\"value\":\"org.apache.hadoop.examples.SleepJob\"},{\"name\":\"mapred.mapoutput.key.class\",\"value\":\"org.apache.hadoop.io.IntWritable\"},{\"name\":\"mapred.mapoutput.value.class\",\"value\":\"org.apache.hadoop.io.NullWritable\"},{\"name\":\"mapred.output.format.class\",\"value\":\"org.apache.hadoop.mapred.lib.NullOutputFormat\"},{\"name\":\"mapred.input.format.class\",\"value\":\"org.apache.hadoop.examples.SleepJob$SleepInputFormat\"},{\"name\":\"mapred.partitioner.class\",\"value\":\"org.apache.hadoop.examples.SleepJob\"},{\"name\":\"mapred.speculative.execution\",\"value\":\"false\"},{\"name\":\"sleep.job.map.sleep.time\",\"value\":\"0\"},{\"name\":\"sleep.job.reduce.sleep.time\",\"value\":\"${REDUCER_SLEEP_TIME}\"}]",
-    "node_type":"mapreduce",
-    "archives":"[]",
-    "node_ptr":93,
-    "prepares":"[]",
-    "child_links":[{
-        "comment":"",
-        "name":"ok",
-        "id":119,
-        "parent":93,
-        "child":90
-      },{
-        "comment":"",
-        "name":"error",
-        "id":120,
-        "parent":93,
-        "child":89
-      }],
-    "id":93,
-    "name":"Sleep-copy"
-  },{
-    "description":"",
-    "workflow":21,
-    "child_links":[],
-    "node_type":"kill",
-    "node_ptr":89,
-    "message":"Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]",
-    "id":89,
-    "name":"kill"
-  },{
-    "description":"",
-    "workflow":21,
-    "child_links":[],
-    "node_type":"end",
-    "node_ptr":90,
-    "id":90,
-    "name":"end"
-  }],
-  "id":21,
-  "name":"MapReduce-copy"
-}

+ 0 - 30
apps/oozie/src/oozie/templates/editor/jasmine.mako

@@ -1,30 +0,0 @@
-<%inherit file="/common_jasmine.mako"/>
-
-<%block name="specs">
-  <script src="${ static('desktop/ext/js/knockout.mapping-2.3.2.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/ext/js/moment-with-locales.min.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/ext/js/bootstrap.min.js') }" type="text/javascript" charset="utf-8"></script>
-  <script type="text/javascript" src="${ static('oozie/js/workflow.utils.js') }"></script>
-  <script type="text/javascript" src="${ static('oozie/js/workflow.registry.js') }"></script>
-  <script type="text/javascript" src="${ static('oozie/js/workflow.modal.js') }"></script>
-  <script type="text/javascript" src="${ static('oozie/js/workflow.models.js') }"></script>
-  <script type="text/javascript" src="${ static('oozie/js/workflow.idgen.js') }"></script>
-  <script type="text/javascript" src="${ static('oozie/js/workflow.node-fields.js') }"></script>
-  <script type="text/javascript" src="${ static('oozie/js/workflow.node.js') }"></script>
-  <script type="text/javascript" src="${ static('oozie/js/workflow.js') }"></script>
-  <script type="text/javascript" src="${ static('oozie/js/workflow.import-node.js') }"></script>
-  <script src="${ static('oozie/jasmine/workflow.js') }" type="text/javascript" charset="utf-8"></script>
-</%block>
-
-<%block name="fixtures">
-  <div style="display:none">
-    <h1>Buongiorno, world!</h1>
-    <div id="graph"></div>
-  </div>
-
-  <div id="modal-window" class="modal hide fade">
-    <a class="doneButton"></a>
-    <a class="cancelButton"></a>
-    <a class="closeButton"></a>
-  </div>
-</%block>

+ 0 - 1
apps/oozie/src/oozie/urls.py

@@ -63,7 +63,6 @@ urlpatterns = patterns(
   url(r'^list_history$', 'list_history', name='list_history'), # Unused
   url(r'^list_history/(?P<record_id>[-\w]+)$', 'list_history_record', name='list_history_record'),
   url(r'^install_examples/$', 'install_examples', name='install_examples'),
-  url(r'^jasmine', 'jasmine'),
 )
 
 

+ 0 - 4
apps/oozie/src/oozie/views/editor.py

@@ -938,7 +938,3 @@ def install_examples(request):
       result['message'] = str(e)
 
   return JsonResponse(result)
-
-
-def jasmine(request):
-  return render('editor/jasmine.mako', request, None)

+ 1 - 0
desktop/core/src/desktop/static/desktop/ext/css/jasmine.css

@@ -19,6 +19,7 @@ body { background-color: #eeeeee; padding: 0; margin: 5px; overflow-y: scroll; }
 #HTMLReporter .symbolSummary li.skipped:before { color: #bababa; content: "\02022"; }
 #HTMLReporter .symbolSummary li.pending { line-height: 11px; }
 #HTMLReporter .symbolSummary li.pending:before { color: #aaaaaa; content: "-"; }
+#HTMLReporter .exceptions { color: #fff; float: right; margin-top: 5px; margin-right: 5px; }
 #HTMLReporter .bar { line-height: 28px; font-size: 14px; display: block; color: #eee; }
 #HTMLReporter .runningAlert { background-color: #666666; }
 #HTMLReporter .skippedAlert { background-color: #aaaaaa; }

+ 107 - 36
desktop/core/src/desktop/static/desktop/ext/js/jasmine/jasmine-1.2.0.js → desktop/core/src/desktop/static/desktop/ext/js/jasmine/jasmine-1.3.1.js

@@ -1,4 +1,4 @@
-var isCommonJS = typeof window == "undefined";
+var isCommonJS = typeof window == "undefined" && typeof exports == "object";
 
 /**
  * Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework.
@@ -34,11 +34,23 @@ jasmine.VERBOSE = false;
  */
 jasmine.DEFAULT_UPDATE_INTERVAL = 250;
 
+/**
+ * Maximum levels of nesting that will be included when an object is pretty-printed
+ */
+jasmine.MAX_PRETTY_PRINT_DEPTH = 40;
+
 /**
  * Default timeout interval in milliseconds for waitsFor() blocks.
  */
 jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000;
 
+/**
+ * By default exceptions thrown in the context of a test are caught by jasmine so that it can run the remaining tests in the suite.
+ * Set to false to let the exception bubble up in the browser.
+ *
+ */
+jasmine.CATCH_EXCEPTIONS = true;
+
 jasmine.getGlobal = function() {
   function getGlobal() {
     return this;
@@ -463,7 +475,7 @@ jasmine.log = function() {
  * @see jasmine.createSpy
  * @param obj
  * @param methodName
- * @returns a Jasmine spy that can be chained with all spy methods
+ * @return {jasmine.Spy} a Jasmine spy that can be chained with all spy methods
  */
 var spyOn = function(obj, methodName) {
   return jasmine.getEnv().currentSpec.spyOn(obj, methodName);
@@ -508,6 +520,7 @@ if (isCommonJS) exports.xit = xit;
  * jasmine.Matchers functions.
  *
  * @param {Object} actual Actual value to test against and expected value
+ * @return {jasmine.Matchers}
  */
 var expect = function(actual) {
   return jasmine.getEnv().currentSpec.expect(actual);
@@ -867,6 +880,25 @@ jasmine.Env.prototype.xit = function(desc, func) {
   };
 };
 
+jasmine.Env.prototype.compareRegExps_ = function(a, b, mismatchKeys, mismatchValues) {
+  if (a.source != b.source)
+    mismatchValues.push("expected pattern /" + b.source + "/ is not equal to the pattern /" + a.source + "/");
+
+  if (a.ignoreCase != b.ignoreCase)
+    mismatchValues.push("expected modifier i was" + (b.ignoreCase ? " " : " not ") + "set and does not equal the origin modifier");
+
+  if (a.global != b.global)
+    mismatchValues.push("expected modifier g was" + (b.global ? " " : " not ") + "set and does not equal the origin modifier");
+
+  if (a.multiline != b.multiline)
+    mismatchValues.push("expected modifier m was" + (b.multiline ? " " : " not ") + "set and does not equal the origin modifier");
+
+  if (a.sticky != b.sticky)
+    mismatchValues.push("expected modifier y was" + (b.sticky ? " " : " not ") + "set and does not equal the origin modifier");
+
+  return (mismatchValues.length === 0);
+};
+
 jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchValues) {
   if (a.__Jasmine_been_here_before__ === b && b.__Jasmine_been_here_before__ === a) {
     return true;
@@ -953,6 +985,10 @@ jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) {
     return (a == b);
   }
 
+  if (a instanceof RegExp && b instanceof RegExp) {
+    return this.compareRegExps_(a, b, mismatchKeys, mismatchValues);
+  }
+
   if (typeof a === "object" && typeof b === "object") {
     return this.compareObjects_(a, b, mismatchKeys, mismatchValues);
   }
@@ -1019,11 +1055,16 @@ jasmine.Block = function(env, func, spec) {
   this.spec = spec;
 };
 
-jasmine.Block.prototype.execute = function(onComplete) {  
-  try {
+jasmine.Block.prototype.execute = function(onComplete) {
+  if (!jasmine.CATCH_EXCEPTIONS) {
     this.func.apply(this.spec);
-  } catch (e) {
-    this.spec.fail(e);
+  }
+  else {
+    try {
+      this.func.apply(this.spec);
+    } catch (e) {
+      this.spec.fail(e);
+    }
   }
   onComplete();
 };
@@ -1281,6 +1322,17 @@ jasmine.Matchers.prototype.toBeNull = function() {
   return (this.actual === null);
 };
 
+/**
+ * Matcher that compares the actual to NaN.
+ */
+jasmine.Matchers.prototype.toBeNaN = function() {
+	this.message = function() {
+		return [ "Expected " + jasmine.pp(this.actual) + " to be NaN." ];
+	};
+
+	return (this.actual !== this.actual);
+};
+
 /**
  * Matcher that boolean not-nots the actual.
  */
@@ -1358,18 +1410,14 @@ jasmine.Matchers.prototype.toHaveBeenCalledWith = function() {
     throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
   }
   this.message = function() {
+    var invertedMessage = "Expected spy " + this.actual.identity + " not to have been called with " + jasmine.pp(expectedArgs) + " but it was.";
+    var positiveMessage = "";
     if (this.actual.callCount === 0) {
-      // todo: what should the failure message for .not.toHaveBeenCalledWith() be? is this right? test better. [xw]
-      return [
-        "Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but it was never called.",
-        "Expected spy " + this.actual.identity + " not to have been called with " + jasmine.pp(expectedArgs) + " but it was."
-      ];
+      positiveMessage = "Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but it was never called.";
     } else {
-      return [
-        "Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall),
-        "Expected spy " + this.actual.identity + " not to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall)
-      ];
+      positiveMessage = "Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but actual calls were " + jasmine.pp(this.actual.argsForCall).replace(/^\[ | \]$/g, '')
     }
+    return [positiveMessage, invertedMessage];
   };
 
   return this.env.contains_(this.actual.argsForCall, expectedArgs);
@@ -1427,22 +1475,19 @@ jasmine.Matchers.prototype.toBeGreaterThan = function(expected) {
  * up to a given level of decimal precision (default 2).
  *
  * @param {Number} expected
- * @param {Number} precision
+ * @param {Number} precision, as number of decimal places
  */
 jasmine.Matchers.prototype.toBeCloseTo = function(expected, precision) {
   if (!(precision === 0)) {
     precision = precision || 2;
   }
-  var multiplier = Math.pow(10, precision);
-  var actual = Math.round(this.actual * multiplier);
-  expected = Math.round(expected * multiplier);
-  return expected == actual;
+  return Math.abs(expected - this.actual) < (Math.pow(10, -precision) / 2);
 };
 
 /**
  * Matcher that checks that the expected exception was thrown by the actual.
  *
- * @param {String} expected
+ * @param {String} [expected]
  */
 jasmine.Matchers.prototype.toThrow = function(expected) {
   var result = false;
@@ -1840,10 +1885,6 @@ jasmine.PrettyPrinter = function() {
  * @param value
  */
 jasmine.PrettyPrinter.prototype.format = function(value) {
-  if (this.ppNestLevel_ > 40) {
-    throw new Error('jasmine.PrettyPrinter: format() nested too deeply!');
-  }
-
   this.ppNestLevel_++;
   try {
     if (value === jasmine.undefined) {
@@ -1886,6 +1927,7 @@ jasmine.PrettyPrinter.prototype.format = function(value) {
 
 jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) {
   for (var property in obj) {
+    if (!obj.hasOwnProperty(property)) continue;
     if (property == '__Jasmine_been_here_before__') continue;
     fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) !== jasmine.undefined && 
                                          obj.__lookupGetter__(property) !== null) : false);
@@ -1913,6 +1955,11 @@ jasmine.StringPrettyPrinter.prototype.emitString = function(value) {
 };
 
 jasmine.StringPrettyPrinter.prototype.emitArray = function(array) {
+  if (this.ppNestLevel_ > jasmine.MAX_PRETTY_PRINT_DEPTH) {
+    this.append("Array");
+    return;
+  }
+
   this.append('[ ');
   for (var i = 0; i < array.length; i++) {
     if (i > 0) {
@@ -1924,6 +1971,11 @@ jasmine.StringPrettyPrinter.prototype.emitArray = function(array) {
 };
 
 jasmine.StringPrettyPrinter.prototype.emitObject = function(obj) {
+  if (this.ppNestLevel_ > jasmine.MAX_PRETTY_PRINT_DEPTH) {
+    this.append("Object");
+    return;
+  }
+
   var self = this;
   this.append('{ ');
   var first = true;
@@ -1952,6 +2004,10 @@ jasmine.StringPrettyPrinter.prototype.append = function(value) {
 };
 jasmine.Queue = function(env) {
   this.env = env;
+
+  // parallel to blocks. each true value in this array means the block will
+  // get executed even if we abort
+  this.ensured = [];
   this.blocks = [];
   this.running = false;
   this.index = 0;
@@ -1959,15 +2015,30 @@ jasmine.Queue = function(env) {
   this.abort = false;
 };
 
-jasmine.Queue.prototype.addBefore = function(block) {
+jasmine.Queue.prototype.addBefore = function(block, ensure) {
+  if (ensure === jasmine.undefined) {
+    ensure = false;
+  }
+
   this.blocks.unshift(block);
+  this.ensured.unshift(ensure);
 };
 
-jasmine.Queue.prototype.add = function(block) {
+jasmine.Queue.prototype.add = function(block, ensure) {
+  if (ensure === jasmine.undefined) {
+    ensure = false;
+  }
+
   this.blocks.push(block);
+  this.ensured.push(ensure);
 };
 
-jasmine.Queue.prototype.insertNext = function(block) {
+jasmine.Queue.prototype.insertNext = function(block, ensure) {
+  if (ensure === jasmine.undefined) {
+    ensure = false;
+  }
+
+  this.ensured.splice((this.index + this.offset + 1), 0, ensure);
   this.blocks.splice((this.index + this.offset + 1), 0, block);
   this.offset++;
 };
@@ -1991,7 +2062,7 @@ jasmine.Queue.prototype.next_ = function() {
   while (goAgain) {
     goAgain = false;
     
-    if (self.index < self.blocks.length && !this.abort) {
+    if (self.index < self.blocks.length && !(this.abort && !this.ensured[self.index])) {
       var calledSynchronously = true;
       var completedSynchronously = false;
 
@@ -2282,7 +2353,7 @@ jasmine.Spec.prototype.finish = function(onComplete) {
 
 jasmine.Spec.prototype.after = function(doAfter) {
   if (this.queue.isRunning()) {
-    this.queue.add(new jasmine.Block(this.env, doAfter, this));
+    this.queue.add(new jasmine.Block(this.env, doAfter, this), true);
   } else {
     this.afterCallbacks.unshift(doAfter);
   }
@@ -2320,15 +2391,15 @@ jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() {
     this.queue.addBefore(new jasmine.Block(this.env, runner.before_[i], this));
   }
   for (i = 0; i < this.afterCallbacks.length; i++) {
-    this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this));
+    this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this), true);
   }
   for (suite = this.suite; suite; suite = suite.parentSuite) {
     for (i = 0; i < suite.after_.length; i++) {
-      this.queue.add(new jasmine.Block(this.env, suite.after_[i], this));
+      this.queue.add(new jasmine.Block(this.env, suite.after_[i], this), true);
     }
   }
   for (i = 0; i < runner.after_.length; i++) {
-    this.queue.add(new jasmine.Block(this.env, runner.after_[i], this));
+    this.queue.add(new jasmine.Block(this.env, runner.after_[i], this), true);
   }
 };
 
@@ -2523,7 +2594,7 @@ jasmine.WaitsForBlock.prototype.execute = function(onComplete) {
 
 jasmine.version_= {
   "major": 1,
-  "minor": 2,
-  "build": 0,
-  "revision": 1337005947
+  "minor": 3,
+  "build": 1,
+  "revision": 1354556913
 };

+ 77 - 12
desktop/core/src/desktop/static/desktop/ext/js/jasmine/jasmine-html-1.2.0.js → desktop/core/src/desktop/static/desktop/ext/js/jasmine/jasmine-html-1.3.1.js

@@ -78,6 +78,7 @@ jasmine.HtmlReporter = function(_doc) {
 
     createReporterDom(runner.env.versionString());
     doc.body.appendChild(dom.reporter);
+    setExceptionHandling();
 
     reporterView = new jasmine.HtmlReporter.ReporterView(dom);
     reporterView.addSpecs(specs, self.specFilter);
@@ -131,7 +132,7 @@ jasmine.HtmlReporter = function(_doc) {
       }
 
       var paramMap = [];
-      var params = doc.location.search.substring(1).split('&');
+      var params = jasmine.HtmlReporter.parameters(doc);
 
       for (var i = 0; i < params.length; i++) {
         var p = params[i].split('=');
@@ -151,14 +152,78 @@ jasmine.HtmlReporter = function(_doc) {
         self.createDom('span', { className: 'version' }, version)),
 
       dom.symbolSummary = self.createDom('ul', {className: 'symbolSummary'}),
-      dom.alert = self.createDom('div', {className: 'alert'}),
+      dom.alert = self.createDom('div', {className: 'alert'},
+        self.createDom('span', { className: 'exceptions' },
+          self.createDom('label', { className: 'label', 'for': 'no_try_catch' }, 'No try/catch'),
+          self.createDom('input', { id: 'no_try_catch', type: 'checkbox' }))),
       dom.results = self.createDom('div', {className: 'results'},
         dom.summary = self.createDom('div', { className: 'summary' }),
         dom.details = self.createDom('div', { id: 'details' }))
     );
   }
+
+  function noTryCatch() {
+    return window.location.search.match(/catch=false/);
+  }
+
+  function searchWithCatch() {
+    var params = jasmine.HtmlReporter.parameters(window.document);
+    var removed = false;
+    var i = 0;
+
+    while (!removed && i < params.length) {
+      if (params[i].match(/catch=/)) {
+        params.splice(i, 1);
+        removed = true;
+      }
+      i++;
+    }
+    if (jasmine.CATCH_EXCEPTIONS) {
+      params.push("catch=false");
+    }
+
+    return params.join("&");
+  }
+
+  function setExceptionHandling() {
+    var chxCatch = document.getElementById('no_try_catch');
+
+    if (noTryCatch()) {
+      chxCatch.setAttribute('checked', true);
+      jasmine.CATCH_EXCEPTIONS = false;
+    }
+    chxCatch.onclick = function() {
+      window.location.search = searchWithCatch();
+    };
+  }
+};
+jasmine.HtmlReporter.parameters = function(doc) {
+  var paramStr = doc.location.search.substring(1);
+  var params = [];
+
+  if (paramStr.length > 0) {
+    params = paramStr.split('&');
+  }
+  return params;
+}
+jasmine.HtmlReporter.sectionLink = function(sectionName) {
+  var link = '?';
+  var params = [];
+
+  if (sectionName) {
+    params.push('spec=' + encodeURIComponent(sectionName));
+  }
+  if (!jasmine.CATCH_EXCEPTIONS) {
+    params.push("catch=false");
+  }
+  if (params.length > 0) {
+    link += params.join("&");
+  }
+
+  return link;
 };
-jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter);jasmine.HtmlReporter.ReporterView = function(dom) {
+jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter);
+jasmine.HtmlReporter.ReporterView = function(dom) {
   this.startedAt = new Date();
   this.runningSpecCount = 0;
   this.completeSpecCount = 0;
@@ -241,14 +306,14 @@ jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter);jasmine.HtmlReporte
 
     // currently running UI
     if (isUndefined(this.runningAlert)) {
-      this.runningAlert = this.createDom('a', {href: "?", className: "runningAlert bar"});
+      this.runningAlert = this.createDom('a', { href: jasmine.HtmlReporter.sectionLink(), className: "runningAlert bar" });
       dom.alert.appendChild(this.runningAlert);
     }
     this.runningAlert.innerHTML = "Running " + this.completeSpecCount + " of " + specPluralizedFor(this.totalSpecCount);
 
     // skipped specs UI
     if (isUndefined(this.skippedAlert)) {
-      this.skippedAlert = this.createDom('a', {href: "?", className: "skippedAlert bar"});
+      this.skippedAlert = this.createDom('a', { href: jasmine.HtmlReporter.sectionLink(), className: "skippedAlert bar" });
     }
 
     this.skippedAlert.innerHTML = "Skipping " + this.skippedCount + " of " + specPluralizedFor(this.totalSpecCount) + " - run all";
@@ -259,7 +324,7 @@ jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter);jasmine.HtmlReporte
 
     // passing specs UI
     if (isUndefined(this.passedAlert)) {
-      this.passedAlert = this.createDom('span', {href: "?", className: "passingAlert bar"});
+      this.passedAlert = this.createDom('span', { href: jasmine.HtmlReporter.sectionLink(), className: "passingAlert bar" });
     }
     this.passedAlert.innerHTML = "Passing " + specPluralizedFor(this.passedCount);
 
@@ -331,11 +396,11 @@ jasmine.HtmlReporter.SpecView = function(spec, dom, views) {
   this.dom.symbolSummary.appendChild(this.symbol);
 
   this.summary = this.createDom('div', { className: 'specSummary' },
-      this.createDom('a', {
-        className: 'description',
-        href: '?spec=' + encodeURIComponent(this.spec.getFullName()),
-        title: this.spec.getFullName()
-      }, this.spec.description)
+    this.createDom('a', {
+      className: 'description',
+      href: jasmine.HtmlReporter.sectionLink(this.spec.getFullName()),
+      title: this.spec.getFullName()
+    }, this.spec.description)
   );
 
   this.detail = this.createDom('div', { className: 'specDetail' },
@@ -406,7 +471,7 @@ jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SpecView);jasmine.Ht
   this.views = views;
 
   this.element = this.createDom('div', { className: 'suite' },
-      this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(this.suite.getFullName()) }, this.suite.description)
+    this.createDom('a', { className: 'description', href: jasmine.HtmlReporter.sectionLink(this.suite.getFullName()) }, this.suite.description)
   );
 
   this.appendToSummary(this.suite, this.element);

+ 1 - 1
desktop/core/src/desktop/static/desktop/jasmine/jHueSelectorSpec.js

@@ -1,7 +1,7 @@
 describe("jHueSelector plugin", function () {
 
   beforeEach(function () {
-    jasmine.getFixtures().fixturesPath = 'static/jasmine/';
+    jasmine.getFixtures().fixturesPath = 'static/desktop/jasmine/';
     loadFixtures('jHueSelectorFixture.html');
     $("#sampleList").jHueSelector();
   });

+ 1 - 1
desktop/core/src/desktop/static/desktop/jasmine/jHueTableExtenderSpec.js

@@ -1,7 +1,7 @@
 describe("jHueTableExtender plugin", function () {
 
   beforeEach(function () {
-    jasmine.getFixtures().fixturesPath = 'static/jasmine/';
+    jasmine.getFixtures().fixturesPath = 'static/desktop/jasmine/';
     loadFixtures('jHueTableExtenderFixture.html');
     $(".resultTable").dataTable({
       "bPaginate":false,

+ 2 - 2
desktop/core/src/desktop/static/desktop/jasmine/jHueTableScrollerSpec.js

@@ -4,7 +4,7 @@ describe("jHueTableScroller plugin", function () {
   var minHeightTableOriginalHeight = 0;
 
   beforeEach(function () {
-    jasmine.getFixtures().fixturesPath = 'static/jasmine/';
+    jasmine.getFixtures().fixturesPath = 'static/desktop/jasmine/';
     loadFixtures('jHueTableScrollerFixture.html');
 
     defaultTableOriginalHeight = $("#defaultTable").height();
@@ -20,7 +20,7 @@ describe("jHueTableScroller plugin", function () {
 
   it("should make the default table scroll with min height enabled", function () {
     expect($("#defaultTable").parent(".dataTables_wrapper").height()).toBeLessThan(defaultTableOriginalHeight);
-    expect($("#defaultTable").parent(".dataTables_wrapper").height()).toBe(400);
+    expect($("#defaultTable").parent(".dataTables_wrapper").height()).toBe(300);
   });
 
   it("should set a specific minimum height when data-tablescroller-min-height is specified", function () {

+ 2 - 2
desktop/core/src/desktop/templates/common_jasmine.mako

@@ -21,8 +21,8 @@
     <title>Jasmine Spec Runner</title>
 
     <link rel="stylesheet" type="text/css" href="${ static('desktop/ext/css/jasmine.css') }">
-    <script type="text/javascript" src="${ static('desktop/ext/js/jasmine/jasmine-1.2.0.js') }"></script>
-    <script type="text/javascript" src="${ static('desktop/ext/js/jasmine/jasmine-html-1.2.0.js') }"></script>
+    <script type="text/javascript" src="${ static('desktop/ext/js/jasmine/jasmine-1.3.1.js') }"></script>
+    <script type="text/javascript" src="${ static('desktop/ext/js/jasmine/jasmine-html-1.3.1.js') }"></script>
     <script type="text/javascript" src="${ static('desktop/ext/js/jquery/jquery-2.1.1.min.js') }"></script>
     <script type="text/javascript" src="${ static('desktop/js/jquery.migration.js') }"></script>
     <script type="text/javascript" src="${ static('desktop/ext/js/jasmine/jasmine-jquery-1.3.1.js') }"></script>