Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Commit

Permalink
Fix: ensure geopicker is loaded for non-nested setgeopoint actions
Browse files Browse the repository at this point in the history
  • Loading branch information
eyelidlessness committed Jun 7, 2022
1 parent 34af7e6 commit ddd5e0b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/widget/geo/geopicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Geopicker extends Widget {
* @type {string}
*/
static get selector() {
return ':is(.question input[data-type-xml="geopoint"], .question input[data-type-xml="geotrace"], .question input[data-type-xml="geoshape"]):not([data-setvalue], [data-setgeopoint])';
return '.question [name]:not([name=""], [type="hidden"]):is(input[data-type-xml="geopoint"], input[data-type-xml="geotrace"], input[data-type-xml="geoshape"])';
}

/**
Expand Down
24 changes: 24 additions & 0 deletions test/spec/widget.geo.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,28 @@ describe('geoshape widget', () => {

expect(geopickers.length).to.equal(0);
});

it('loads the widget when a setgeopoint odk-instance-first-load action is defined adjacent to the input', () => {
const form = loadForm('setgeopoint.xml');

form.init();

const widget = form.view.html.querySelector(
'[name="/data/visible_first_load_adjacent_action"] ~ .geopicker'
);

expect(widget).not.to.be.null;
});

it('loads the widget when a setgeopoint odk-instance-first-load action is defined in the model', () => {
const form = loadForm('setgeopoint.xml');

form.init();

const widget = form.view.html.querySelector(
'[name="/data/visible_first_load_model_action"] ~ .geopicker'
);

expect(widget).not.to.be.null;
});
});

0 comments on commit ddd5e0b

Please sign in to comment.