diff options
| author | Johann-S <[email protected]> | 2018-08-23 19:31:25 +0300 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2018-11-13 08:47:32 +0200 |
| commit | 16cf76ff1aa20f5b10d782f1170f6a1c36bcae0a (patch) | |
| tree | 471dc520b9655f1e15b517d4efc5b3416a636786 /js/tests/visual | |
| parent | d0652a1be9744ac433d26c960a4253074bd40639 (diff) | |
| download | bootstrap-16cf76ff1aa20f5b10d782f1170f6a1c36bcae0a.tar.xz bootstrap-16cf76ff1aa20f5b10d782f1170f6a1c36bcae0a.zip | |
Create toast JS plugin, add unit tests.
Diffstat (limited to 'js/tests/visual')
| -rw-r--r-- | js/tests/visual/toast.html | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/js/tests/visual/toast.html b/js/tests/visual/toast.html new file mode 100644 index 000000000..0daf8b521 --- /dev/null +++ b/js/tests/visual/toast.html @@ -0,0 +1,69 @@ +<!doctype html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> + <link rel="stylesheet" href="../../../dist/css/bootstrap.min.css"> + <title>Toast</title> + <style> + .notifications { + position: absolute; + top: 10px; + right: 10px; + } + </style> + </head> + <body> + <div class="container"> + <h1>Toast <small>Bootstrap Visual Test</small></h1> + + <div class="row mt-3"> + <div class="col-md-12"> + <button id="btnShowToast" class="btn btn-primary">Show toast</button> + <button id="btnHideToast" class="btn btn-primary">Hide toast</button> + </div> + </div> + </div> + + <div class="notifications"> + <div class="toast" data-delay='{"show": 0, "hide": 2000}'> + <div class="toast-header"> + <img class="rounded mr-2" data-src="holder.js/20x20?size=1&text=.&bg=#007aff" alt=""> + <strong class="mr-auto">Bootstrap</strong> + <small>11 mins ago</small> + </div> + <div class="toast-body"> + Hello, world! This is a toast message with <strong>autohide</strong> in 2 seconds + </div> + </div> + + <div class="toast" data-autohide="false"> + <div class="toast-header"> + <img class="rounded mr-2" data-src="holder.js/20x20?size=1&text=.&bg=#007aff" alt=""> + <strong class="mr-auto">Bootstrap</strong> + <small class="text-muted">2 seconds ago</small> + </div> + <div class="toast-body"> + Heads up, toasts will stack automatically + </div> + </div> + </div> + + <script src="../../../site/docs/4.1/assets/js/vendor/jquery-slim.min.js"></script> + <script src="../../dist/util.js"></script> + <script src="../../dist/toast.js"></script> + <script> + $(function () { + $('.toast').toast() + + $('#btnShowToast').on('click', function () { + $('.toast').toast('show') + }) + + $('#btnHideToast').on('click', function () { + $('.toast').toast('hide') + }) + }) + </script> + </body> +</html> |
