public function testDefaultState() { $this->assertSame('place_input', $this->autocomplete->getInputId()); $this->assertFalse($this->autocomplete->hasBound()); $this->assertFalse($this->autocomplete->hasTypes()); $this->assertFalse($this->autocomplete->hasComponentRestrictions()); $this->assertFalse($this->autocomplete->hasValue()); $this->assertSame(array('type' => 'text', 'placeholder' => 'off'), $this->autocomplete->getInputAttributes()); $this->assertFalse($this->autocomplete->isAsync()); $this->assertSame('en', $this->autocomplete->getLanguage()); }
/** * Renders the autocomplete HTML container. * * @param \Ivory\GoogleMap\Places\Autocomplete $autocomplete The autocomplete. * * @return string The HTML output. */ public function renderHtmlContainer(Autocomplete $autocomplete) { $inputAttributes = $autocomplete->getInputAttributes(); $inputAttributes['id'] = $autocomplete->getInputId(); if ($autocomplete->hasValue()) { $inputAttributes['value'] = $autocomplete->getValue(); } $htmlAttributes = array(); foreach ($inputAttributes as $attribute => $value) { $htmlAttributes[] = sprintf('%s="%s"', $attribute, $value); } return sprintf('<input %s />' . PHP_EOL, implode(' ', $htmlAttributes)); }