Skip to content

Commit a601b23

Browse files
committed
added another required element testcase
1 parent cb42896 commit a601b23

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

test/setup.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,13 @@
165165
'<option value="">Select an option...</option>' +
166166
'<option value="a">A</option>' +
167167
'</select>', {});
168-
form = test.$select.wrap("<form>").parent();
168+
test.$select.parent().children().wrapAll("<form>");
169+
form = test.$select.parent();
169170
form.append("<button>");
171+
form.on('submit', function(event){
172+
event.preventDefault();
173+
assert.ok(false, 'the form was submitted');
174+
});
170175
});
171176
it('should have isRequired property set to true', function() {
172177
expect(test.selectize.isRequired).to.be.equal(true);
@@ -189,6 +194,14 @@
189194
test.selectize.addItem('a');
190195
expect(test.selectize.$control.hasClass('invalid')).to.be.equal(false);
191196
});
197+
it('should pass validation if an element is selected', function(done){
198+
test.selectize.addItem('a');
199+
form.off('submit').on('submit', function(event){
200+
event.preventDefault();
201+
done();
202+
});
203+
$("form button").click();
204+
});
192205
after(function(){
193206
test.teardown();
194207
form.remove();

0 commit comments

Comments
 (0)