Skip to content
This repository was archived by the owner on Feb 1, 2022. It is now read-only.

Commit 7651df0

Browse files
committed
Adapt for input group changes
E006, E010, E015 removed E009, E011, E012 ported
1 parent dd8c5f2 commit 7651df0

File tree

2 files changed

+12
-81
lines changed

2 files changed

+12
-81
lines changed

src/bootlint.js

+6-37
Original file line numberDiff line numberDiff line change
@@ -720,34 +720,21 @@ var LocationIndex = _location.LocationIndex;
720720
addLinter('E009', function lintMissingInputGroupSizes($, reporter) {
721721
var selector = [
722722
'.input-group:not(.input-group-lg) .btn-lg',
723-
'.input-group:not(.input-group-lg) .input-lg',
723+
'.input-group:not(.input-group-lg) .form-control-lg',
724724
'.input-group:not(.input-group-sm) .btn-sm',
725-
'.input-group:not(.input-group-sm) .input-sm'
725+
'.input-group:not(.input-group-sm) .form-control-sm'
726726
].join(',');
727727
var badInputGroupSizing = $(selector);
728728
if (badInputGroupSizing.length) {
729729
reporter('Button and input sizing within `.input-group`s can cause issues. Instead, use input group sizing classes `.input-group-lg` or `.input-group-sm`', badInputGroupSizing);
730730
}
731731
});
732-
*/
733-
/*
734-
addLinter('E010', function lintMultipleFormControlsInInputGroup($, reporter) {
735-
var badInputGroups = $('.input-group').filter(function (i, inputGroup) {
736-
return $(inputGroup).find('.form-control').length > 1;
737-
});
738-
if (badInputGroups.length) {
739-
reporter('Input groups cannot contain multiple `.form-control`s', badInputGroups);
740-
}
741-
});
742-
*/
743-
/*
744732
addLinter('E011', function lintFormGroupMixedWithInputGroup($, reporter) {
745-
var badMixes = $('.input-group.form-group');
733+
var badMixes = $('.input-group.form-group, .input-group.row, .input-group.form-row');
746734
if (badMixes.length) {
747-
reporter('`.input-group` and `.form-group` cannot be used directly on the same element. Instead, nest the `.input-group` within the `.form-group`', badMixes);
735+
reporter('`.input-group` and `.form-group`/`.row`/`.form-row` cannot be used directly on the same element. Instead, nest the `.input-group` within the `.form-group`/`.row`/`.form-row`', badMixes);
748736
}
749737
});
750-
*/
751738
addLinter('E012', function lintGridClassMixedWithInputGroup($, reporter) {
752739
var selector = COL_CLASSES.map(function (colClass) {
753740
return '.input-group' + colClass;
@@ -781,22 +768,6 @@ var LocationIndex = _location.LocationIndex;
781768
}
782769
});
783770
/*
784-
addLinter('E015', function lintInputGroupsWithMultipleAddOnsPerSide($, reporter) {
785-
var addOnClasses = ['.input-group-addon', '.input-group-btn'];
786-
var combos = [];
787-
addOnClasses.forEach(function (first) {
788-
addOnClasses.forEach(function (second) {
789-
combos.push('.input-group>' + first + '+' + second);
790-
});
791-
});
792-
var selector = combos.join(',');
793-
var multipleAddOns = $(selector);
794-
if (multipleAddOns.length) {
795-
reporter('Having multiple add-ons on a single side of an input group is not supported', multipleAddOns);
796-
}
797-
});
798-
*/
799-
/*
800771
addLinter('E016', function lintBtnToggle($, reporter) {
801772
var badBtnToggle = $('.btn.dropdown-toggle ~ .btn');
802773
if (badBtnToggle.length) {
@@ -1147,17 +1118,15 @@ var LocationIndex = _location.LocationIndex;
11471118
}
11481119
});
11491120
*/
1150-
/*
11511121
addLinter('E044', function lintInputGroupAddonChildren($, reporter) {
11521122
var badInputGroups = $('.input-group').filter(function () {
11531123
var inputGroup = $(this);
1154-
return !inputGroup.children('.form-control').length || !inputGroup.children('.input-group-addon, .input-group-btn').length;
1124+
return !inputGroup.children('.form-control').length || !inputGroup.children('.input-group-prepend, .input-group-append').length;
11551125
});
11561126
if (badInputGroups.length) {
1157-
reporter('`.input-group` must have a `.form-control` and either an `.input-group-addon` or an `.input-group-btn`.', badInputGroups);
1127+
reporter('`.input-group` must have a `.form-control` and either an `.input-group-prepend` or `.input-group-append`.', badInputGroups);
11581128
}
11591129
});
1160-
*/
11611130
/*
11621131
addLinter('E045', function lintImgResponsiveOnNonImgs($, reporter) {
11631132
var imgResponsiveNotOnImg = $('.img-responsive:not(img)');

test/bootlint_test.js

+6-44
Original file line numberDiff line numberDiff line change
@@ -271,54 +271,37 @@ exports.bootlint = {
271271
test.done();
272272
},
273273
*/
274-
/*
275274
'btn/input sizing used without input-group-* size': function (test) {
276275
test.expect(1);
277276
test.deepEqual(lintHtml(utf8Fixture('input-group/missing-input-group-sizing.html')),
278277
['Button and input sizing within `.input-group`s can cause issues. Instead, use input group sizing classes `.input-group-lg` or `.input-group-sm`'],
279278
'should complain when an input/btn sizes are used within input-group.');
280279
test.done();
281280
},
282-
*/
283-
/*
284-
'input groups with multiple form controls': function (test) {
285-
test.expect(1);
286-
test.deepEqual(lintHtml(utf8Fixture('input-group/multiple-form-controls.html')),
287-
['Input groups cannot contain multiple `.form-control`s'],
288-
'should complain when an input group contains multiple form controls.');
289-
test.done();
290-
},
291-
*/
292-
/*
293281
'mixing input groups with form groups': function (test) {
294282
test.expect(1);
295283
test.deepEqual(lintHtml(utf8Fixture('input-group/mixed-with-form-group.html')),
296-
['`.input-group` and `.form-group` cannot be used directly on the same element. Instead, nest the `.input-group` within the `.form-group`'],
297-
'should complain when .input-group and .form-group are used on the same element.');
284+
['`.input-group` and `.form-group`/`.row`/`.form-row` cannot be used directly on the same element. Instead, nest the `.input-group` within the `.form-group`/`.row`/`.form-row`'],
285+
'should complain when .input-group and .form-group/.row/.form-row are used on the same element.');
298286
test.done();
299287
},
300-
*/
301-
/*
302288
'mixing input groups with grid columns': function (test) {
303289
test.expect(1);
304290
test.deepEqual(lintHtml(utf8Fixture('input-group/mixed-with-grid-col.html')),
305-
['`.input-group` and `.col-*-*` cannot be used directly on the same element. Instead, nest the `.input-group` within the `.col-*-*`'],
291+
['`.input-group` and `.col*` cannot be used directly on the same element. Instead, nest the `.input-group` within the `.col*`'],
306292
'should complain when an input group has a grid column class on it.');
307293
test.done();
308294
},
309-
*/
310-
/*
311295
'input groups missing controls and addons': function (test) {
312296
test.expect(2);
313297
test.deepEqual(lintHtml(utf8Fixture('input-group/missing-input-group-addon.html')),
314-
['`.input-group` must have a `.form-control` and either an `.input-group-addon` or an `.input-group-btn`.'],
298+
['`.input-group` must have a `.form-control` and either an `.input-group-prepend` or `.input-group-append`.'],
315299
'should complain when missing missing a `.form-control`');
316300
test.deepEqual(lintHtml(utf8Fixture('input-group/missing-form-control.html')),
317-
['`.input-group` must have a `.form-control` and either an `.input-group-addon` or an `.input-group-btn`.'],
318-
'should complain when missing missing a `.input-group-addon`');
301+
['`.input-group` must have a `.form-control` and either an `.input-group-prepend` or `.input-group-append`.'],
302+
'should complain when missing missing a `.input-group-prepend`');
319303
test.done();
320304
},
321-
*/
322305
'non-column children of rows': function (test) {
323306
test.expect(2);
324307
test.deepEqual(lintHtml(utf8Fixture('grid/non-col-row-children.html')),
@@ -330,27 +313,6 @@ exports.bootlint = {
330313
test.done();
331314
},
332315
/*
333-
'multiple columns on the same side of an input group': function (test) {
334-
test.expect(5);
335-
test.deepEqual(lintHtml(utf8Fixture('input-group/multiple-add-on-left.html')),
336-
['Having multiple add-ons on a single side of an input group is not supported'],
337-
'should complain when multiple normal add-ons are on the left side of an input group.');
338-
test.deepEqual(lintHtml(utf8Fixture('input-group/multiple-add-on-right.html')),
339-
['Having multiple add-ons on a single side of an input group is not supported'],
340-
'should complain when multiple normal add-ons are on the right side of an input group.');
341-
test.deepEqual(lintHtml(utf8Fixture('input-group/multiple-btn-add-on-left.html')),
342-
['Having multiple add-ons on a single side of an input group is not supported'],
343-
'should complain when multiple button add-ons are on the left side of an input group.');
344-
test.deepEqual(lintHtml(utf8Fixture('input-group/multiple-btn-add-on-right.html')),
345-
['Having multiple add-ons on a single side of an input group is not supported'],
346-
'should complain when multiple button add-ons are on the right side of an input group.');
347-
test.deepEqual(lintHtml(utf8Fixture('input-group/multiple-mixed-add-on-left.html')),
348-
['Having multiple add-ons on a single side of an input group is not supported'],
349-
'should complain when both a normal add-on and a button add-on are on the left side of an input group.');
350-
test.done();
351-
},
352-
*/
353-
/*
354316
'dropdown-toggle comes before btn': function (test) {
355317
test.expect(2);
356318
test.deepEqual(lintHtml(utf8Fixture('buttons/btn-toggle.html')),

0 commit comments

Comments
 (0)