summaryrefslogtreecommitdiffstatshomepage
path: root/test/attributes/hx-select.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/attributes/hx-select.js')
-rw-r--r--test/attributes/hx-select.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/attributes/hx-select.js b/test/attributes/hx-select.js
new file mode 100644
index 00000000..916571c1
--- /dev/null
+++ b/test/attributes/hx-select.js
@@ -0,0 +1,30 @@
+describe("BOOTSTRAP - htmx AJAX Tests", function(){
+ beforeEach(function() {
+ this.server = makeServer();
+ clearWorkArea();
+ });
+ afterEach(function() {
+ this.server.restore();
+ clearWorkArea();
+ });
+
+ it('properly handles a partial of HTML', function()
+ {
+ var i = 1;
+ this.server.respondWith("GET", "/test", "<div id='d1'>foo</div><div id='d2'>bar</div>");
+ var div = make('<div hx-get="/test" hx-select="#d1"></div>');
+ div.click();
+ this.server.respond();
+ div.innerHTML.should.equal("<div id=\"d1\">foo</div>");
+ });
+
+ it('properly handles a full HTML document', function()
+ {
+ var i = 1;
+ this.server.respondWith("GET", "/test", "<html><body><div id='d1'>foo</div><div id='d2'>bar</div></body></html>");
+ var div = make('<div hx-get="/test" hx-select="#d1"></div>');
+ div.click();
+ this.server.respond();
+ div.innerHTML.should.equal("<div id=\"d1\">foo</div>");
+ });
+})