UNPKG

@kickscondor/umbrellajs

Version:

Lightweight and intuitive javascript library

28 lines (23 loc) 839 B
// Testing the main file describe(".data(name, value)", function() { it("should be a function", function() { expect(typeof base.data).to.equal('function'); }); it("can add an attribute with two params", function() { base.data('title', 'Hello'); expect(base.data('title')).to.equal('Hello'); base.first().removeAttribute('data-title'); expect(!base.data('title')).to.equal(true); }); it("can add an attribute with an object", function() { base.data({title: 'Hello'}); expect(base.data('title')).to.equal('Hello'); }); it("can read the first element attribute", function() { base.first().setAttribute('data-title', 'Hello'); expect(base.data('title')).to.equal('Hello'); }); it("can be called with no nodes", function() { expect(u('dfsdf').data('title')).to.equal(''); }); });