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

Commit b378184

Browse files
HerstXhmikosR
authored andcommitted
Adapt to table changes (#455)
Port E027
1 parent ed671b3 commit b378184

File tree

4 files changed

+45
-9
lines changed

4 files changed

+45
-9
lines changed

src/bootlint.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -824,14 +824,22 @@ var LocationIndex = _location.LocationIndex;
824824
reporter('`.card-title` must have a `.card` ancestor.', badCardTitle);
825825
}
826826
});
827-
/*
828827
addLinter('E027', function lintTableResponsive($, reporter) {
829-
var badStructure = $('.table.table-responsive, table.table-responsive');
828+
829+
var tableSelectors = ['.table', 'table'];
830+
var badStructureSelectors = [];
831+
832+
for (var i = 0; i < tableSelectors.length; i++) {
833+
for (var j = 0; j < NUM2SCREEN.length; j++) {
834+
badStructureSelectors.push(tableSelectors[i] + '.table-responsive-' + NUM2SCREEN[j]);
835+
}
836+
}
837+
838+
var badStructure = $(badStructureSelectors.join(','));
830839
if (badStructure.length) {
831-
reporter('`.table-responsive` is supposed to be used on the table\'s parent wrapper `<div>`, not on the table itself', badStructure);
840+
reporter('`.table-responsive*` is supposed to be used on the table\'s parent wrapper `<div>`, not on the table itself', badStructure);
832841
}
833842
});
834-
*/
835843
/*
836844
addLinter('E028', function lintFormControlFeedbackWithoutHasFeedback($, reporter) {
837845
var ancestorsMissingClasses = $('.form-control-feedback').filter(function () {

test/bootlint_test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,20 +428,18 @@ exports.bootlint = {
428428
);
429429
test.done();
430430
},
431-
/*
432431
'.table-responsive on the table itself': function (test) {
433432
test.expect(2);
434433
test.deepEqual(lintHtml(utf8Fixture('table/responsive-valid.html')),
435434
[],
436435
'should not complain when .table-responsive is used on the table\'s wrapper div.'
437436
);
438437
test.deepEqual(lintHtml(utf8Fixture('table/responsive-incorrect.html')),
439-
['`.table-responsive` is supposed to be used on the table\'s parent wrapper `<div>`, not on the table itself'],
438+
['`.table-responsive*` is supposed to be used on the table\'s parent wrapper `<div>`, not on the table itself'],
440439
'should complain when .table-responsive is used on the table itself.'
441440
);
442441
test.done();
443442
},
444-
*/
445443
'redundant grid column classes': function (test) {
446444
test.expect(2);
447445
test.deepEqual(lintHtml(utf8Fixture('grid/cols-not-redundant.html')),

test/_old_fixtures/table/responsive-incorrect.html renamed to test/fixtures/table/responsive-incorrect.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<script src="../generic-qunit.js"></script>
1818
</head>
1919
<body>
20-
<table class="table table-responsive">
20+
<table class="table table-responsive-xl">
2121
<tbody>
2222
<tr>
2323
<td>Cell</td>
@@ -27,7 +27,7 @@
2727

2828
<div id="qunit"></div>
2929
<ol id="bootlint">
30-
<li data-lint="`.table-responsive` is supposed to be used on the table's parent wrapper `<div>`, not on the table itself"></li>
30+
<li data-lint="`.table-responsive*` is supposed to be used on the table's parent wrapper `<div>`, not on the table itself"></li>
3131
</ol>
3232
</body>
3333
</html>

test/_old_fixtures/table/responsive-valid.html renamed to test/fixtures/table/responsive-valid.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,36 @@
2727
</table>
2828
</div>
2929

30+
<div class="table-responsive-sm">
31+
<table class="table">
32+
<tbody>
33+
<tr>
34+
<td>Cell</td>
35+
</tr>
36+
</tbody>
37+
</table>
38+
</div>
39+
40+
<div class="table-responsive-md">
41+
<table class="table">
42+
<tbody>
43+
<tr>
44+
<td>Cell</td>
45+
</tr>
46+
</tbody>
47+
</table>
48+
</div>
49+
50+
<div class="table-responsive-lg">
51+
<table class="table">
52+
<tbody>
53+
<tr>
54+
<td>Cell</td>
55+
</tr>
56+
</tbody>
57+
</table>
58+
</div>
59+
3060
<div id="qunit"></div>
3161
<ol id="bootlint"></ol>
3262
</body>

0 commit comments

Comments
 (0)