@@ 20-51 (lines=32) @@ | ||
17 | $this->assertEquals([], $field->getRange()); |
|
18 | } |
|
19 | ||
20 | public function testRange() |
|
21 | { |
|
22 | $rangeField = RangeField::create( |
|
23 | 'TestInt', |
|
24 | 'Test', |
|
25 | 50, |
|
26 | 25, |
|
27 | 75, |
|
28 | ['min' => 25, '17%' => 33, '50%' => 50, '83%' => 66, 'max' => 75] |
|
29 | ); |
|
30 | ||
31 | $rangeField->Field([]); |
|
32 | ||
33 | $expected = [ |
|
34 | 'start' => [50], |
|
35 | 'snap' => false, |
|
36 | 'range' => [ |
|
37 | 'min' => 25, |
|
38 | '17%' => 33, |
|
39 | '50%' => 50, |
|
40 | '83%' => 66, |
|
41 | 'max' => 75 |
|
42 | ], |
|
43 | 'pips' => [ // Show a scale with the slider |
|
44 | 'mode' => 'steps', |
|
45 | 'stepped' => true, |
|
46 | 'density' => 4 |
|
47 | ] |
|
48 | ]; |
|
49 | ||
50 | $this->assertEquals($expected, $rangeField->getData()); |
|
51 | } |
|
52 | ||
53 | public function testSnap() |
|
54 | { |
|
@@ 53-86 (lines=34) @@ | ||
50 | $this->assertEquals($expected, $rangeField->getData()); |
|
51 | } |
|
52 | ||
53 | public function testSnap() |
|
54 | { |
|
55 | $rangeField = RangeField::create( |
|
56 | 'TestInt', |
|
57 | 'Test', |
|
58 | 50, |
|
59 | 25, |
|
60 | 75, |
|
61 | ['min' => 25, '17%' => 33, '50%' => 50, '83%' => 66, 'max' => 75] |
|
62 | ); |
|
63 | ||
64 | $rangeField->setSnap(true); |
|
65 | ||
66 | $rangeField->Field([]); |
|
67 | ||
68 | $expected = [ |
|
69 | 'start' => [50], |
|
70 | 'snap' => true, |
|
71 | 'range' => [ |
|
72 | 'min' => 25, |
|
73 | '17%' => 33, |
|
74 | '50%' => 50, |
|
75 | '83%' => 66, |
|
76 | 'max' => 75 |
|
77 | ], |
|
78 | 'pips' => [ // Show a scale with the slider |
|
79 | 'mode' => 'steps', |
|
80 | 'stepped' => true, |
|
81 | 'density' => 4 |
|
82 | ] |
|
83 | ]; |
|
84 | ||
85 | $this->assertEquals($expected, $rangeField->getData()); |
|
86 | } |
|
87 | ||
88 | public function testGetSetMin() |
|
89 | { |