jsinput_spec.js 870 Bytes
Newer Older
stv committed
1 2 3 4
describe("JSInput", function () {
    var sections;
    var inputFields;

5
    beforeEach(function () {
6
        loadFixtures('js/capa/fixtures/jsinput.html');
stv committed
7 8 9
        sections = $('section[id^="inputtype_"]');
        inputFields = $('input[id^="input_"]');
        JSInput.walkDOM();
10 11
    });

stv committed
12 13 14
    it('sets all data-processed attributes to true on first load', function () {
        sections.each(function (index, item) {
            expect(item).toHaveData('processed', true);
15 16 17
        });
    });

stv committed
18 19 20
    it('sets the waitfor attribute to its update function', function () {
        inputFields.each(function (index, item) {
            expect(item).toHaveAttr('waitfor');
21
        });
22
    });
stv committed
23 24 25 26 27

    it('tests the correct number of sections', function () {
        expect(sections.length).toEqual(2);
        expect(sections.length).toEqual(inputFields.length);
    });
28
});
stv committed
29