-
Notifications
You must be signed in to change notification settings - Fork 384
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
Fallback to AMP Legacy Reader theme if active Reader theme is unavailable #5159
Merged
Merged
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
fdedae8
Show mobile icon placeholder if none was defined
pierlon 3c9b293
Show desktop icon placeholder if none was defined
pierlon fd55eb7
Obtain active reader theme data from list of installed themes if avai…
pierlon 8b6b1e9
Fallback to legacy Reader mode if active Reader theme is unavailable
pierlon 289dce4
Fix lint errors
pierlon 3d39560
Revert making Reader theme service conditional
pierlon aeeb22e
Fix how legacy mode is determined
pierlon 030df93
Merge branch 'develop' into fix/5070-custom-reader-theme-info
pierlon 688b8b2
Center desktop screenshots when viewed in mobile viewport
pierlon b76fe2d
Align SVG content to canvas
pierlon a9cba2b
Show an admin notice on Settings page if Reader theme becomes unavail…
pierlon bf6ca59
Add test to verify Reader theme data can be retrieved from list of in…
pierlon 3575517
Show mobile image placeholder in onboarding wizard
pierlon 5a71cf6
Use already existing reader theme
pierlon 6c34896
Fix test-amp-helper-functions for core themes in src
westonruter 05a673d
Simplify logic in amp_is_legacy()
westonruter d03eaf9
Let child-of-core be child of Twenty Seventeen to fix WP<5.3 tests
westonruter e8e1d93
Fix tests in WP 4.9 and ensure core themes in src are registered
westonruter b2f4ed0
Programmatically select the AMP Legacy theme if it's used as a fallback
pierlon f3707a1
Make registration of core theme directory in tests DRY
pierlon 1d939c4
Add link to reader themes drawer
westonruter 17261a3
Restrict showing legacy fallback notice to admins on themes screen an…
westonruter 6bb44d7
Only programmmatically select legacy theme when current Reader theme …
pierlon e5e086f
Ensure AMP legacy theme is being used as a fallback
pierlon c947bc9
Remove user capability check from ReaderThemes::using_fallback_theme
pierlon b2a9716
Replace astra with neve for testing since astra is suspended
westonruter 0335d92
Enable the "Customize Theme" button after installing the new Reader t…
pierlon b322c37
Remove screenshot from being required for DesktopScreenshot.propTypes
westonruter 3f005bf
Remove outdated hook dependencies
pierlon 88fa245
Add tests for admin notice printers
westonruter 5f65e7d
Add test for ReaderThemes::using_fallback_theme
westonruter 7029023
Remove unused asset dependency
pierlon cda8156
Explicitly ignore legacy theme since not yet pushed to array
westonruter 06ac5ed
Make ReaderThemes::normalize_theme_data() private
westonruter 83cb2c5
Reuse variable for condition
westonruter 877b4ab
Use LoadsCoreThemes in remaining tests
westonruter f2df5c7
Delete obsolete deletion of theme_roots site transient
westonruter 810ec5f
Mock Reader themes provider
pierlon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
assets/src/components/reader-themes-context-provider/__mocks__/index.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import PropTypes from 'prop-types'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { createContext } from '@wordpress/element'; | ||
|
||
export const ReaderThemes = createContext(); | ||
|
||
/** | ||
* MOCK. | ||
* | ||
* @param {Object} props | ||
* @param {any} props.children Component children. | ||
* @param {boolean} props.downloadingTheme Whether downloading a theme or not. | ||
*/ | ||
export function ReaderThemesContextProvider( { children, downloadingTheme = false } ) { | ||
return ( | ||
<ReaderThemes.Provider value={ | ||
{ | ||
downloadingTheme, | ||
} | ||
}> | ||
{ children } | ||
</ReaderThemes.Provider> | ||
); | ||
} | ||
ReaderThemesContextProvider.propTypes = { | ||
children: PropTypes.any, | ||
downloadingTheme: PropTypes.bool, | ||
}; |
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I received the following warning while running the JS tests:
It seems Jest doesn't allow mocks with the same base name for some weird reason. It's been filed as a bug for quite some time now.
Ignoring the mocks in
assets/src/components
seems to resolve the issue, but I'd like to get a second opinion from @johnwatkins0 on this.