Files
edx-platform/common/static/js/capa/spec/jsinput_spec.js
stv bdf90bfcfb Remove superfluous JSInput test
The behavior previously tested here was to check that if a JSInput
element was marked as not processed, re-walking the DOM *should* have
reinitialized it. Unfortunately, this behavior is not supported by the
underlying JSChannel library. In fact, if JSChannel detects an existing
channel with the same origin and scope, it throws an uncaught exception,
leaving the DOM in a "broken" state.

JSInput will prevent duplicates from being added, as long as we don't
manually update the `data-processed` attribute. This behavior is already
being tested.
2014-06-13 11:04:24 -07:00

30 lines
870 B
JavaScript

describe("JSInput", function () {
var sections;
var inputFields;
beforeEach(function () {
loadFixtures('js/capa/fixtures/jsinput.html');
sections = $('section[id^="inputtype_"]');
inputFields = $('input[id^="input_"]');
JSInput.walkDOM();
});
it('sets all data-processed attributes to true on first load', function () {
sections.each(function (index, item) {
expect(item).toHaveData('processed', true);
});
});
it('sets the waitfor attribute to its update function', function () {
inputFields.each(function (index, item) {
expect(item).toHaveAttr('waitfor');
});
});
it('tests the correct number of sections', function () {
expect(sections.length).toEqual(2);
expect(sections.length).toEqual(inputFields.length);
});
});