mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-09-13 05:13:33 -06:00
Initial commit
This commit is contained in:
23
node_modules/normalize-selector/test/mocha/browser-suite.html
generated
vendored
Normal file
23
node_modules/normalize-selector/test/mocha/browser-suite.html
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>mocha browser-suite: normalize-selector</title>
|
||||
<link rel="stylesheet" href="../../node_modules/mocha/mocha.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="mocha"></div>
|
||||
<script src="../../lib/normalize-selector.js"></script>
|
||||
<script src="../../node_modules/assertik/assertik.js"></script>
|
||||
<script src="../../node_modules/mocha/mocha.js"></script>
|
||||
<script>mocha.setup('qunit')</script>
|
||||
|
||||
<!-- get tests and start -->
|
||||
<script src="./suite.js"></script>
|
||||
<script>
|
||||
mocha.checkLeaks();
|
||||
mocha.globals(['boilerplate']); // watch our boilerplate function
|
||||
mocha.run();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
18
node_modules/normalize-selector/test/mocha/node-suite.js
generated
vendored
Normal file
18
node_modules/normalize-selector/test/mocha/node-suite.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// test/mocha/node-suite.js
|
||||
|
||||
// This runs with mocha programmatically rather than from the command line.
|
||||
// how-to-with-comments taken from https://github.com/itaylor/qunit-mocha-ui
|
||||
|
||||
//Load mocha
|
||||
var Mocha = require("mocha");
|
||||
|
||||
//Tell mocha to use the interface.
|
||||
var mocha = new Mocha({ui:"qunit", reporter:"spec"});
|
||||
|
||||
//Add your test files
|
||||
mocha.addFile("./test/mocha/suite.js");
|
||||
|
||||
//Run your tests
|
||||
mocha.run(function(failures){
|
||||
process.exit(failures);
|
||||
});
|
117
node_modules/normalize-selector/test/mocha/suite.js
generated
vendored
Normal file
117
node_modules/normalize-selector/test/mocha/suite.js
generated
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
// mocha/suite.js for normalize-selector.js
|
||||
|
||||
var normalizeSelector;
|
||||
var assert;
|
||||
|
||||
if (typeof require == 'function') {
|
||||
// enable to re-use in a browser without require.js
|
||||
normalizeSelector = require('../../lib/normalize-selector.js');
|
||||
assert = require('assertik');
|
||||
} else {
|
||||
assert = window.assertik;
|
||||
}
|
||||
|
||||
suite('normalizeSelector');
|
||||
|
||||
test('should be function', function () {
|
||||
assert.equal(typeof normalizeSelector, 'function', 'wrong type');
|
||||
});
|
||||
|
||||
test('should normalize BIG SELECTOR', function () {
|
||||
var selector = "*~*>*.foo[ href *= \"/\" ]:hover>*[ data-foo = " +
|
||||
"\"bar\" ]:focus+*.baz::after";
|
||||
var expected = "* ~ * > *.foo[href*=\"/\"]:hover > *[data-foo=\"bar\"]:" +
|
||||
"focus + *.baz::after";
|
||||
assert.equal(normalizeSelector(selector), expected);
|
||||
});
|
||||
|
||||
test('should return optimized selector with no change', function () {
|
||||
assert.equal(normalizeSelector("#foo .bar"), "#foo .bar");
|
||||
});
|
||||
|
||||
test('should trim whitespace', function () {
|
||||
assert.equal(normalizeSelector(" #foo .bar "), "#foo .bar");
|
||||
});
|
||||
|
||||
test('should separate between combinators', function () {
|
||||
assert.equal(normalizeSelector("#foo>.bar+.baz"), "#foo > .bar + .baz");
|
||||
});
|
||||
|
||||
test('should not separate concatenated classes', function () {
|
||||
assert.equal(normalizeSelector("#foo.bar.baz"), "#foo.bar.baz");
|
||||
});
|
||||
|
||||
test('should normalize asterisks', function () {
|
||||
var selector = " *.class[ data * = 'data' ] ";
|
||||
assert.equal(normalizeSelector(selector), "*.class[data*='data']");
|
||||
});
|
||||
|
||||
test('should remove comments', function () {
|
||||
assert.equal(normalizeSelector(".e1 /* c2 */ .e2"), ".e1 .e2");
|
||||
assert.equal(normalizeSelector(" /*c1*/ .e1/*c2*/.e2 /*c3*/ .e3 /*c4*/ "), ".e1 .e2 .e3");
|
||||
assert.equal(normalizeSelector(" /*c1*/ .e1/*c2*/.e2 /*c3*/ .e3 "), ".e1 .e2 .e3");
|
||||
assert.equal(normalizeSelector("/*c1*/.e1/*c2*/.e2 /*c3*/ .e3"), ".e1 .e2 .e3");
|
||||
assert.equal(normalizeSelector(".e1/*c2*/.e2 /*c3*/ .e3"), ".e1 .e2 .e3");
|
||||
});
|
||||
|
||||
test('should replace comments with single whitespace', function () {
|
||||
assert.equal(normalizeSelector("tag/* c2 */tag"), "tag tag");
|
||||
});
|
||||
|
||||
test('should normalize parentheses', function() {
|
||||
var selector = "((a ) (b(c ) ) d )>*[ data-foo = \"bar\" ]";
|
||||
var expected = "((a)(b(c))d) > *[data-foo=\"bar\"]";
|
||||
assert.equal(normalizeSelector(selector), expected);
|
||||
});
|
||||
|
||||
test('should normalize @-rule parentheses', function () {
|
||||
var selector = "@media screen and ( color ), projection and (color )";
|
||||
var expected = "@media screen and (color), projection and (color)";
|
||||
assert.equal(normalizeSelector(selector), expected);
|
||||
});
|
||||
|
||||
test('should normalize @-rules with compound parentheses', function () {
|
||||
var selector = "@media handheld and ( min-width : 20em ), screen " +
|
||||
"and ( min-width: 20em )";
|
||||
var expected = "@media handheld and (min-width:20em), screen and " +
|
||||
"(min-width:20em)";
|
||||
assert.equal(normalizeSelector(selector), expected);
|
||||
});
|
||||
|
||||
test('should normalize @-rules with operations', function () {
|
||||
var selector = "@media screen and ( device-aspect-ratio : 2560 / 1440 )";
|
||||
var expected = "@media screen and (device-aspect-ratio:2560/1440)";
|
||||
assert.equal(normalizeSelector(selector), expected);
|
||||
});
|
||||
|
||||
test('should normalize descriptors', function () {
|
||||
var selector = "@counter-style triangle";
|
||||
assert.equal(normalizeSelector(selector), "@counter-style triangle");
|
||||
});
|
||||
|
||||
test('should normalize case-insensitivity attribute selector', function () {
|
||||
assert.equal(normalizeSelector("[ att ~= val i ]"), "[att~=val i]");
|
||||
assert.equal(normalizeSelector("#foo[ a = \"b\" i ]"), "#foo[a=\"b\" i]");
|
||||
});
|
||||
|
||||
test('should normalize namespaced attribute selector', function () {
|
||||
var selector = ' unit[ sh | quantity = "200" ] ';
|
||||
var expected = 'unit[sh|quantity="200"]';
|
||||
assert.equal(normalizeSelector(selector), expected);
|
||||
});
|
||||
|
||||
test('should normalize pseudo-classes', function () {
|
||||
var selector = " :nth-last-of-type( ) ";
|
||||
assert.equal(normalizeSelector(selector), ":nth-last-of-type()");
|
||||
});
|
||||
|
||||
test('should normalize pseudo-elements', function () {
|
||||
var selector = " ::nth-fragment( ) ";
|
||||
assert.equal(normalizeSelector(selector), "::nth-fragment()");
|
||||
});
|
||||
|
||||
test('should normalize backslashes', function () {
|
||||
var selector = "#foo[ a = \" b \\\" c\\\\\" ]";
|
||||
var expected = "#foo[a=\" b \\\" c\\\\\"]";
|
||||
assert.equal(normalizeSelector(selector), expected);
|
||||
});
|
Reference in New Issue
Block a user