-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Introduce theme_supports
with formats
to REST API index
#6318
Changes from all commits
1dea212
a70592b
0d658a2
82bdfb5
d64f40a
5f1fee9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,4 +119,16 @@ function test_viewable_field_without_context() { | |
$result = $response->get_data(); | ||
$this->assertFalse( isset( $result['viewable'] ) ); | ||
} | ||
|
||
/** | ||
* Should include relevant data in the 'theme_supports' key of index. | ||
*/ | ||
function test_theme_supports_index() { | ||
$request = new WP_REST_Request( 'GET', '/' ); | ||
$response = rest_do_request( $request ); | ||
$result = $response->get_data(); | ||
$this->assertTrue( isset( $result['theme_supports'] ) ); | ||
$this->assertTrue( isset( $result['theme_supports']['formats'] ) ); | ||
$this->assertTrue( in_array( 'standard', $result['theme_supports']['formats'] ) ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It'd be good to test that post formats that aren't specified by the theme are not in the results, too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given post formats can vary from theme to theme, and the theme active in the test suite is uncertain, can you suggest what you'd like me to test? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On second thoughts, I don't know that it needs testing. I'd been looking at WPCOM's API, which tries to avoid loading the theme code if it can, so was considering how to test for that. But, that's not really an issue for Core. |
||
} | ||
} |
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.
Is
Data
suffix adding any value here? Would we want to call other reducerstermsData
,mediaData
as well for consistency's sake?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.
For me personally, it denotes that it's the data part of the index.
index
was too nebulous in my opinion (in comparison toterms
, which more clearly communicates itself).I don't think so. However, if you're not a fan of
indexData
, I'm open to renaming it. Alternatively, we could only putthemeSupports
in the store, instead of the entire index.