diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/util_stanza_spec.lua | 4 | ||||
-rw-r--r-- | spec/util_xtemplate_spec.lua | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/spec/util_stanza_spec.lua b/spec/util_stanza_spec.lua index e11c70dd..cabb27bf 100644 --- a/spec/util_stanza_spec.lua +++ b/spec/util_stanza_spec.lua @@ -577,5 +577,9 @@ describe("util.stanza", function() assert.equal("text", s:find("{urn:example:not:same}child/nested#"), "finds nested text") assert.is_nil(s:find("child"), "respects namespaces") end); + it("handles namespaced attributes", function() + local s = st.stanza("root", { ["urn:example:namespace\1attr"] = "value" }, { e = "urn:example:namespace" }); + assert.equal("value", s:find("@e:attr"), "finds prefixed attr") + end) end); end); diff --git a/spec/util_xtemplate_spec.lua b/spec/util_xtemplate_spec.lua index 421be43f..3b0ecaa9 100644 --- a/spec/util_xtemplate_spec.lua +++ b/spec/util_xtemplate_spec.lua @@ -10,7 +10,7 @@ describe("util.xtemplate", function () end) it("supports conditionals", function () local atom_tmpl = "{@pubsub:title|and{*{@pubsub:title}*\n\n}}{summary|or{{author/name|and{{author/name} posted }}{title}}}"; - local atom_data = st.stanza("entry", { xmlns = "http://www.w3.org/2005/Atom" }); + local atom_data = st.stanza("entry", { xmlns = "http://www.w3.org/2005/Atom" }, {["pubsub"] = "http://jabber.org/protocol/pubsub"}); assert.same("", xtemplate.render(atom_tmpl, atom_data)); atom_data:text_tag("title", "an Entry") @@ -22,8 +22,7 @@ describe("util.xtemplate", function () atom_data:text_tag("summary", "Juliet just posted a new entry"); assert.same("Juliet just posted a new entry", xtemplate.render(atom_tmpl, atom_data)); - atom_data.attr["xmlns:pubsub"] = "http://jabber.org/protocol/pubsub"; - atom_data.attr["pubsub:title"] = "Juliets musings"; + atom_data.attr["http://jabber.org/protocol/pubsub\1title"] = "Juliets musings"; assert.same("*Juliets musings*\n\nJuliet just posted a new entry", xtemplate.render(atom_tmpl, atom_data)); end) it("can strip surrounding whitespace", function () |