Changeset 59120 for trunk/tests/phpunit/tests/widgets/wpWidgetText.php
- Timestamp:
- 09/30/2024 05:17:54 AM (6 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/widgets/wpWidgetText.php
r56549 r59120 1003 1003 1004 1004 /** 1005 * Ensure that rel="noopener" is added to links witha target.1005 * Ensure that rel="noopener" is not added to links without a target. 1006 1006 * 1007 1007 * @ticket 46421 1008 1008 */ 1009 public function test_render_links_with _target() {1009 public function test_render_links_without_target() { 1010 1010 $widget = new WP_Widget_Text(); 1011 1011 1012 $text = 'Test content with an external <a href="https://example.org" target="_blank">link</a>.';1012 $text = 'Test content with an internal <a href="/">link</a>.'; 1013 1013 1014 1014 $args = array( … … 1026 1026 $output = get_echo( array( $widget, 'widget' ), array( $args, $instance ) ); 1027 1027 1028 $this->assertStringContainsString( 'rel="noopener"', $output );1029 }1030 1031 /**1032 * Ensure that rel="noopener" is not added to links without a target.1033 *1034 * @ticket 464211035 */1036 public function test_render_links_without_target() {1037 $widget = new WP_Widget_Text();1038 1039 $text = 'Test content with an internal <a href="/">link</a>.';1040 1041 $args = array(1042 'before_title' => '<h2>',1043 'after_title' => '</h2>',1044 'before_widget' => '',1045 'after_widget' => '',1046 );1047 1048 $instance = array(1049 'title' => 'Foo',1050 'text' => $text,1051 );1052 1053 $output = get_echo( array( $widget, 'widget' ), array( $args, $instance ) );1054 1055 1028 $this->assertStringNotContainsString( 'rel="noopener"', $output ); 1056 1029 }
Note: See TracChangeset
for help on using the changeset viewer.