Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed checkWarnings issue after making SpeciesViewModel a DataModelIt… #180

Merged
merged 1 commit into from
Feb 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fixed checkWarnings issue after making SpeciesViewModel a DataModelItem
  • Loading branch information
chrisala committed Feb 28, 2023
commit a09840f79fb315193761bfe8b612ce2ed6a0f4a3
3 changes: 2 additions & 1 deletion grails-app/assets/javascripts/forms.js
Original file line number Diff line number Diff line change
@@ -724,7 +724,8 @@ function orEmptyArray(v) {
var constraints = {
val: warningRule
};
return validate({val: self()}, constraints, {fullMessages: false});
var data = ko.utils.unwrapObservable(self); // The SpeciesViewModel is a DataModelItem but not a knockout observable
return validate({val: data}, constraints, {fullMessages: false});
};

self.evaluateBehaviour = function (type, defaultValue) {
7 changes: 7 additions & 0 deletions src/test/js/spec/SpeciesViewModelSpec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
describe("SpeciesViewModel Spec", function () {
it("Can participate in the DataModelItem calls like checkWarnings", function () {

let speciesViewModel = new SpeciesViewModel({}, {searchBieUrl:'/species/searchBie'}, {});
expect(speciesViewModel.checkWarnings()).toBeUndefined();
});
});