Skip to content

Commit

Permalink
Demos: Replace /test/dropdown-many.html with q4000 benchmark and demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Krinkle committed Jul 10, 2024
1 parent 4a26a3f commit 58d93b9
Show file tree
Hide file tree
Showing 13 changed files with 29,601 additions and 1,551 deletions.
10 changes: 4 additions & 6 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@
{
"files": ["**/*.md/**"],
"parserOptions": {
"ecmaFeatures": {
"impliedStrict": true
}
"ecmaFeatures": {
"impliedStrict": true
}
},
"rules": {
// https://github.com/eslint/eslint/issues/15732
Expand All @@ -261,9 +261,7 @@
],
"parser": "eslint-plugin-json-es",
"rules": {
// https://github.com/zeitport/eslint-plugin-json-es/issues/35
// "indent": ["error", 2]
"indent": "off"
"indent": ["error", 2]
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ module.exports = function (grunt) {
'test/urlparams-testId.html',
'test/webWorker.html',

'test/reporter-html/dropdown-many.html',
'demos/q4000-qunit.html',
'test/reporter-html/window-onerror-preexisting-handler.html',
'test/reporter-html/window-onerror.html'

Expand Down
28 changes: 28 additions & 0 deletions build/q4000-template.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const fs = require('fs');
const path = require('path');

const q3000 = require('../test/benchmark/q4000.json');

{
const file = 'demos/q4000-qunit.js';

// Deal with indentation etc later via eslint --fix (or `npm run lint-fix`).
const formatTest = (name) => `QUnit.test(${JSON.stringify(name)}, function (assert) {
assert.true(true);
assert.true(true);
});`;
const formatMembers = (members) => {
return members.map(member => {
if (typeof member === 'string') {
return formatTest(member);
} else {
const tests = formatMembers(member.members);
return `QUnit.module(${JSON.stringify(member.name)}, function () {
${tests}
});`;
}
}).join('\n\n');
};
fs.writeFileSync(path.join(__dirname, '..', file), formatMembers(q3000));
console.log('Written to ' + file);
}
13 changes: 13 additions & 0 deletions demos/q4000-qunit.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>q4000 on QUnit</title>
<link rel="stylesheet" href="../src/qunit.css">
</head>
<body>
<div id="qunit"></div>
<script src="../qunit/qunit.js"></script>
<script src="q4000-qunit.js"></script>
</body>
</html>
Loading

0 comments on commit 58d93b9

Please sign in to comment.