Conversation
This is following the pattern explained in "Serverless Single Page Apps" by Ben Rady. The idea is that we'll use pure HTML items as templates with a client-side router function to render and switch elements based on hash identifiers. Also uncomments the `document` argument to ensure that we're using the proper scoping for `document`, even though we always intend to test the actual browser `document`.
Though urlp.landingView takes no arguments, it's useful to spy on it to ensure parsing happens as expected.
This will eventually be extracted into its own template item.
urlp.loadApp ensures the view is initialized after the page has finished loading. Added a new test for urlp.showView to cover the case when window.location.hash is the empty string.
This ensures the methods from the `urlp` namespace are properly restored.
This ensures the router is called whenever the URL fragment changes.
Also updates .eslintignore to ensure that generated code isn't linted.
Also touches up a few tests to remove unnecessary variables.
Adding the new `describe()` blocks makes the test suite output more organized and consistent. Also, `invokeLoadApp()` for the `loadApp` suite more safely manages `window.onhashchange`.
Because it's properly "URL", not "Url".
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This gets the app loader and the first implementation of the URL fragment router in place.