WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/11/2020 09:26:25 PM (10 months ago)
Author:
SergeyBiryukov
Message:

Privacy: Add a table of contents to Personal Data Export report for easier navigation.

Props xkon, garrett-eclipse, birgire, karmatosed.
Fixes #46894.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/privacy/wpPrivacyGeneratePersonalDataExportGroupHtml.php

    r46586 r47278  
    4040        );
    4141
    42         $actual                = wp_privacy_generate_personal_data_export_group_html( $data );
     42        $actual                = wp_privacy_generate_personal_data_export_group_html( $data, 'test-data-group', 2 );
    4343        $expected_table_markup = '<table><tbody><tr><th>Field 1 Name</th><td>Field 1 Value</td></tr><tr><th>Field 2 Name</th><td>Field 2 Value</td></tr></tbody></table>';
    4444
    45         $this->assertContains( '<h2>Test Data Group</h2>', $actual );
     45        $this->assertContains( '<h2 id="test-data-group-test-data-group">Test Data Group</h2>', $actual );
    4646        $this->assertContains( $expected_table_markup, $actual );
    4747    }
     
    8080        );
    8181
    82         $actual = wp_privacy_generate_personal_data_export_group_html( $data );
    83 
    84         $this->assertContains( '<h2>Test Data Group', $actual );
     82        $actual = wp_privacy_generate_personal_data_export_group_html( $data, 'test-data-group', 2 );
     83
     84        $this->assertContains( '<h2 id="test-data-group-test-data-group">Test Data Group', $actual );
    8585        $this->assertContains( '<td>Field 1 Value', $actual );
    8686        $this->assertContains( '<td>Another Field 1 Value', $actual );
     
    118118        );
    119119
    120         $actual = wp_privacy_generate_personal_data_export_group_html( $data );
     120        $actual = wp_privacy_generate_personal_data_export_group_html( $data, 'test-data-group', 2 );
    121121
    122122        $this->assertContains( '<a href="http://wordpress.org">http://wordpress.org</a>', $actual );
     
    132132    public function test_group_labels_escaped() {
    133133        $data = array(
    134             'group_label' => '<div>Escape HTML in group lavels</div>',
     134            'group_label' => '<div>Escape HTML in group labels</div>',
    135135            'items'       => array(),
    136136        );
    137137
    138         $actual = wp_privacy_generate_personal_data_export_group_html( $data );
    139 
    140         $this->assertContains( '<h2>&lt;div&gt;Escape HTML in group lavels&lt;/div&gt;</h2>', $actual );
     138        $actual = wp_privacy_generate_personal_data_export_group_html( $data, 'escape-html-in-group-labels', 2 );
     139
     140        $this->assertContains( '<h2 id="escape-html-in-group-labels-escape-html-in-group-labels">&lt;div&gt;Escape HTML in group labels&lt;/div&gt;</h2>', $actual );
    141141    }
    142142
     
    163163        );
    164164
    165         $actual = wp_privacy_generate_personal_data_export_group_html( $data );
    166 
     165        $actual = wp_privacy_generate_personal_data_export_group_html( $data, 'test-data-group', 2 );
    167166        $this->assertContains( $data['items'][0]['links']['value'], $actual );
    168167        $this->assertContains( $data['items'][0]['formatting']['value'], $actual );
     
    191190        );
    192191
    193         $actual = wp_privacy_generate_personal_data_export_group_html( $data );
     192        $actual = wp_privacy_generate_personal_data_export_group_html( $data, 'test-data-group', 2 );
    194193
    195194        $this->assertNotContains( $data['items'][0]['scripts']['value'], $actual );
     
    224223        );
    225224
    226         $actual = wp_privacy_generate_personal_data_export_group_html( $data );
    227 
    228         $this->assertContains( '<h2>Test Data Group', $actual );
     225        $actual = wp_privacy_generate_personal_data_export_group_html( $data, 'test-data-group', 2 );
     226
     227        $this->assertContains( '<h2 id="test-data-group-test-data-group">Test Data Group', $actual );
    229228        $this->assertContains( '<span class="count">(2)</span></h2>', $actual );
    230229        $this->assertSame( 2, substr_count( $actual, '<table>' ) );
     
    249248        );
    250249
    251         $actual = wp_privacy_generate_personal_data_export_group_html( $data );
    252 
    253         $this->assertContains( '<h2>Test Data Group</h2>', $actual );
     250        $actual = wp_privacy_generate_personal_data_export_group_html( $data, 'test-data-group', 2 );
     251
     252        $this->assertContains( '<h2 id="test-data-group-test-data-group">Test Data Group</h2>', $actual );
    254253        $this->assertNotContains( '<span class="count">', $actual );
    255254        $this->assertSame( 1, substr_count( $actual, '<table>' ) );
Note: See TracChangeset for help on using the changeset viewer.