Skip to content

Instantly share code, notes, and snippets.

@lucsoft
Created August 27, 2019 12:56
Show Gist options
  • Save lucsoft/59402d552e210d89e39fcead780ffda2 to your computer and use it in GitHub Desktop.
Save lucsoft/59402d552e210d89e39fcead780ffda2 to your computer and use it in GitHub Desktop.
Testing QUinit with WebGen
window.QUnit = {
config: {
altertitle: false
}
};
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Example Page</title>
<script src="https://api.lucsoft.de/flatweb/beta/webgen"></script>
<script src="https://api.lucsoft.de/flatweb/beta/jquery.js"></script>
<link href="https://fonts.googleapis.com/css?family=Material+Icons|Material+Icons+Round|Roboto:200,300,100"
rel="stylesheet">
<link rel="stylesheet" href="https://api.lucsoft.de/flatweb/beta/init.php">
<theme>
<link rel="stylesheet" href="https://api.lucsoft.de/flatweb/beta/css/blur.css">
</theme>
<script src="config.js"></script>
<script src="https://code.jquery.com/qunit/qunit-2.9.2.js"></script>
<script>
QUnit.test("hello test", function (assert) {
assert.ok(2 === "2");
});
QUnit.test("hello test 2", function (assert) {
assert.ok(1 == "1");
});
QUnit.test("hello test 2", function (assert) {
assert.ok(1 == "1");
});
QUnit.test("hello test 2", function (assert) {
assert.ok(1 == "1");
});
QUnit.test("hello test 2", function (assert) {
assert.ok(1 == "1");
});
QUnit.test("hello test 2", function (assert) {
assert.ok(1 == "1");
});
QUnit.test("hello test 2", function (assert) {
assert.ok(1 == "1");
});
</script>
<link rel="stylesheet" href="unit.css">
</head>
<body class="FlatWeb">
<div id="qunit"></div>
<script>
addLayout("page");
</script>
</body>
</html>
#qunit {
position: fixed;
left: 0;
bottom: 0;
width: 32rem;
height: 19rem;
background: var(--default-background-color);
color: var(--default-card-color);
margin: 1rem;
overflow: hidden;
border-radius: 0.3rem;
backdrop-filter: var(--default-backdrop);
}
#qunit #qunit-header {
background: var(--default-background-color);
margin: 0;
}
#qunit #qunit-banner {
margin: 0;
}
#qunit #qunit-banner.qunit-fail::after{
content: 'warning';
position: absolute;
top: .5rem;
color: rgba(202, 71, 19, 1);
font-size: 2.4rem;
right: 0.8rem;
font-family: 'Material Icons Round';
text-shadow: none;
}
#qunit .qunit-assert-list {
list-style: none;
padding: 0;
}
#qunit #qunit-tests {
list-style: none;
margin: 0;
padding: 0;
height: inherit;
overflow: auto;
position: relative;
}
#qunit #qunit-tests li {
padding: 0.4rem 1rem;
border-bottom: 1px solid #ffffff29;
position: relative;
height: 2.2rem;
}
#qunit #qunit-tests li:last-child {
margin-bottom: 0.3rem;
}
#qunit #qunit-tests li.fail::after, #qunit #qunit-tests li.pass::after {
content: 'failed';
position: absolute;
right: .8rem;
top: 0.6rem;
background: #c54637;
color: white;
font-weight: 600;
text-transform: uppercase;
font-size: 0.9rem;
padding: .4rem 0.6rem;
width: 4rem;
text-align: center;
border-radius: 10rem;
}
#qunit #qunit-tests li.pass::after {
content: 'passed';
background: #2eb12e;
color: white;
}
#qunit #qunit-tests li .runtime {
float: right;
margin-right: 5.5rem;
margin-top: 0.5rem;
}
#qunit #qunit-tests li.pass .test-name {
margin-top: 0.5rem;
display: inline-block;
}
#qunit #qunit-tests li ol li {
border-bottom: 0;
padding: 0;
}
#qunit #qunit-tests li ol li.pass {
display: none;
}
#qunit #qunit-tests li ol li::after {
display: none;
}
#qunit #qunit-header a {
color: var(--default-card-color);
text-decoration: none;
font-family: Roboto;
font-weight: 300;
font-size: 1.4rem;
padding: 0.9rem 1rem;
display: block;
}
#qunit-testrunner-toolbar, #qunit-userAgent,#qunit-banner *,#qunit-testresult, #qunit #qunit-tests li .counts , .qunit-source, .qunit-assert-list table, #qunit #qunit-tests li a,.qunit-assert-list .runtime{
display: none;
margin: 0;
padding: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment