Last active
December 11, 2015 20:28
-
-
Save jona10/4655347 to your computer and use it in GitHub Desktop.
Davis.js: Route called twice after application re-creation (issue #68).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <title>Issue #68 Tests</title> | |
| <link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-git.css" type="text/css" media="screen"> | |
| </head> | |
| <body> | |
| <h1 id="qunit-header">Issue #68 Tests</h1> | |
| <h2 id="qunit-banner"></h2> | |
| <div id="qunit-testrunner-toolbar"></div> | |
| <h2 id="qunit-userAgent"></h2> | |
| <ol id="qunit-tests"></ol> | |
| <script type="text/javascript" src="http://code.jquery.com/qunit/qunit-git.js"> </script> | |
| <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.0.js"> </script> | |
| <script type="text/javascript" src="https://raw.github.com/olivernn/davis.js/master/davis.js"> </script> | |
| <script type="text/javascript"> | |
| module("Issue #68", { | |
| setup: function () { | |
| $("<a id='route' href='/my/route'>My route</a>").appendTo("body"); | |
| }, | |
| teardown: function () { | |
| $("#route").remove(); | |
| } | |
| }); | |
| test("TestRouteCallbackIsCalledOnlyOnceAfterApplicationRestart", function () { | |
| var actualMatchCount = 0; | |
| function registerRoutes(application) { | |
| application.get("/my/route", function () { | |
| actualMatchCount += 1; | |
| }); | |
| } | |
| var app = new Davis.App(); | |
| registerRoutes(app); | |
| app.start(); | |
| app.stop(); | |
| app = new Davis.App(); | |
| registerRoutes(app); | |
| app.start(); | |
| $("#route").click(); | |
| strictEqual(actualMatchCount, 1, "route should have been triggered only once"); | |
| }); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment