1 | <?php |
||
17 | class ResponsiveContext extends RawMinkContext { |
||
18 | |||
19 | /** |
||
20 | * Default list of device definitions. |
||
21 | * |
||
22 | * @var array |
||
23 | */ |
||
24 | protected $defaultDevices = [ |
||
25 | 'mobile_portrait' => '360x640', |
||
26 | 'mobile_landscape' => '640x360', |
||
27 | 'tablet_portrait' => '768x1024', |
||
28 | 'tablet_landscape' => '1024x768', |
||
29 | 'laptop' => '1280x800', |
||
30 | 'desktop' => '2560x1440', |
||
31 | ]; |
||
32 | |||
33 | /** |
||
34 | * Contains list of processed devices. |
||
35 | * |
||
36 | * @var array |
||
37 | */ |
||
38 | protected $devices = []; |
||
39 | |||
40 | /** |
||
41 | * ResponsiveContext constructor. |
||
42 | * |
||
43 | * @param array $devices |
||
44 | * List of devices. |
||
45 | */ |
||
46 | public function __construct($devices = []) { |
||
51 | |||
52 | /** |
||
53 | * Process devices. |
||
54 | * |
||
55 | * @param array $devices |
||
56 | * List of devices. |
||
57 | */ |
||
58 | private function processDevices(array $devices) { |
||
65 | |||
66 | /** |
||
67 | * Get device resolution. |
||
68 | * |
||
69 | * @param string $name |
||
70 | * Device name. |
||
71 | * |
||
72 | * @return ResolutionComponent |
||
73 | * Resolution object. |
||
74 | */ |
||
75 | protected function getDeviceResolution($name) { |
||
79 | |||
80 | /** |
||
81 | * Resize browser window according to the specified device. |
||
82 | * |
||
83 | * @param string $device |
||
84 | * Device name as specified in behat.yml. |
||
85 | * |
||
86 | * @Given I view the site on a :device device |
||
87 | */ |
||
88 | public function assertDeviceScreenResize($device) { |
||
92 | |||
93 | /** |
||
94 | * Resize browser window width. |
||
95 | * |
||
96 | * @param string $size |
||
97 | * Size in pixel. |
||
98 | * |
||
99 | * @throws \Behat\Mink\Exception\ExpectationException |
||
100 | * |
||
101 | * @Then the browser window width should be :size |
||
102 | */ |
||
103 | public function assertBrowserWindowWidth($size) { |
||
109 | |||
110 | /** |
||
111 | * Resize browser window height. |
||
112 | * |
||
113 | * @param string $size |
||
114 | * Size in pixel. |
||
115 | * |
||
116 | * @throws \Behat\Mink\Exception\ExpectationException |
||
117 | * |
||
118 | * @Then the browser window height should be :size |
||
119 | */ |
||
120 | public function assertBrowserWindowHeight($size) { |
||
126 | |||
127 | } |
||
128 |