зеркало из https://github.com/twbs/bootlint.git
Коммит
f0167d775c
|
@ -381,6 +381,12 @@ var cheerio = require('cheerio');
|
|||
return "`.panel-title` must have a `.panel-heading` parent";
|
||||
}
|
||||
};
|
||||
exports.lintTableResponsive = function ($) {
|
||||
var badStructure = $('.table.table-responsive,table.table-responsive');
|
||||
if (badStructure.length) {
|
||||
return "`.table-responsive` is supposed to be used on the table's parent wrapper <div>, not on the table itself";
|
||||
}
|
||||
};
|
||||
|
||||
exports._lint = function ($) {
|
||||
var errs = [];
|
||||
|
@ -414,6 +420,7 @@ var cheerio = require('cheerio');
|
|||
errs.push(this.lintPanelHeadingWithoutPanel($));
|
||||
errs.push(this.lintPanelTitleWithoutPanelHeading($));
|
||||
errs.push(this.lintPanelFooterWithoutPanel($));
|
||||
errs.push(this.lintTableResponsive($));
|
||||
errs = errs.concat(this.lintInputGroupFormControlTypes($));
|
||||
errs = errs.concat(this.lintInlineCheckboxes($));
|
||||
errs = errs.concat(this.lintInlineRadios($));
|
||||
|
|
|
@ -361,5 +361,18 @@ exports['bootlint'] = {
|
|||
'should complain when columns are outside of rows and form groups.'
|
||||
);
|
||||
test.done();
|
||||
},
|
||||
|
||||
'.table-responsive on the table itself': function (test) {
|
||||
test.expect(2);
|
||||
test.deepEqual(bootlint.lintHtml(utf8Fixture('table/responsive-valid.html')),
|
||||
[],
|
||||
'should not complain when .table-responsive is used on the table\'s wrapper div.'
|
||||
);
|
||||
test.deepEqual(bootlint.lintHtml(utf8Fixture('table/responsive-incorrect.html')),
|
||||
["`.table-responsive` is supposed to be used on the table's parent wrapper <div>, not on the table itself"],
|
||||
'should complain when .table-responsive is used on the table itself.'
|
||||
);
|
||||
test.done();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Test</title>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<script src="../../lib/jquery.min.js"></script>
|
||||
|
||||
<link rel="stylesheet" href="../../lib/qunit-1.14.0.css">
|
||||
<script src="../../lib/qunit-1.14.0.js"></script>
|
||||
<script src="../../../dist/browser/bootlint.js"></script>
|
||||
<script src="../generic-qunit.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<table class="table table-responsive">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Cell</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div id="qunit"></div>
|
||||
<ol id="bootlint">
|
||||
<li data-lint="`.table-responsive` is supposed to be used on the table's parent wrapper <div>, not on the table itself"></li>
|
||||
</ol>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Test</title>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<script src="../../lib/jquery.min.js"></script>
|
||||
|
||||
<link rel="stylesheet" href="../../lib/qunit-1.14.0.css">
|
||||
<script src="../../lib/qunit-1.14.0.js"></script>
|
||||
<script src="../../../dist/browser/bootlint.js"></script>
|
||||
<script src="../generic-qunit.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Cell</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="qunit"></div>
|
||||
<ol id="bootlint"></ol>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче