Skip to content

Commit 7d370f4

Browse files
committed
MAGETWO-91848: Hint on product option with Maximum Characters should count down as more characters are entered
- Build stabilization
1 parent 3bcd0d0 commit 7d370f4

File tree

1 file changed

+9
-3
lines changed
  • dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View

1 file changed

+9
-3
lines changed

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View/CustomOptions.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class CustomOptions extends Form
5858
*
5959
* @var string
6060
*/
61-
protected $maxCharacters = './/div[@class="control"]/p[contains(@class, "note")]/strong';
61+
protected $maxCharacters = './/div[@class="control"]/p[contains(@class, "note")]';
6262

6363
/**
6464
* Selector for label of option value element
@@ -220,13 +220,19 @@ public function isJsMessageVisible($customOptionTitle)
220220
protected function getFieldData(SimpleElement $option)
221221
{
222222
$price = $this->getOptionPriceNotice($option);
223-
$maxCharacters = $option->find($this->maxCharacters, Locator::SELECTOR_XPATH);
223+
$maxCharactersElement = $option->find($this->maxCharacters, Locator::SELECTOR_XPATH);
224+
225+
$maxCharacters = null;
226+
if ($maxCharactersElement->isVisible()) {
227+
preg_match('/\s([0-9]+)\s/', $maxCharactersElement->getText(), $match);
228+
$maxCharacters = isset($match[1]) ? $match[1] : $maxCharactersElement->getText();
229+
}
224230

225231
return [
226232
'options' => [
227233
[
228234
'price' => floatval($price),
229-
'max_characters' => $maxCharacters->isVisible() ? $maxCharacters->getText() : null,
235+
'max_characters' => $maxCharacters,
230236
],
231237
]
232238
];

0 commit comments

Comments
 (0)