Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build/form/index.asset.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/form/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion includes/class-webmention.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public function register_constants() {
* Enqueue scripts.
*/
public function enqueue_scripts() {
if ( is_singular() ) {
if ( is_singular() || is_home() || is_archive() ) {
wp_enqueue_style( self::TEXT_DOMAIN, WEBMENTION_PLUGIN_URL . 'assets/css/webmention.css', array(), $this->get_version() );
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/form/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
/*
* @jsxRuntime classic
* @jsx createElement
*/

/**
* Webmention Form block.
*
* Rendered on the server by the same template as the classic comment form,
* the editor only shows a static preview.
*/
import { registerBlockType } from '@wordpress/blocks';
import { createElement } from '@wordpress/element';
import { useBlockProps } from '@wordpress/block-editor';
import { __ } from '@wordpress/i18n';

Expand Down
24 changes: 24 additions & 0 deletions tests/phpunit/tests/class-test-webmention.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,30 @@
* Test Webmention class.
*/
class Test_Webmention extends WP_UnitTestCase {
/**
* Test that post content keeps its styles on singular, home, and archive views.
*/
public function test_content_styles_are_enqueued() {
$category_id = self::factory()->category->create();
$post_id = self::factory()->post->create( array( 'post_category' => array( $category_id ) ) );
$urls = array(
get_permalink( $post_id ),
home_url( '/?post_type=post' ),
get_category_link( $category_id ),
);

try {
foreach ( $urls as $url ) {
wp_dequeue_style( 'webmention' );
$this->go_to( $url );
\Webmention\Webmention::get_instance()->enqueue_scripts();
$this->assertTrue( wp_style_is( 'webmention', 'enqueued' ), $url );
}
} finally {
wp_dequeue_style( 'webmention' );
}
}

/**
* Test that constants are registered.
*/
Expand Down
Loading