-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SDK: better support for SPA routing - STEP 1/2 : add hash tracking #463
SDK: better support for SPA routing - STEP 1/2 : add hash tracking #463
Conversation
This PR should not be merged on master while anchor hash are not excluded, right? |
Codecov Report
@@ Coverage Diff @@
## maxime.quentin/betterSupportForSPArouting #463 +/- ##
=============================================================================
- Coverage 87.93% 87.51% -0.43%
=============================================================================
Files 32 32
Lines 2022 2026 +4
Branches 410 411 +1
=============================================================================
- Hits 1778 1773 -5
- Misses 244 253 +9
Continue to review full report at Codecov.
|
* SDK: better support for SPA routing - STEP 1/2 : add hash tracking (#463) * add hash tracking * ✅ add hash change tests * introduce renewViewOnChange * add better management and comments of the areViewDifferent hash part * set async tests for hashchanges * reset window.location.hash of previous tests * skip tesst using Promise for IE * replace jasmine promise with callback process * remove anchor check on this PR * ✅ and implem reviews * SDK: better support for SPA routing - STEP 2/2 : filter out html anchor tags changes (#466) * add hash tracking * ✅ add hash change tests * introduce renewViewOnChange * add better management and comments of the areViewDifferent hash part * set async tests for hashchanges * reset window.location.hash of previous tests * skip tesst using Promise for IE * replace jasmine promise with callback process * remove anchor check on this PR * add anchor nav filter * patch tslint error * ✅ and implem reviews * implement reviews regarding func naming and hash cleaning * simplify mockGetElementById * add e2e tests * simply anchor filter out proccess * implement reviews * unit test the hash change acknowledgement after an anchor nav * fix typo * fix typo v2 * fix mock hash Co-authored-by: Bastien Caudan <bastien.caudan@gmail.com>
Motivation
Given
startViewCollection
When
on window.location.hash changes
Then
check if the views are different.
If the hash fragment has changed, then the views are different.
Changes
trackHash
functionareDifferentViews
to handle hash changesTesting
✅ hash changes tests have been added both for pushStates and window.location.hash window.location.hash
Test with the Vue router without
mode: 'history'
:const router = new VueRouter({ routes })
SHOULD NOT BE MERGE UNTIL STEP 2 is done
SDK: better support for SPA routing - STEP 2/2 : filter out html anchor tags changes