summaryrefslogtreecommitdiffstatshomepage
path: root/test/attributes/hx-classes.js
diff options
context:
space:
mode:
authorcarson <carson@leaddyno.com>2020-05-17 05:22:19 -0700
committercarson <carson@leaddyno.com>2020-05-17 05:22:19 -0700
commit3aa8c64754c323f367fae64342f4ac9c20ea5a3d (patch)
tree6de764954d60c019fb87359007919bb56f0fe8f1 /test/attributes/hx-classes.js
parente1e4f25b0ef21e96eda192e69ab89e207dd7f617 (diff)
downloadhtmx-3aa8c64754c323f367fae64342f4ac9c20ea5a3d.tar.gz
htmx-3aa8c64754c323f367fae64342f4ac9c20ea5a3d.zip
le big re-rename
Diffstat (limited to 'test/attributes/hx-classes.js')
-rw-r--r--test/attributes/hx-classes.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/attributes/hx-classes.js b/test/attributes/hx-classes.js
new file mode 100644
index 00000000..a138976e
--- /dev/null
+++ b/test/attributes/hx-classes.js
@@ -0,0 +1,32 @@
+describe("hx-classes attribute", function(){
+ beforeEach(function() {
+ this.server = makeServer();
+ clearWorkArea();
+ });
+ afterEach(function() {
+ this.server.restore();
+ clearWorkArea();
+ });
+
+ it('adds classes properly', function(done)
+ {
+ var div = make('<div hx-classes="add c1">Click Me!</div>')
+ should.equal(div.classList.length, 0);
+ setTimeout(function(){
+ should.equal(div.classList.contains("c1"), true);
+ done();
+ }, 100);
+ });
+
+ it('removes classes properly', function(done)
+ {
+ var div = make('<div class="foo bar" hx-classes="remove bar">Click Me!</div>')
+ should.equal(div.classList.contains("foo"), true);
+ should.equal(div.classList.contains("bar"), true);
+ setTimeout(function(){
+ should.equal(div.classList.contains("foo"), true);
+ should.equal(div.classList.contains("bar"), false);
+ done();
+ }, 100);
+ });
+})