Sha256: 3c30ea593b5bcdaa5de8c1aa03f593fccd72e5e05d5c75bedbfa44e73e937e45

Contents?: true

Size: 1.5 KB

Versions: 18

Compression:

Stored size: 1.5 KB

Contents

describe("Mod.DOM", function() {
    var dom;

    beforeEach(function() {
        dom = new Mod.DOM;
    });

    it("should have a cache", function() {
        expect(dom.cache).toEqual({});
    });

    it("should have an is_ready property", function() {
        expect(is_bool(dom.is_ready)).toBeTruthy();
    });

    it("should add an element to the cache", function() {
        dom.add_element('foo', document.getElementById('body'));
        expect(dom.cache.foo).toEqual(document.getElementById('body'));
    });

    it("should add a hash of elements to the cache", function() {
        dom.add_elements({
            bar: document.getElementsByTagName('html')[0],
            baz: document.getElementsByTagName('head')[0]
        });

        expect(dom.cache.bar).toEqual(document.getElementsByTagName('html')[0]);
        expect(dom.cache.baz).toEqual(document.getElementsByTagName('head')[0]);
    });

    it("should have an add_event method", function() {
        expect(dom.add_event).toBeTruthy();
    });

    it("should have a remove_event method", function() {
        expect(dom.remove_event).toBeTruthy();
    });

    it("should have a call_when_ready method", function() {
        dom.call_when_ready(function() {
            var body = document.getElementsByTagName('body')[0],
                h1 = document.createElement('h1');

                h1.setAttribute('id', 'foo');
                body.appendChild(h1);
                expect(document.getElementById('foo')).toBeTruthy();
        });
    });
});

Version data entries

18 entries across 15 versions & 1 rubygems

Version Path
modjs-architecture-0.4.0 spec/javascripts/dom_spec.js
modjs-architecture-0.3.5 spec/javascripts/dom_spec.js
modjs-architecture-0.3.3 spec/tmp/spec/dom_spec.js
modjs-architecture-0.3.3 spec/javascripts/dom_spec.js
modjs-architecture-0.3.2 spec/javascripts/dom_spec.js
modjs-architecture-0.3.2 spec/tmp/spec/dom_spec.js
modjs-architecture-0.3.1 spec/tmp/spec/dom_spec.js
modjs-architecture-0.3.1 spec/javascripts/dom_spec.js
modjs-architecture-0.3.0 spec/javascripts/dom_spec.js
modjs-architecture-0.2.1 spec/javascripts/dom_spec.js
modjs-architecture-0.2.0 spec/javascripts/dom_spec.js
modjs-architecture-0.1.6 spec/javascripts/dom_spec.js
modjs-architecture-0.1.5 spec/javascripts/dom_spec.js
modjs-architecture-0.1.4 spec/javascripts/dom_spec.js
modjs-architecture-0.1.3 spec/javascripts/dom_spec.js
modjs-architecture-0.1.2 spec/javascripts/dom_spec.js
modjs-architecture-0.1.1 spec/javascripts/dom_spec.js
modjs-architecture-0.1.0 spec/javascripts/dom_spec.js