Skip to content

Commit

Permalink
Merge pull request #35735 from dimagi/riese/esm_webapps_2
Browse files Browse the repository at this point in the history
Converts web apps specs to ESM
  • Loading branch information
MartinRiese authored Feb 6, 2025
2 parents ff1d267 + b39c937 commit 9fe973a
Show file tree
Hide file tree
Showing 20 changed files with 2,809 additions and 2,966 deletions.
1,188 changes: 588 additions & 600 deletions corehq/apps/cloudcare/static/cloudcare/js/form_entry/spec/entries_spec.js

Large diffs are not rendered by default.

273 changes: 137 additions & 136 deletions corehq/apps/cloudcare/static/cloudcare/js/form_entry/spec/fixtures.js
Original file line number Diff line number Diff line change
@@ -1,141 +1,142 @@
import _ from "underscore";

hqDefine("cloudcare/js/form_entry/spec/fixtures", [
"underscore",
], function (
_,
) {
return {
textJSON: (options = {}) => (_.defaults(options, {
"caption_audio": null,
"caption_video": null,
"caption_image": null,
"caption_markdown": null,
"caption": "name",
"binding": "/data/name",
"question_id": "name",
"required": 0,
"relevant": 0,
"answer": null,
"datatype": "str",
"style": null,
"type": "question",
"ix": "0",
"choices": null,
"repeatable": null,
"exists": null,
"header": null,
"control": 1,
"help": null,
"help_image": null,
"help_audio": null,
"help_video": null,
"hint": null,
"output": null,
"add-choice": null,
})),

selectJSON: (options = {}) => (_.defaults(options, {
"caption_audio": null,
"caption_video": null,
"caption_image": null,
"caption_markdown": null,
"caption": "choice",
"binding": "/data/select",
"question_id": "select",
"required": 0,
"relevant": 0,
"answer": null,
"datatype": "select",
"style": null,
"type": "question",
"ix": "2",
"choices": ["a", "b"],
"repeatable": null,
"exists": null,
"header": null,
"control": 2,
"help": null,
"help_image": null,
"help_audio": null,
"help_video": null,
"hint": null,
"output": null,
"add-choice": null,
})),
export function textJSON(options = {}) {
return _.defaults(options, {
"caption_audio": null,
"caption_video": null,
"caption_image": null,
"caption_markdown": null,
"caption": "name",
"binding": "/data/name",
"question_id": "name",
"required": 0,
"relevant": 0,
"answer": null,
"datatype": "str",
"style": null,
"type": "question",
"ix": "0",
"choices": null,
"repeatable": null,
"exists": null,
"header": null,
"control": 1,
"help": null,
"help_image": null,
"help_audio": null,
"help_video": null,
"hint": null,
"output": null,
"add-choice": null,
});
}

labelJSON: (options = {}) => (_.defaults(options, {
"caption_audio": null,
"caption_video": null,
"caption_image": null,
"caption_markdown": null,
"caption": "Label",
"binding": "/data/label",
"question_id": "label",
"required": 0,
"relevant": 0,
"answer": null,
"datatype": "info",
"style": {"raw": "minimal"},
"type": "question",
"ix": "3",
"choices": null,
"repeatable": null,
"exists": null,
"header": null,
"control": 9,
"help": null,
"help_image": null,
"help_audio": null,
"help_video": null,
"hint": null,
"output": null,
"add-choice": null,
})),
export function selectJSON(options = {}) {
return _.defaults(options, {
"caption_audio": null,
"caption_video": null,
"caption_image": null,
"caption_markdown": null,
"caption": "choice",
"binding": "/data/select",
"question_id": "select",
"required": 0,
"relevant": 0,
"answer": null,
"datatype": "select",
"style": null,
"type": "question",
"ix": "2",
"choices": ["a", "b"],
"repeatable": null,
"exists": null,
"header": null,
"control": 2,
"help": null,
"help_image": null,
"help_audio": null,
"help_video": null,
"hint": null,
"output": null,
"add-choice": null,
});
}

groupJSON: (options = {}) => (_.defaults(options, {
"type": "sub-group",
"ix": "1",
"exists": true,
"caption": "Group",
"children": [
{
"type": "sub-group",
"exists": true,
"ix": "1,2",
"caption": "Sub Group",
"children": [
{
"type": "question",
"ix": "2,3",
"datatype": "str",
"answer": null,
"children": [],
},
{
"type": "question",
"ix": "2,4",
"datatype": "str",
"answer": null,
"children": [],
},
],
},
],
})),

noQuestionGroupJSON: () => ({
"type": "sub-group",
"ix": "2",
"exists": true,
"children": [
{
"type": "sub-group",
"ix": "2,2",
"exists": true,
"children": [],
},
],
}),
export function labelJSON(options = {}) {
return _.defaults(options, {
"caption_audio": null,
"caption_video": null,
"caption_image": null,
"caption_markdown": null,
"caption": "Label",
"binding": "/data/label",
"question_id": "label",
"required": 0,
"relevant": 0,
"answer": null,
"datatype": "info",
"style": {"raw": "minimal"},
"type": "question",
"ix": "3",
"choices": null,
"repeatable": null,
"exists": null,
"header": null,
"control": 9,
"help": null,
"help_image": null,
"help_audio": null,
"help_video": null,
"hint": null,
"output": null,
"add-choice": null,
});
}

export function groupJSON(options = {}) {
return _.defaults(options, {
"type": "sub-group",
"ix": "1",
"exists": true,
"caption": "Group",
"children": [
{
"type": "sub-group",
"exists": true,
"ix": "1,2",
"caption": "Sub Group",
"children": [
{
"type": "question",
"ix": "2,3",
"datatype": "str",
"answer": null,
"children": [],
},
{
"type": "question",
"ix": "2,4",
"datatype": "str",
"answer": null,
"children": [],
},
],
},
],
});
}
export function noQuestionGroupJSON() {
return {
"type": "sub-group",
"ix": "2",
"exists": true,
"children": [
{
"type": "sub-group",
"ix": "2,2",
"exists": true,
"children": [],
},
],
};
});
}
Loading

0 comments on commit 9fe973a

Please sign in to comment.