Skip to content

Commit 488be7e

Browse files
committed
updated to work with purescript-web-dom-parser (tests), and Purs 0.13.0
1 parent de01e7a commit 488be7e

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
],
1717
"dependencies": {
1818
"purescript-naturals": "^3.0.0",
19-
"purescript-web-dom": "^2.0.0"
19+
"purescript-web-dom": "^3.0.0"
2020
},
2121
"devDependencies": {
2222
"purescript-test-unit": "^15.0.0",
2323
"purescript-console": "^4.2.0",
24-
"purescript-dom-parser": "bbarker/purescript-dom-parser#9c91afbd752f73b6f33c5c69cb541e3c4c6bf3a9",
24+
"purescript-web-dom-parser": "^6.0.0",
2525
"purescript-debug": "^4.0.0",
2626
"purescript-foreign": "^5.0.0"
2727
}

psc.sh

100644100755
File mode changed.

scripts/testbrowser

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
pulp build --main "Test.Main" --src-path "src" -I "test" \
44
-- --censor-lib && \
5-
parcel --no-hmr --public-url ./ build test/index.html
5+
parcel build --public-url ./ test/index.html

src/Web/DOM/XPath/ResultType.purs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ snap2ResType OrderedSnapshotType = ordered_node_snapshot_type
3232

3333
-- | Inverse of `snap2ResType`.
3434
res2SnapType :: ResultType -> Maybe SnapshotType
35-
res2SnapType unordered_node_snapshot_type = Just UnorderedSnapshotType
36-
res2SnapType ordered_node_snapshot_type = Just OrderedSnapshotType
35+
res2SnapType r | r == unordered_node_snapshot_type = Just UnorderedSnapshotType
36+
res2SnapType r | r == ordered_node_snapshot_type = Just OrderedSnapshotType
3737
res2SnapType _ = Nothing
3838

3939
data IteratorType
@@ -47,6 +47,6 @@ iter2ResType OrderedIteratorType = ordered_node_iterator_type
4747

4848
-- | Inverse of `iter2ResType`.
4949
res2IterType :: ResultType -> Maybe IteratorType
50-
res2IterType unordered_node_iterator_type = Just UnorderedIteratorType
51-
res2IterType ordered_node_iterator_type = Just OrderedIteratorType
50+
res2IterType r | r == unordered_node_iterator_type = Just UnorderedIteratorType
51+
res2IterType r | r == ordered_node_iterator_type = Just OrderedIteratorType
5252
res2IterType _ = Nothing

test/Main.purs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module Test.Main where
33
import Prelude
44

55
import Data.Array ((!!), length)
6+
import Data.Either (fromRight)
67
import Data.Int (toNumber)
78
import Data.Maybe (Maybe(..), fromJust, fromMaybe)
89
import Data.Natural (intToNat)
@@ -27,16 +28,20 @@ import Web.DOM.Element (Element, fromNode, getAttribute)
2728
import Web.DOM.Node (Node, nodeName)
2829

2930
parseAtomFeedDoc :: DOMParser -> Effect Document
30-
parseAtomFeedDoc dp = parseXMLFromString TD.atomFeedXml dp
31+
parseAtomFeedDoc dp = unsafePartial $ map fromRight $
32+
parseXMLFromString TD.atomFeedXml dp
3133

3234
parseCatalogDoc :: DOMParser -> Effect Document
33-
parseCatalogDoc dp = parseXMLFromString TD.cdCatalogXml dp
35+
parseCatalogDoc dp = unsafePartial $ map fromRight $
36+
parseXMLFromString TD.cdCatalogXml dp
3437

3538
parseNoteDoc :: DOMParser -> Effect Document
36-
parseNoteDoc dp = parseXMLFromString TD.noteXml dp
39+
parseNoteDoc dp = unsafePartial $ map fromRight $
40+
parseXMLFromString TD.noteXml dp
3741

3842
parseMetajeloDoc :: DOMParser -> Effect Document
39-
parseMetajeloDoc dp = parseXMLFromString TD.metajeloXml dp
43+
parseMetajeloDoc dp = unsafePartial $ map fromRight $
44+
parseXMLFromString TD.metajeloXml dp
4045

4146
atomResolver :: NSResolver
4247
atomResolver = XP.customNSResolver dummyAtomRes

0 commit comments

Comments
 (0)