Skip to content

Commit

Permalink
switch to agrc/grunt-contrib-jasmine
Browse files Browse the repository at this point in the history
temporarily until gruntjs/grunt-contrib-jasmine#269 is merged

Other misc test cleanup
  • Loading branch information
stdavis committed May 17, 2018
1 parent 0ab2215 commit 8de25c0
Show file tree
Hide file tree
Showing 8 changed files with 1,427 additions and 1,399 deletions.
1 change: 0 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ module.exports = function (grunt) {
'src/app/tests/jasmineTestBootstrap.js',
'src/dojo/dojo.js',
'src/app/packages.js',
'src/app/tests/jsReporterSanitizer.js',
'src/app/tests/jasmineAMDErrorChecking.js',
'src/jquery/dist/jquery.js',
'node_modules/es6-object-assign/dist/object-assign-auto.min.js'
Expand Down
5 changes: 4 additions & 1 deletion _src/app/_InProgressCacheMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ define([
}
});

this.hydrateWithInProgressData();
// don't run this in jasmine tests
if (!window.jasmine) {
this.hydrateWithInProgressData();
}

this.inherited(arguments);
},
Expand Down
26 changes: 14 additions & 12 deletions _src/app/catch/Catch.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,21 +231,23 @@ define([
$(that.batchBtn).popover('hide');
});

localforage.getItem(this.cacheId).then(function (inProgressData) {
if (inProgressData) {
if (inProgressData.gridData) {
that.setGridData(inProgressData.gridData);
that.grid.refresh();
}
if (!window.jasmine) {
localforage.getItem(this.cacheId).then(function (inProgressData) {
if (inProgressData) {
if (inProgressData.gridData) {
that.setGridData(inProgressData.gridData);
that.grid.refresh();
}

if (inProgressData.numPasses > 1) {
for (var i = 1; i < inProgressData.numPasses; i++) {
that.gridTab.addTab(true);
if (inProgressData.numPasses > 1) {
for (var i = 1; i < inProgressData.numPasses; i++) {
that.gridTab.addTab(true);
}
}
}
}
that.store.on('add, update, delete', lang.hitch(that, 'cacheInProgressData'));
});
that.store.on('add, update, delete', lang.hitch(that, 'cacheInProgressData'));
});
}

this.wireBatchFormEvents();

Expand Down
34 changes: 26 additions & 8 deletions _src/app/catch/MoreInfoDialog.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
define([
'./../Domains',
'./../_ClearValuesMixin',

'app/catch/FilteringSelectForGrid',
'app/config',
'app/_GridMixin',
'./../Domains',
'./../_ClearValuesMixin',

'dgrid/Editor',

Expand All @@ -13,6 +14,7 @@ define([
'dijit/_WidgetsInTemplateMixin',

'dojo/dom-class',
'dojo/dom-construct',
'dojo/promise/all',
'dojo/query',
'dojo/text!app/catch/templates/MoreInfoDialog.html',
Expand All @@ -28,11 +30,12 @@ define([
'app/catch/TagsContainer',
'leaflet'
], function (
Domains,
_ClearValuesMixin,

FilteringSelectForGrid,
config,
_GridMixin,
Domains,
_ClearValuesMixin,

editor,

Expand All @@ -42,6 +45,7 @@ define([
_WidgetsInTemplateMixin,

domClass,
domConstruct,
all,
query,
template,
Expand Down Expand Up @@ -179,20 +183,22 @@ define([

this.initGrid(columns);

$(this.dialog).on('hidden.bs.modal', lang.hitch(this, this.clearValues));
this.own($(this.dialog).on('hidden.bs.modal', lang.hitch(this, this.clearValues)));

var that = this;
$(this.dietTab).on('shown.bs.tab', function () {
that.grid.startup();
});

query('input[type=number]', this.domNode).on('change, keyup', function () {
this.own(query('input[type=number]', this.domNode).on('change, keyup', function () {
// bump this to the bottom of the callstack
// otherwise this code executes before the numericInputValidator
window.setTimeout(function () {
that.submitBtn.disabled = query('.form-group.has-error', that.domNode).length > 0;
if (that.submitBtn) {
that.submitBtn.disabled = query('.form-group.has-error', that.domNode).length > 0;
}
}, 0);
});
}));

this.controlMappings = [
[this.collectionPartSelect, 'COLLECTION_PART']
Expand Down Expand Up @@ -268,6 +274,9 @@ define([
// make sure that dialog is scrolled to the top and grid is started upd
var that = this;
setTimeout(function () {
if (!that.tabContainer) {
return;
}
that.tabContainer.scrollTop = 0;

if (tabName === 'Diet_tab') {
Expand Down Expand Up @@ -375,6 +384,15 @@ define([
}

return data;
},
destroy: function () {
// summary:
// clean up between tests
console.log('app/catch/MoreInfoDialog:destroy', arguments);

domConstruct.destroy(this.dialog);

this.inherited(arguments);
}
});
});
26 changes: 0 additions & 26 deletions _src/app/tests/jsReporterSanitizer.js

This file was deleted.

8 changes: 3 additions & 5 deletions _src/app/tests/spec/SpecHabitat.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ require([
'app/habitat/Habitat',

'dojo/dom-class',
'dojo/dom-construct',
'dojo/_base/window'
'dojo/dom-construct'
], function (
config,
Habitat,

domClass,
domConstruct,
win
domConstruct
) {
describe('app/habitat/Habitat', function () {
var testWidget;
Expand All @@ -20,7 +18,7 @@ require([
widget = null;
};
beforeEach(function () {
testWidget = new Habitat({}, domConstruct.create('div', {}, win.body()));
testWidget = new Habitat({}, domConstruct.create('div', {}, document.body));
testWidget.startup();
});
afterEach(function () {
Expand Down
Loading

0 comments on commit 8de25c0

Please sign in to comment.