aboutsummaryrefslogtreecommitdiff
path: root/tests/xmlreader.tests.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-04-10 21:15:12 +0100
committerMichael Williamson <mike@zwobble.org>2013-04-10 21:15:12 +0100
commit4513442e8aae54452f43a1d434a4c16728e77386 (patch)
treed0c5deee61e45510756e369ba0936244e2315c2d /tests/xmlreader.tests.js
parent9a4c6832d7f3cd64744ec525ab763617aa675bad (diff)
Map namespaces of attributes
Diffstat (limited to 'tests/xmlreader.tests.js')
-rw-r--r--tests/xmlreader.tests.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/xmlreader.tests.js b/tests/xmlreader.tests.js
index 7f4ca9d..2eb95c8 100644
--- a/tests/xmlreader.tests.js
+++ b/tests/xmlreader.tests.js
@@ -53,6 +53,16 @@ describe('xmlreader.read', function() {
assert.deepEqual(result.root.name, "x:body");
});
})
+
+ test('namespace of attributes is mapped to prefix', function() {
+ var namespaceMap = {
+ "word": "x"
+ };
+ var xmlString = '<w:body xmlns:w="word" w:val="Hello!"/>';
+ return xmlreader.read(xmlString, namespaceMap).then(function(result) {
+ assert.deepEqual(result.root.attributes["x:val"], "Hello!");
+ });
+ })
test('can find first element with name', function() {
return xmlreader.read('<body><a/><b index="1"/><b index="2"/></body>').then(function(result) {