public function GridStackManagerTest::testGridStackForm in GridStack 8
Tests for \Drupal\gridstack_ui\Form\GridStackForm.
@covers \Drupal\gridstack_ui\Form\GridStackForm::getColumnOptions @covers \Drupal\gridstack_ui\Form\GridStackForm::jsonify
File
- tests/
src/ Kernel/ GridStackManagerTest.php, line 202
Class
- GridStackManagerTest
- Tests the GridStack manager methods.
Namespace
Drupal\Tests\gridstack\KernelCode
public function testGridStackForm() {
$frontend = GridStack::load('frontend');
$options = $this->gridstackForm
->getColumnOptions();
$this
->assertArrayHasKey(2, $options);
// @todo: Use @dataProvider.
$json = $this->gridstackForm
->jsonify();
$this
->assertEmpty($json);
$settings = $frontend
->getSettings();
$settings['cellHeight'] = '70';
$settings['rtl'] = '1';
$json = $this->gridstackForm
->jsonify($settings);
$this
->assertTrue(is_string($json));
$array = Json::decode($json);
$this
->assertEquals(70, $array['cellHeight']);
$this
->assertEquals(TRUE, $array['rtl']);
}