- Timestamp:
- 09/30/2024 05:17:54 AM (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/widgets/wpWidgetCustomHtml.php
r56547 r59120 304 304 305 305 /** 306 * Ensure that rel="noopener" is added to links witha target.306 * Ensure that rel="noopener" is not added to links without a target. 307 307 * 308 308 * @ticket 46421 309 309 */ 310 public function test_render_links_with _target() {311 $widget = new WP_Widget_Custom_HTML(); 312 313 $content = 'Test content with an external <a href="https://example.org" target="_blank">link</a>.';310 public function test_render_links_without_target() { 311 $widget = new WP_Widget_Custom_HTML(); 312 313 $content = 'Test content with an internal <a href="/">link</a>.'; 314 314 315 315 $args = array( … … 326 326 327 327 $output = get_echo( array( $widget, 'widget' ), array( $args, $instance ) ); 328 $this->assertStringContainsString( 'rel="noopener"', $output );329 }330 331 /**332 * Ensure that rel="noopener" is not added to links without a target.333 *334 * @ticket 46421335 */336 public function test_render_links_without_target() {337 $widget = new WP_Widget_Custom_HTML();338 339 $content = 'Test content with an internal <a href="/">link</a>.';340 341 $args = array(342 'before_title' => '<h2>',343 'after_title' => '</h2>',344 'before_widget' => '',345 'after_widget' => '',346 );347 348 $instance = array(349 'title' => 'Foo',350 'content' => $content,351 );352 353 $output = get_echo( array( $widget, 'widget' ), array( $args, $instance ) );354 328 $this->assertStringNotContainsString( 'rel="noopener"', $output ); 355 329 }
Note: See TracChangeset
for help on using the changeset viewer.