|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Acquia\DFExtension\Context; |
|
4
|
|
|
|
|
5
|
|
|
use Acquia\LightningExtension\AwaitTrait; |
|
6
|
|
|
|
|
7
|
|
|
use Drupal\DrupalExtension\Context\DrupalSubContextBase; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* A context with miscellaneous helpers. |
|
11
|
|
|
*/ |
|
12
|
|
|
class ModerationSidebarContext extends DrupalSubContextBase { |
|
13
|
|
|
|
|
14
|
|
|
use AwaitTrait; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Closes the moderation sidebar. |
|
18
|
|
|
* |
|
19
|
|
|
* @When I close the moderation sidebar |
|
20
|
|
|
*/ |
|
21
|
|
|
public function closeModerationSidebar() { |
|
22
|
|
|
$assert = $this->assertSession(); |
|
23
|
|
|
|
|
24
|
|
|
// Assert that the tab exists... |
|
25
|
|
|
$link = $assert->elementExists( |
|
26
|
|
|
'named', |
|
27
|
|
|
['link', 'Tasks'], |
|
28
|
|
|
$assert->elementExists('css', '.moderation-sidebar-toolbar-tab') |
|
29
|
|
|
); |
|
30
|
|
|
|
|
31
|
|
|
// ...but only open it if already active. |
|
32
|
|
|
if ($link->hasClass('sidebar-open') == TRUE) { |
|
|
|
|
|
|
33
|
|
|
$link->click(); |
|
34
|
|
|
$this->awaitAjax(); |
|
35
|
|
|
} |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Selects a moderation sidebar item. |
|
40
|
|
|
* |
|
41
|
|
|
* @param string $item |
|
42
|
|
|
* The moderation sidebar item to select. |
|
43
|
|
|
* |
|
44
|
|
|
* @Given I select the :item moderation sidebar button |
|
45
|
|
|
*/ |
|
46
|
|
|
public function selectModerationSidebarButton($item) { |
|
47
|
|
|
$assert = $this->assertSession(); |
|
48
|
|
|
|
|
49
|
|
|
// Assert that the tab exists... |
|
50
|
|
|
$link = $assert->elementExists( |
|
51
|
|
|
'named', |
|
52
|
|
|
['button', $item], |
|
53
|
|
|
$assert->elementExists('css', '.moderation-sidebar-container') |
|
54
|
|
|
); |
|
55
|
|
|
|
|
56
|
|
|
$link->click(); |
|
57
|
|
|
$this->awaitAjax(); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* Selects a moderation sidebar item. |
|
62
|
|
|
* |
|
63
|
|
|
* @param string $item |
|
64
|
|
|
* The moderation sidebar item to select. |
|
65
|
|
|
* |
|
66
|
|
|
* @Given I select the :item moderation sidebar link |
|
67
|
|
|
*/ |
|
68
|
|
|
public function selectModerationSidebarLink($item) { |
|
69
|
|
|
$assert = $this->assertSession(); |
|
70
|
|
|
|
|
71
|
|
|
// Assert that the tab exists... |
|
72
|
|
|
$link = $assert->elementExists( |
|
73
|
|
|
'named', |
|
74
|
|
|
['link', $item], |
|
75
|
|
|
$assert->elementExists('css', '.moderation-sidebar-container') |
|
76
|
|
|
); |
|
77
|
|
|
|
|
78
|
|
|
$link->click(); |
|
79
|
|
|
$this->awaitAjax(); |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
|
When comparing two booleans, it is generally considered safer to use the strict comparison operator.