Make WordPress Core

Changeset 34671


Ignore:
Timestamp:
09/28/2015 10:06:15 PM (9 years ago)
Author:
helen
Message:

Sample permalink: Buttons still need the .button class.

Also fixes unit tests post-[34670]. The test methods have been slightly renamed because it is no longer a button. Hopefully this name will be more future-proof.

see #18306.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/post.js

    r34670 r34671  
    742742        revert_e = e.html();
    743743
    744         buttons.html('<button type="button" class="save button-small">'+postL10n.ok+'</button> <a class="cancel" href="#">'+postL10n.cancel+'</a>');
     744        buttons.html('<button type="button" class="save button button-small">'+postL10n.ok+'</button> <a class="cancel" href="#">'+postL10n.cancel+'</a>');
    745745        buttons.children('.save').click(function() {
    746746            var new_slug = e.children('input').val();
  • trunk/tests/phpunit/tests/admin/includesPost.php

    r33773 r34671  
    273273    /**
    274274     * @ticket 30910
    275      */
    276     public function test_get_sample_permalink_html_should_use_default_permalink_for_view_post_button_when_pretty_permalinks_are_disabled() {
     275     * @ticket 18306
     276     */
     277    public function test_get_sample_permalink_html_should_use_default_permalink_for_view_post_link_when_pretty_permalinks_are_disabled() {
    277278        global $wp_rewrite;
    278279        $old_permalink_structure = get_option( 'permalink_structure' );
     
    286287
    287288        $found = get_sample_permalink_html( $p );
    288         $this->assertContains( "span id='view-post-btn'><a href='" . get_option( 'home' ) . "/?p=$p'", $found );
     289        $this->assertContains( 'href="' . get_option( 'home' ) . '/?p=' . $p . '"', $found );
    289290
    290291        $wp_rewrite->set_permalink_structure( $old_permalink_structure );
     
    294295    /**
    295296     * @ticket 30910
    296      */
    297     public function test_get_sample_permalink_html_should_use_pretty_permalink_for_view_post_button_when_pretty_permalinks_are_enabled() {
     297     * @ticket 18306
     298     */
     299    public function test_get_sample_permalink_html_should_use_pretty_permalink_for_view_post_link_when_pretty_permalinks_are_enabled() {
    298300        global $wp_rewrite;
    299301        $old_permalink_structure = get_option( 'permalink_structure' );
     
    309311        $found = get_sample_permalink_html( $p );
    310312        $post = get_post( $p );
    311         $this->assertContains( "span id='view-post-btn'><a href='" . get_option( 'home' ) . "/" . $post->post_name . "/'", $found );
     313        $this->assertContains( 'href="' . get_option( 'home' ) . "/" . $post->post_name . '/"', $found );
    312314
    313315        $wp_rewrite->set_permalink_structure( $old_permalink_structure );
     
    317319    /**
    318320     * @ticket 32954
    319      */
    320     public function test_get_sample_permalink_html_should_use_correct_permalink_for_view_post_button_when_changing_slug() {
     321     * @ticket 18306
     322     */
     323    public function test_get_sample_permalink_html_should_use_correct_permalink_for_view_post_link_when_changing_slug() {
    321324        global $wp_rewrite;
    322325        $old_permalink_structure = get_option( 'permalink_structure' );
     
    332335        $found = get_sample_permalink_html( $p, null, 'new_slug' );
    333336        $post = get_post( $p );
    334         $this->assertContains( "span id='view-post-btn'><a href='" . get_option( 'home' ) . "/" . $post->post_name . "/'", $found );
     337        $message = 'Published post';
     338        $this->assertContains( 'href="' . get_option( 'home' ) . "/" . $post->post_name . '/"', $found, $message );
    335339
    336340        // Scheduled posts should use published permalink
     
    340344        $found = get_sample_permalink_html( $p, null, 'new_slug' );
    341345        $post = get_post( $p );
    342         $this->assertContains( "span id='view-post-btn'><a href='" . get_option( 'home' ) . "/" . $post->post_name . "/'", $found );
     346        $message = 'Scheduled post';
     347        $this->assertContains( 'href="' . get_option( 'home' ) . "/" . $post->post_name . '/"', $found, $message );
    343348
    344349        // Draft posts should use preview link
     
    347352        $found = get_sample_permalink_html( $p, null, 'new_slug' );
    348353        $post = get_post( $p );
     354        $message = 'Draft post';
    349355
    350356        $preview_link = get_permalink( $post->ID );
    351357        $preview_link = add_query_arg( 'preview', 'true', $preview_link );
    352358
    353         $this->assertContains( "span id='view-post-btn'><a href='" . esc_url( $preview_link ) . "'", $found );
     359        $this->assertContains( 'href="' . esc_url( $preview_link ) . '"', $found, $message );
    354360
    355361        $wp_rewrite->set_permalink_structure( $old_permalink_structure );
Note: See TracChangeset for help on using the changeset viewer.