Skip to content

Commit ed5e6a7

Browse files
authored
Merge pull request #180 from AtlasOfLivingAustralia/feature/issue176
Fixed checkWarnings issue after making SpeciesViewModel a DataModelIt…
2 parents 2ec939e + a09840f commit ed5e6a7

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

grails-app/assets/javascripts/forms.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,8 @@ function orEmptyArray(v) {
722722
var constraints = {
723723
val: warningRule
724724
};
725-
return validate({val: self()}, constraints, {fullMessages: false});
725+
var data = ko.utils.unwrapObservable(self); // The SpeciesViewModel is a DataModelItem but not a knockout observable
726+
return validate({val: data}, constraints, {fullMessages: false});
726727
};
727728

728729
self.evaluateBehaviour = function (type, defaultValue) {
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
describe("SpeciesViewModel Spec", function () {
2+
it("Can participate in the DataModelItem calls like checkWarnings", function () {
3+
4+
let speciesViewModel = new SpeciesViewModel({}, {searchBieUrl:'/species/searchBie'}, {});
5+
expect(speciesViewModel.checkWarnings()).toBeUndefined();
6+
});
7+
});

0 commit comments

Comments
 (0)