Skip to content

Commit

Permalink
Test: Rewrite reporter-html/urlparams-filter.html to test/main/HtmlRe…
Browse files Browse the repository at this point in the history
…porter.js

The part that was testing actual filtering logic in the core runner, is left
behind and moved to the top-level test directory. This is now a sibling to
half a dozen other `urlparams-*.html` suites that we have already.
  • Loading branch information
Krinkle committed Jul 3, 2024
1 parent 2d0d2ca commit 63707ae
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ module.exports = function (grunt) {
'test/sandboxed-iframe.html',
'test/seed.html',
'test/startError.html',
'test/urlparams-filter.html',
'test/urlparams-module.html',
'test/urlparams-moduleId.html',
'test/urlparams-testId.html',
'test/webWorker.html',

'test/reporter-html/dropdown-many.html',
'test/reporter-html/urlparams-filter.html',
'test/reporter-html/window-onerror-preexisting-handler.html',
'test/reporter-html/window-onerror.html',
'test/reporter-html/xhtml-escape-details-source.xhtml'
Expand Down
17 changes: 17 additions & 0 deletions test/main/HtmlReporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,20 @@ QUnit.test('hidepassed', function (assert) {
assert.strictEqual(node.nodeName, 'INPUT');
assert.strictEqual(node.checked, true);
});

QUnit.test('filter', function (assert) {
var element = document.createElement('div');
new QUnit.reporters.html(this.MockQUnit, {
element: element,
config: {
urlConfig: [],
filter: '!/Foo|bar/'
}
});
this.MockQUnit._do_start_empty();

// Toolbar
var node = element.querySelector('#qunit-filter-input');
assert.strictEqual(node.nodeName, 'INPUT');
assert.strictEqual(node.value, '!/Foo|bar/');
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<head>
<meta charset="UTF-8">
<title>QUnit</title>
<link rel="stylesheet" href="../../src/qunit.css">
<link rel="stylesheet" href="../src/qunit.css">
</head>
<body>
<div id="qunit"></div>
<script src="../../qunit/qunit.js"></script>
<script src="../qunit/qunit.js"></script>
<script src="urlparams-filter.js"></script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-env browser */

// regular expression (case-sensitive), inverted
if (!location.search) {
// regular expression (case-sensitive), inverted
location.replace('?filter=!/Foo|bar/');
}

Expand All @@ -10,11 +9,6 @@ QUnit.module('filter');
QUnit.test('config parsed', function (assert) {
assert.strictEqual(QUnit.config.filter, '!/Foo|bar/');
});
QUnit.test('interface', function (assert) {
var node = document.getElementById('qunit-filter-input');
assert.strictEqual(node.nodeName, 'INPUT');
assert.strictEqual(node.value, '!/Foo|bar/');
});

QUnit.test('foo test', function (assert) {
assert.true(true);
Expand Down
3 changes: 1 addition & 2 deletions test/urlparams-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ if (!location.search) {

QUnit.module('Foo');

QUnit.test('Foo test', function (assert) {
assert.true(true, 'run module Foo');
QUnit.test('config parsed', function (assert) {
assert.strictEqual(QUnit.config.module, 'Foo', 'parsed config');
});

Expand Down

0 comments on commit 63707ae

Please sign in to comment.