WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/24/17 22:45:55 (5 months ago)
Author:
westonruter
Message:

Widgets: Rename Text widget's legacy mode to non-visual mode, restore boolean filter prop, and improve compatibility for widget_text filters applied in Custom HTML widget.

Props westonruter, obenland, timmydcrawford for testing.
Amends [41050].
See #35243, #40951, #40907.
Fixes #41394.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/widgets/custom-html-widget.php

    r41118 r41132  
    6060        ); 
    6161 
     62        // Convert Custom HTML widget instance into Text widget instance data. 
     63        $text_widget_instance = array_merge( $instance, array( 
     64            'text' => $instance['content'], 
     65            'filter' => false, 
     66            'visual' => false, 
     67        ) ); 
     68        unset( $text_widget_instance['content'] ); 
     69 
    6270        update_option( 'use_balanceTags', 0 ); 
    6371        add_filter( 'widget_custom_html_content', array( $this, 'filter_widget_custom_html_content' ), 5, 3 ); 
     
    7684        $this->assertNotContains( '<br>', $output ); 
    7785        $this->assertNotContains( '</u>', $output ); 
    78         $this->assertEquals( $instance, $this->widget_text_args[1] ); 
     86        $this->assertEquals( $text_widget_instance, $this->widget_text_args[1] ); 
    7987        $this->assertEquals( $instance, $this->widget_custom_html_content_args[1] ); 
    8088        $this->assertSame( $widget, $this->widget_text_args[2] ); 
    8189        $this->assertSame( $widget, $this->widget_custom_html_content_args[2] ); 
    82         remove_filter( 'widget_custom_html_content', array( $this, 'filter_widget_custom_html_content' ), 5, 3 ); 
     90        remove_filter( 'widget_custom_html_content', array( $this, 'filter_widget_custom_html_content' ), 5 ); 
    8391        remove_filter( 'widget_text', array( $this, 'filter_widget_text' ), 10 ); 
    8492 
Note: See TracChangeset for help on using the changeset viewer.