Skip to content

Commit a09840f

Browse files
committed
Fixed checkWarnings issue after making SpeciesViewModel a DataModelItem #176
1 parent e08d0a4 commit a09840f

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
@@ -724,7 +724,8 @@ function orEmptyArray(v) {
724724
var constraints = {
725725
val: warningRule
726726
};
727-
return validate({val: self()}, constraints, {fullMessages: false});
727+
var data = ko.utils.unwrapObservable(self); // The SpeciesViewModel is a DataModelItem but not a knockout observable
728+
return validate({val: data}, constraints, {fullMessages: false});
728729
};
729730

730731
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)