-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-breakpoints.php
executable file
·81 lines (63 loc) · 1.68 KB
/
test-breakpoints.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
/**
* Class Test_Breakpoints
*
* @package Respect_Art_Direction
*/
/**
* Test Breakpoint functionality.
*/
class Test_Breakpoints extends WP_UnitTestCase {
/**
* A single example test.
*/
function test_rad_add_breakpoint() {
global $rad_breakpoints;
$this->assertEquals( $rad_breakpoints, array() );
rad_add_breakpoint( 'some_breakpoint_name', '(max-width: 500px)' );
$this->assertEquals( $rad_breakpoints, array(
'some_breakpoint_name' => '(max-width: 500px)',
) );
}
/**
* Test adding multiple breakpoints at once.
*/
function test_rad_add_breakpoints() {
global $rad_breakpoints;
rad_add_breakpoints( array(
'some_breakpoint' => '(a media query)',
'another_breakpoint' => '(more media queries)',
) );
$this->assertEquals( $rad_breakpoints, array(
'some_breakpoint' => '(a media query)',
'another_breakpoint' => '(more media queries)',
) );
}
/**
* Test retreiving a breakpoint.
*/
function test_rad_get_breakpoint() {
$this->assertFalse( rad_get_breakpoint( 'does_not_exist' ) );
rad_add_breakpoint( 'test_breakpoint', '(max-width: 500px)' );
$this->assertEquals( '(max-width: 500px)', rad_get_breakpoint( 'test_breakpoint' ) );
}
/**
* Test removing a breakpoint.
*/
function test_rad_remove_breakpoint() {
global $rad_breakpoints;
rad_add_breakpoint( 'test_breakpoint', '(max-width:500px)' );
$this->assertEquals( array(
'test_breakpoint' => '(max-width:500px)',
), $rad_breakpoints );
rad_remove_breakpoint( 'test_breakpoint' );
$this->assertEquals( array(), $rad_breakpoints );
}
/**
* Reset breakpoint global.
*/
function tearDown() {
global $rad_breakpoints;
$rad_breakpoints = array();
}
}