Esempio n. 1
0
 public function testSetFieldDescription()
 {
     $spec = new FormSpec();
     $this->assertTrue($spec->getFieldDescription('wow')->isNothing());
     $final = $spec->withFieldDescription('wow', 'WOWs');
     $this->assertNotSame($spec, $final);
     $this->assertTrue($final->getFieldDescription('wow')->isJust());
     $this->assertEquals('WOWs', Maybe::fromJust($final->getFieldDescription('wow')));
     $this->assertEquals(['wow' => 'WOWs'], $final->getDescriptions()->toArray());
 }
 protected function renderFullField($fieldName)
 {
     $fieldNodes = $this->renderField($fieldName);
     if (!is_array($fieldNodes)) {
         $nodes = ArrayList::of([$fieldNodes]);
     } else {
         $nodes = ArrayList::of($fieldNodes);
     }
     if ($this->spec->getFieldDescription($fieldName)->isJust()) {
         $nodes = $nodes->append(ArrayList::of([new Paragraph([], new Small(['class' => 'text-muted'], [Maybe::fromJust($this->spec->getFieldDescription($fieldName))]))]));
     }
     return $nodes->toArray();
 }