-
Notifications
You must be signed in to change notification settings - Fork 287
Add hasOption method to NodeElement class. #766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 6 commits
4beb120
677797e
dc687c4
3a74211
bf68bef
7f134a1
6b3d7fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -237,6 +237,23 @@ public function selectOption($option, $multiple = false) | |
| $this->getDriver()->selectOption($this->getXpath(), $opt->getValue(), $multiple); | ||
| } | ||
|
|
||
| /** | ||
| * Returns that the option is in the element or not. | ||
| * | ||
| * @param string $option | ||
| * @return Boolean|null | ||
| */ | ||
| public function hasOption($option) | ||
| { | ||
| if ('select' !== $this->getTagName()) { | ||
| return; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is wrong. It must return a boolean
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I writed this because if the element is not a select tag, It is not logical to return a boolean. That would be nice if I throw an exception instead of return null? Or editing the documentation of method to
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO it's better to throw an exception. |
||
| } | ||
|
|
||
| $optionElement = $this->find('named', array('option', $option)); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can safely inline this variable, because it's used only once. |
||
|
|
||
| return $optionElement !== null; | ||
| } | ||
|
|
||
| /** | ||
| * Checks whether current node is selected if it's a option field. | ||
| * | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.