From e2cab190847706f19de181c0eedf9cfcb559fad6 Mon Sep 17 00:00:00 2001 From: stv Date: Wed, 4 Jun 2014 17:56:10 -0700 Subject: [PATCH] Ensure JSInput tests actually run This test currently fails, meaning that the existing tests weren't testing what they claimed. Assertions are made for each element returned by the CSS selectors. However, the selectors are assumed to be wildcard matches, but are actually literal selectors. As there are no matched elements, this causes the assertions to be (silently) checked zero times, without failure. --- common/static/js/capa/spec/jsinput_spec.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/common/static/js/capa/spec/jsinput_spec.js b/common/static/js/capa/spec/jsinput_spec.js index b857972fb4..fb043e1631 100644 --- a/common/static/js/capa/spec/jsinput_spec.js +++ b/common/static/js/capa/spec/jsinput_spec.js @@ -27,4 +27,12 @@ describe("JSInput", function() { expect(inputField.data('waitfor')).toBeDefined(); }); }); + + it('tests the correct number of sections', function () { + var sections = $(document).find('section[id="inputtype_"]'); + var inputFields = $(document).find('input[id="input_"]'); + expect(sections.length).toEqual(2); + expect(sections.length).toEqual(inputFields.length); + }); }); +