diff options
author | carson <carson@leaddyno.com> | 2020-05-16 15:40:15 -0700 |
---|---|---|
committer | carson <carson@leaddyno.com> | 2020-05-16 15:40:15 -0700 |
commit | e1e4f25b0ef21e96eda192e69ab89e207dd7f617 (patch) | |
tree | 805920d8b3c99c9a0d12310ece88c788d739fbc6 | |
parent | 4ebdabd2279c9e44058effdc831285f87cfb32b3 (diff) | |
download | htmx-e1e4f25b0ef21e96eda192e69ab89e207dd7f617.tar.gz htmx-e1e4f25b0ef21e96eda192e69ab89e207dd7f617.zip |
regigger tests and add manual tests for hard-to-test things like prompt and confirm
-rw-r--r-- | test/index.html | 34 | ||||
-rw-r--r-- | test/manual/browser-only-tests.html (renamed from test/browser-only-tests.html) | 14 | ||||
-rw-r--r-- | test/manual/confirm-and-prompt.html | 28 | ||||
-rw-r--r-- | test/manual/no-indicator-css.html (renamed from test/no-indicator-css.html) | 6 | ||||
-rw-r--r-- | test/manual/yes-indicator-css.html (renamed from test/yes-indicator-css.html) | 6 | ||||
-rw-r--r-- | test/scratch.html | 2 |
6 files changed, 72 insertions, 18 deletions
diff --git a/test/index.html b/test/index.html index 3da789bf..ac259016 100644 --- a/test/index.html +++ b/test/index.html @@ -11,8 +11,35 @@ <meta http-equiv="pragma" content="no-cache" /> <meta name="kutty-config" content='{"historyEnabled":false}'> </head> -<body> -<div id="mocha"></div> +<body style="padding:20px;font-family: sans-serif"> + +<h1>kutty.js test suite</h1> + +<h2>Scratch Page</h2> +<ul> + <li> + <a href="scratch.html">Scratch Page</a> + </li> +</ul> + +<h2>Manual Tests</h2> +<ul> + <li> + <a href="manual/browser-only-tests.html">Core Browser-Only Tests</a> + </li> + <li> + <a href="manual/yes-indicator-css.html">Include Indicator CSS Test</a> + </li> + <li> + <a href="manual/no-indicator-css.html">Exclude Indicator CSS Test</a> + </li> + <li> + <a href="manual/confirm-and-prompt.html">Confirm & Prompt Test</a> + </li> +</ul> + +<h2>Mocha Test Suite</h2> + <script src="../node_modules/chai/chai.js"></script> <script src="../node_modules/mocha/mocha.js"></script> <script src="../node_modules/sinon/pkg/sinon.js"></script> @@ -56,8 +83,7 @@ <script src="core/events.js"></script> -<a href="browser-only-tests.html">Run Browser-Only Tests</a> - +<div id="mocha"></div> <script class="mocha-exec"> mocha.run(); diff --git a/test/browser-only-tests.html b/test/manual/browser-only-tests.html index 6d6f7c81..7ef37eb5 100644 --- a/test/browser-only-tests.html +++ b/test/manual/browser-only-tests.html @@ -3,21 +3,21 @@ <meta charset="utf-8" /> <title>Mocha Tests</title> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> - <link rel="stylesheet" href="../node_modules/mocha/mocha.css" /> + <link rel="stylesheet" href="../../node_modules/mocha/mocha.css" /> </head> -<body> +<body style="padding:20px;font-family: sans-serif"> <div id="mocha"></div> -<script src="../node_modules/chai/chai.js"></script> -<script src="../node_modules/mocha/mocha.js"></script> -<script src="../node_modules/sinon/pkg/sinon.js"></script> -<script src="../src/kutty.js"></script> +<script src="../../node_modules/chai/chai.js"></script> +<script src="../../node_modules/mocha/mocha.js"></script> +<script src="../../node_modules/sinon/pkg/sinon.js"></script> +<script src="../../src/kutty.js"></script> <script class="mocha-init"> mocha.setup('bdd'); mocha.checkLeaks(); should = chai.should(); </script> -<script src="util/util.js"></script> +<script src="../util/util.js"></script> <script> describe("Browser Only Tests", function() { diff --git a/test/manual/confirm-and-prompt.html b/test/manual/confirm-and-prompt.html new file mode 100644 index 00000000..4590544e --- /dev/null +++ b/test/manual/confirm-and-prompt.html @@ -0,0 +1,28 @@ +<html lang="en"> +<head> + <meta charset="utf-8" /> + <title>Test if indicators are invisible by default</title> + <script src="../../src/kutty.js"></script> +</head> +<body style="padding:20px;font-family: sans-serif"> +<script src="../../node_modules/sinon/pkg/sinon.js"></script> +<script src="../../src/kutty.js"></script> +<script src="../util/util.js"></script> +<script> + server = makeServer(); + server.autoRespond = true; + server.respondWith("GET", "/prompt", function(xhr){ + xhr.respond(200, {}, "You entered: " + xhr.requestHeaders["X-KT-Prompt"]); + }) + server.respondWith("GET", "/confirm", function(xhr){ + xhr.respond(200, {}, "Confirmed") + }) +</script> +<h1>Prompt & Confirm Tests</h1> +<button kt-get="/prompt" kt-prompt="Enter some text and it should be echoed in this button">Click For Prompt</button> +<br/> +<br/> +<br/> +<button kt-get="/confirm" kt-confirm="Confirm The Action">Click For Confirm</button> +</body> +</html> diff --git a/test/no-indicator-css.html b/test/manual/no-indicator-css.html index 04f820a3..d24753a0 100644 --- a/test/no-indicator-css.html +++ b/test/manual/no-indicator-css.html @@ -3,14 +3,14 @@ <meta charset="utf-8" /> <meta name="kutty-config" content='{"includeIndicatorStyles":false}'> <title>Test if the includeIndicatorStyles meta option works</title> - <script src="../src/kutty.js"></script> + <script src="../../src/kutty.js"></script> </head> -<body> +<body style="padding:20px;font-family: sans-serif"> <h1>You should see bars here:</h1> <p> We are overriding the normal CSS inclusion with the meta directive <code>{"includeIndicatorStyles":false}</code> so you should see the indicator because it is not being hidden by the default classes. </p> - <img class="kutty-indicator" src="img/bars.svg" width="200"> + <img class="kutty-indicator" src="../img/bars.svg" width="200"> </body> </html> diff --git a/test/yes-indicator-css.html b/test/manual/yes-indicator-css.html index bbd0b183..46fdea72 100644 --- a/test/yes-indicator-css.html +++ b/test/manual/yes-indicator-css.html @@ -2,10 +2,10 @@ <head> <meta charset="utf-8" /> <title>Test if indicators are invisible by default</title> - <script src="../src/kutty.js"></script> + <script src="../../src/kutty.js"></script> </head> -<body> +<body style="padding:20px;font-family: sans-serif"> <h1>You should not see bars here:</h1> - <img class="kutty-indicator" src="img/bars.svg" width="200"> + <img class="kutty-indicator" src="../img/bars.svg" width="200"> </body> </html> diff --git a/test/scratch.html b/test/scratch.html index c01eac18..c800a437 100644 --- a/test/scratch.html +++ b/test/scratch.html @@ -17,7 +17,7 @@ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"> </head> -<body> +<body style="padding:20px;font-family: sans-serif"> <script src="../node_modules/sinon/pkg/sinon.js"></script> <script src="../src/kutty.js"></script> <script src="util/util.js"></script> |