Skip to content
Draft
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions .changeset/wet-seas-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@getodk/xforms-engine': minor
'@getodk/web-forms': minor
'@getodk/scenario': patch
---

Adds support for setgeopoint
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ This section is auto generated. Please update `feature-matrix.json` and then run
<summary>

<!-- prettier-ignore -->
##### Question types (basic functionality)<br/>🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩⬜⬜⬜⬜⬜ 67\%
##### Question types (basic functionality)<br/>🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩⬜⬜⬜⬜⬜ 70\%

</summary>
<br/>
Expand All @@ -54,7 +54,7 @@ This section is auto generated. Please update `feature-matrix.json` and then run
| geopoint | ✅ |
| geotrace | ✅ |
| geoshape | ✅ |
| start-geopoint | |
| start-geopoint | |
| range | ✅ |
| image | ✅ |
| barcode | |
Expand Down
2 changes: 1 addition & 1 deletion feature-matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"geopoint": "",
"geotrace": "",
"geoshape": "",
"start-geopoint": "",
"start-geopoint": "",
"range": "",
"image": "",
"barcode": "",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa" xmlns:odk="http://www.opendatakit.org/xforms">
<h:head>
<h:title>setgeopoint-action-new-repeat</h:title>
<model>
<instance>
<data id="setgeopoint-action-new-repeat">
<person jr:template="">
<age />
<location />
</person>
</data>
</instance>
<bind nodeset="/data/person/age" type="integer" />
<bind nodeset="/data/person/location" type="string" readonly="true()" />
</model>
</h:head>
<h:body>
<group ref="/data/person">
<label>Person Repeat Group</label>
<repeat nodeset="/data/person">
<input ref="/data/person/age">
<label>Age</label>
</input>

<odk:setgeopoint event="odk-new-repeat" ref="/data/person/location" />

<input ref="/data/person/location">
<label>Location (auto-captured and prefilled on new repeat instance)</label>
</input>
</repeat>
</group>
</h:body>
</h:html>
4 changes: 4 additions & 0 deletions packages/common/src/test/fixtures/xform-dsl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,10 @@ export const setvalue = (event: string, ref: string, value?: string): XFormsElem
return t(`setvalue event="${event}" ref="${ref}"${valueAttribute}`);
};

export const setgeopoint = (event: string, ref: string): XFormsElement => {
return t(`odk:setgeopoint event="${event}" ref="${ref}"`);
};

export const setvalueLiteral = (event: string, ref: string, innerHtml: string): XFormsElement => {
return t(`setvalue event="${event}" ref="${ref}"`, innerHtml);
};
Expand Down
3 changes: 3 additions & 0 deletions packages/scenario/src/client/init.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { JRResourceService } from '@getodk/common/jr-resources/JRResourceService.ts';
import type {
FormResource,
GeolocationProvider,
InstanceAttachmentsConfig,
LoadFormOptions,
LoadFormSuccessResult,
Expand Down Expand Up @@ -29,6 +30,7 @@ export interface TestFormOptions {
readonly stateFactory: OpaqueReactiveObjectFactory;
readonly instanceAttachments: InstanceAttachmentsConfig;
readonly preloadProperties: PreloadProperties;
readonly geolocationProvider: GeolocationProvider;
}

const defaultConfig = {
Expand Down Expand Up @@ -65,6 +67,7 @@ export const initializeTestForm = async (
stateFactory: options.stateFactory,
instanceAttachments: options.instanceAttachments,
preloadProperties: options.preloadProperties,
geolocationProvider: options.geolocationProvider,
},
});
});
Expand Down
3 changes: 3 additions & 0 deletions packages/scenario/src/jr/Scenario.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ export class Scenario {
...overrideOptions?.instanceAttachments,
},
preloadProperties: overrideOptions?.preloadProperties ?? {},
geolocationProvider: overrideOptions?.geolocationProvider ?? {
getLocation: () => Promise.resolve(''),
},
};
}

Expand Down
Loading