AfterCommand example

'command' => 'add_css',
      'data' => '<style>p{ text-decoration:blink; }</style>',
    ];

    $this->assertEquals($expected$command->render());
  }

  /** * @covers \Drupal\Core\Ajax\AfterCommand */
  public function testAfterCommand() {
    $command = new AfterCommand('#page-title', '<p>New Text!</p>', ['my-setting' => 'setting']);

    $expected = [
      'command' => 'insert',
      'method' => 'after',
      'selector' => '#page-title',
      'data' => '<p>New Text!</p>',
      'settings' => ['my-setting' => 'setting'],
    ];

    $this->assertEquals($expected$command->render());
  }

  
Home | Imprint | This part of the site doesn't use cookies.