Skip to content

Commit

Permalink
Tests: Improve "hidepassed" integration test
Browse files Browse the repository at this point in the history
It already confirmed that it worked end-to-end from URL parameter to
visible behaviour. But, we did not confirm the intermediary effect
(exposed as parsed config property), and the side-effect of the interface
reflecting the correct state.

This is a regression test for bug qunitjs#1657.
  • Loading branch information
Krinkle committed Sep 19, 2021
1 parent 267b222 commit 1ff6c43
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ module.exports = function( grunt ) {
"test/reorder.html",
"test/reorderError1.html",
"test/reorderError2.html",
"test/reporter-urlparams-hidepassed.html",
"test/reporter-urlparams.html",
"test/sandboxed-iframe.html",
"test/seed.html",
Expand All @@ -101,6 +100,7 @@ module.exports = function( grunt ) {
"test/urlparams-testId.html",
"test/webWorker.html",

"test/reporter-html/hidepassed.html?hidepassed=true",
"test/reporter-html/legacy-markup.html",
"test/reporter-html/no-qunit-element.html",
"test/reporter-html/config-testId.html",
Expand Down
13 changes: 13 additions & 0 deletions test/reporter-html/hidepassed.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>QUnit</title>
<link rel="stylesheet" href="../../qunit/qunit.css">
</head>
<body>
<div id="qunit"></div>
<script src="../../qunit/qunit.js"></script>
<script src="hidepassed.js"></script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ if ( !location.search ) {
location.replace( "?hidepassed=true" );
}

QUnit.module( "urlParams hidepassed module", function() {
QUnit.module( "hidepassed", function() {
QUnit.test( "passed 1", function( assert ) {
assert.true( true );
} );
Expand All @@ -12,22 +12,22 @@ QUnit.module( "urlParams hidepassed module", function() {
QUnit.test( "passed 3", function( assert ) {
assert.true( true );
} );
QUnit.test( "passed 4", function( assert ) {
assert.true( true );
} );
QUnit.test( "passed 5", function( assert ) {
assert.true( true );
} );
QUnit.test( "passed 6", function( assert ) {
assert.true( true );
} );
QUnit.skip( "skipped 1", function( assert ) {
assert.true( false, "can't seem to get this working" );
} );
QUnit.test( "passed 4", function( assert ) {

QUnit.test( "passed 7", function( assert ) {

// we have to set it to 1 because there is currently one item being rendered, this one as it is in progress
// We expect 1 rather than 0 because the current test is in progress,
// and in-progress tests are always rendered.
// It will become hidden once it passed
assert.strictEqual( document.getElementById( "qunit-tests" ).children.length, 1 );
} );
QUnit.test( "config parsed", function( assert ) {
assert.strictEqual( QUnit.config.hidepassed, "true" );
} );
QUnit.test( "interface", function( assert ) {
var node = document.getElementById( "qunit-urlconfig-hidepassed" );
assert.strictEqual( node.nodeName, "INPUT" );
assert.strictEqual( node.checked, true );
} );
} );
13 changes: 0 additions & 13 deletions test/reporter-urlparams-hidepassed.html

This file was deleted.

0 comments on commit 1ff6c43

Please sign in to comment.