Skip to content

Commit

Permalink
ElementSelect allows null values
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesread committed May 20, 2024
1 parent 8023108 commit f4e5446
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main/php/libAllure/ElementSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ public function addOptions($options)
}
}

public function getValue()
{
if ($this->value == '') {
return null;
}

return $this->value;
}

public function render()
{
$strOptions = '';
Expand All @@ -32,7 +41,7 @@ public function render()
$key = $val;
}

$sel = ($key == $this->value) ? 'selected = "selected"' : '';
$sel = ($key === $this->value) ? 'selected = "selected"' : '';

$strOptions .= sprintf('<option value = "%s" %s>%s</option>', $key, $sel, $val);
}
Expand Down

0 comments on commit f4e5446

Please sign in to comment.