Ejemplo n.º 1
0
 /** @test */
 public function it_should_process_an_element_without_a_label()
 {
     $productId = new Hidden('product_id');
     $productIdView = $productId->buildView();
     $options = ['attr' => ['class' => 'js-id']];
     $processedOptions = $this->options->process($productIdView, $options);
     $this->assertEquals(['element' => $productIdView, 'isValid' => true, 'attr' => ['class' => 'js-id', 'type' => 'hidden', 'name' => 'product_id'], 'options' => []], $processedOptions);
 }
Ejemplo n.º 2
0
 /**
  * @param ElementView $view
  * @return ElementView
  */
 public function buildView(ElementView $view = null)
 {
     $view = new ElementView();
     $view = parent::buildView($view);
     $this->setValue($this->tokenProvider->getToken($this->tokenId));
     // Setting the token value modifies the attributes and value properties
     $view->attributes = $this->attributes;
     $view->value = $this->value;
     return $view;
 }
 /** @test */
 public function it_should_render_a_row_with_a_hidden_element()
 {
     $description = new Hidden('product_id');
     $description->setValue('123');
     $description->setMessages(['This is not a valid product ID']);
     $html = $this->renderer->renderRow($description->buildView(), ['attr' => ['class' => 'js-data']]);
     $this->assertEquals('<input type="hidden" name="product_id" value="123" class="js-data"><ul><li>This is not a valid product ID</li></ul>', $html);
 }