public function test_renderFooter() { ob_start(); Elementor\Plugin::instance()->editor->wp_footer(); $buffer = ob_get_clean(); $this->assertNotEmpty($buffer); }
public function test_controlsDefaultData() { foreach (Elementor\Plugin::instance()->widgets_manager->get_widget_types() as $widget) { foreach ($widget->get_controls() as $control) { if (\Elementor\Controls_Manager::SELECT !== $control['type']) { continue; } $error_msg = sprintf('Widget: %s, Control: %s', $widget->get_name(), $control['name']); if (empty($control['default'])) { $this->assertTrue(isset($control['options']['']), $error_msg); } else { $this->assertArrayHasKey($control['default'], $control['options'], $error_msg); } } } }
public function test_getDefaultValue() { // Text Control $text_control = Elementor\Plugin::instance()->controls_manager->get_control(\Elementor\Controls_Manager::TEXT); $control_option = ['name' => 'key', 'default' => 'value']; $this->assertEquals('value', $text_control->get_value($control_option, [])); // URL Control $url_control = Elementor\Plugin::instance()->controls_manager->get_control(\Elementor\Controls_Manager::URL); $control_option = ['name' => 'key', 'default' => ['url' => 'THE_LINK']]; $this->assertEquals(['url' => 'THE_LINK', 'is_external' => ''], $url_control->get_value($control_option, ['key' => ['is_external' => '']])); // Repeater Control $repeater_control = \Elementor\Plugin::instance()->controls_manager->get_control(\Elementor\Controls_Manager::REPEATER); $control_option = ['name' => 'key', 'default' => [[]], 'fields' => [['name' => 'one', 'type' => \Elementor\Controls_Manager::TEXT, 'default' => 'value']]]; $expected = [['one' => 'value']]; $this->assertEquals($expected, $repeater_control->get_value($control_option, [[]])); }