Skip to content

Commit

Permalink
🚧 Add example test that's not working
Browse files Browse the repository at this point in the history
  • Loading branch information
cooperka committed Feb 21, 2019
1 parent fe840f6 commit 9d8f637
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
22 changes: 22 additions & 0 deletions resources/org/javarosa/xform/parse/last-saved-filled.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<h:html
xmlns:h="http://www.w3.org/1999/xhtml"
xmlns="http://www.w3.org/2002/xforms">

<h:head>
<h:title>Form with last-saved instance (filled)</h:title>
<model>
<instance>
<data>
<item>Foo</item>
</data>
</instance>
<instance id="last-saved" src="jr://instance/last-saved"/>
<bind nodeset="/data/item" type="string"/>
<setvalue event="xforms-ready" ref="/data/item" value="instance('last-saved')/data/item"/>
</model>
</h:head>

<h:body>
</h:body>

</h:html>
10 changes: 10 additions & 0 deletions test/org/javarosa/xform/parse/XFormParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,16 @@ public void parsesPreloadForm() throws IOException {
assertEquals("Form with last-saved instance (blank)", formDef.getTitle());
}

@Test public void parsesLastSavedInstanceWithFilledForm() throws IOException {
Path formName = r("last-saved-blank.xml");

// TODO: How to get lastSavedSrc for tests?
FormDef formDef = parse(formName, "jr://file/" + r("last-saved-filled.xml").toString());
assertEquals("Form with last-saved instance (blank)", formDef.getTitle());

// TODO: Validate that /data/item is 'Foo'.
}

@Test public void parsesExternalSecondaryInstanceForm() throws IOException, XPathSyntaxException {
Path formName = EXTERNAL_SECONDARY_INSTANCE_XML;
mapFileToResourcePath(formName);
Expand Down

0 comments on commit 9d8f637

Please sign in to comment.