Make WordPress Core


Ignore:
Timestamp:
04/06/2022 09:45:31 AM (3 years ago)
Author:
gziolo
Message:

Editor: Make block type aware of the ancestor field

The ancestor field was recently added to the block.json schema in Gutenberg. See: https://github.com/WordPress/gutenberg/pull/39894.

Props darerodz.
Fixes #55531.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-block-type-controller.php

    r51501 r53084  
    222222            'example'          => 'invalid_example',
    223223            'parent'           => 'invalid_parent',
     224            'ancestor'         => 'invalid_ancestor',
    224225            'supports'         => 'invalid_supports',
    225226            'styles'           => 'invalid_styles',
     
    247248        $this->assertSameSets( array( 'invalid_keywords' ), $data['keywords'] );
    248249        $this->assertSameSets( array( 'invalid_parent' ), $data['parent'] );
     250        $this->assertSameSets( array( 'invalid_ancestor' ), $data['ancestor'] );
    249251        $this->assertSameSets( array(), $data['supports'] );
    250252        $this->assertSameSets( array(), $data['styles'] );
     
    276278            'keywords'         => false,
    277279            'parent'           => false,
     280            'ancestor'         => false,
    278281            'supports'         => false,
    279282            'styles'           => false,
     
    302305        $this->assertSameSets( array(), $data['keywords'] );
    303306        $this->assertSameSets( array(), $data['parent'] );
     307        $this->assertSameSets( array(), $data['ancestor'] );
    304308        $this->assertSameSets( array(), $data['supports'] );
    305309        $this->assertSameSets( array(), $data['styles'] );
     
    379383        $data       = $response->get_data();
    380384        $properties = $data['schema']['properties'];
    381         $this->assertCount( 22, $properties );
     385        $this->assertCount( 23, $properties );
    382386        $this->assertArrayHasKey( 'api_version', $properties );
    383387        $this->assertArrayHasKey( 'title', $properties );
     
    402406        $this->assertArrayHasKey( 'provides_context', $properties );
    403407        $this->assertArrayHasKey( 'variations', $properties );
     408        $this->assertArrayHasKey( 'ancestor', $properties );
    404409    }
    405410
Note: See TracChangeset for help on using the changeset viewer.