Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added new CheckBox widget, fixed IndexPage method and added filter an…
…d sorting to Grid class (#106) * added new CheckBox widget and fixed IndexPage method * added php doc to function * changed input element style * added sort and filter to grid class * added space in grid
- Loading branch information
1 parent
090eb4b
commit 72fae73
Showing
4 changed files
with
104 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
namespace hipanel\tests\_support\Page\Widget\Input; | ||
|
||
/** | ||
* Class CheckBox. | ||
* | ||
* Represents checkbox element | ||
*/ | ||
class CheckBox extends TestableInput | ||
{ | ||
/** | ||
* @return string | ||
*/ | ||
protected function getSearchSelector(): string | ||
{ | ||
// TODO: Implement getSearchSelector() method. | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
protected function getFilterSelector(): string | ||
{ | ||
// TODO: Implement getFilterSelector() method. | ||
} | ||
|
||
/** | ||
* @param string $value | ||
*/ | ||
public function setValue(string $value): void | ||
{ | ||
$checkBoxState = $this->getCheckBoxState(); | ||
if ($checkBoxState === (bool)$value) { | ||
return; | ||
} | ||
$this->clickCheckBox(); | ||
} | ||
|
||
private function clickCheckBox(): void | ||
{ | ||
$this->tester->executeJS(<<<JS | ||
document.querySelector(arguments[0]).click(); | ||
JS | ||
, [$this->selector]); | ||
} | ||
|
||
/** | ||
* @return bool | ||
*/ | ||
private function getCheckBoxState(): bool | ||
{ | ||
$state = $this->tester->executeJS(<<<JS | ||
return document.querySelector(arguments[0]).checked; | ||
JS | ||
, [$this->selector]); | ||
|
||
return $state; | ||
} | ||
} |