Skip to content

Commit

Permalink
Merge pull request #245 from getodk/refactor/xpath/opaque-dom-adapter
Browse files Browse the repository at this point in the history
XPath support for external secondary instances
  • Loading branch information
eyelidlessness authored Nov 19, 2024
2 parents 9d83384 + e636a9c commit 5a26434
Show file tree
Hide file tree
Showing 193 changed files with 7,032 additions and 2,864 deletions.
8 changes: 8 additions & 0 deletions .changeset/two-actors-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@getodk/xforms-engine': minor
'@getodk/xpath': minor
'@getodk/scenario': patch
'@getodk/common': patch
---

XPath support for evaluation of arbitrary DOM implementations (XPathDOMAdapter)
35 changes: 32 additions & 3 deletions packages/common/src/constants/xmlns.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,60 @@
// Native/common standards
export const XHTML_NAMESPACE_URI = 'http://www.w3.org/1999/xhtml';
export type XHTML_NAMESPACE_URI = typeof XHTML_NAMESPACE_URI;

export const HTML_NAMESPACE_URI = XHTML_NAMESPACE_URI;
export type HTML_NAMESPACE_URI = typeof HTML_NAMESPACE_URI;

export const XML_NAMESPACE_URI = 'http://www.w3.org/XML/1998/namespace';
export type XML_NAMESPACE_URI = typeof XML_NAMESPACE_URI;

export const XMLNS_NAMESPACE_URI = 'http://www.w3.org/2000/xmlns/';
export type XMLNS_NAMESPACE_URI = typeof XMLNS_NAMESPACE_URI;

export const FN_NAMESPACE_URI = 'http://www.w3.org/2005/xpath-functions';
export type FN_NAMESPACE_URI = typeof FN_NAMESPACE_URI;

// XForms/ODK
export const JAVAROSA_NAMESPACE_URI = 'http://openrosa.org/javarosa';
export type JAVAROSA_NAMESPACE_URI = typeof JAVAROSA_NAMESPACE_URI;

export const ODK_NAMESPACE_URI = 'http://www.opendatakit.org/xforms';
export type ODK_NAMESPACE_URI = typeof ODK_NAMESPACE_URI;

export const OPENROSA_XFORMS_NAMESPACE_URI = 'http://openrosa.org/xforms';
export const XFORMS_NAMESPACE_URI = 'http://www.w3.org/2002/xforms';
export type OPENROSA_XFORMS_NAMESPACE_URI = typeof OPENROSA_XFORMS_NAMESPACE_URI;

export type JavaRosaNamespaceURI = typeof JAVAROSA_NAMESPACE_URI;
export type XFormsNamespaceURI = typeof XFORMS_NAMESPACE_URI;
export const XFORMS_NAMESPACE_URI = 'http://www.w3.org/2002/xforms';
export type XFORMS_NAMESPACE_URI = typeof XFORMS_NAMESPACE_URI;

// Enketo
export const ENKETO_NAMESPACE_URI = 'http://enketo.org/xforms';
export type ENKETO_NAMESPACE_URI = typeof ENKETO_NAMESPACE_URI;

// Default prefixes
export const HTML_PREFIX = 'h';
export type HTML_PREFIX = typeof HTML_PREFIX;

export const XML_PREFIX = 'xml';
export type XML_PREFIX = typeof XML_PREFIX;

export const XMLNS_PREFIX = 'xmlns';
export type XMLNS_PREFIX = typeof XMLNS_PREFIX;

export const FN_PREFIX = 'fn';
export type FN_PREFIX = typeof FN_PREFIX;

export const JAVAROSA_PREFIX = 'jr';
export type JAVAROSA_PREFIX = typeof JAVAROSA_PREFIX;

export const ODK_PREFIX = 'odk';
export type ODK_PREFIX = typeof ODK_PREFIX;

export const OPENROSA_XFORMS_PREFIX = 'orx';
export type OPENROSA_XFORMS_PREFIX = typeof OPENROSA_XFORMS_PREFIX;

export const XFORMS_PREFIX = 'xf';
export type XFORMS_PREFIX = typeof XFORMS_PREFIX;

export const ENKETO_PREFIX = 'enk';
export type ENKETO_PREFIX = typeof ENKETO_PREFIX;
5 changes: 0 additions & 5 deletions packages/common/types/collections/IterableReadonlyTuple.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/scenario/test/actions-events.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ describe('Actions/Events', () => {
// expectedException.expectMessage("An action was registered for unsupported events: odk-inftance-first-load, my-fake-event");

const init = async () => {
return Scenario.init('invalid-events.xml');
await Scenario.init('invalid-events.xml');
};

await expect(init).rejects.toThrowError(
Expand Down
4 changes: 2 additions & 2 deletions packages/scenario/test/form-definition-validity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ describe('TriggerableDagTest.java', () => {
* Same notes as previous (then surprising) failure of cycle detecction.
* At least we have a pattern!
*/
it.fails('should fail', async () => {
it('should fail', async () => {
// exceptionRule.expect(XFormParseException.class);
// exceptionRule.expectMessage("Cycle detected in form's relevant and calculation logic!");

Expand Down Expand Up @@ -645,7 +645,7 @@ describe('TriggerableDagTest.java', () => {
* Same notes as previous (then surprising) failure of cycle detecction.
* At least we have a pattern!
*/
it.fails('should fail', async () => {
it('should fail', async () => {
// exceptionRule.expect(XFormParseException.class);
// exceptionRule.expectMessage("Cycle detected in form's relevant and calculation logic!");

Expand Down
2 changes: 1 addition & 1 deletion packages/scenario/test/secondary-instances.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ describe('Secondary instances', () => {
configureReferenceManagerCorrectly();

const init = async () => {
return Scenario.init(
await Scenario.init(
'Some form',
html(
head(
Expand Down
Loading

0 comments on commit 5a26434

Please sign in to comment.