forked from leafo/scssphp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFailingTest.php
More file actions
131 lines (118 loc) · 2.63 KB
/
FailingTest.php
File metadata and controls
131 lines (118 loc) · 2.63 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
/**
* SCSSPHP
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp\Tests;
use Leafo\ScssPhp\Compiler;
/**
* Failing tests
*
* {@internal
* Minimal tests as reported in github issues.
* }}
*
* @author Anthon Pang <anthon.pang@gmail.com>
*/
class FailingTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
$this->scss = new Compiler();
}
/**
* @param string $id
* @param string $scss
* @param string $expected
*
* @dataProvider provideFailing
*/
public function testFailing($id, $scss, $expected)
{
static $init = false;
if (! getenv('TEST_SCSS_COMPAT')) {
if (! $init) {
$init = true;
$this->markTestSkipped('Define TEST_SCSS_COMPAT=1 to enable ruby scss compatibility tests');
}
return;
}
$output = $this->compile($scss);
$this->assertEquals(rtrim($expected), rtrim($output), $id);
}
/**
* @return array
*/
public function provideFailing()
{
// @codingStandardsIgnoreStart
return array(
array(
'#67 - weird @extend behavior', <<<'END_OF_SCSS'
.nav-bar {
background: #eee;
> .item {
margin: 0 10px;
}
}
header ul {
@extend .nav-bar;
> li {
@extend .item;
}
}
END_OF_SCSS
, <<<END_OF_EXPECTED
.nav-bar, header ul {
background: #eee; }
.nav-bar > .item, header ul > .item, header ul > li {
margin: 0 10px; }
END_OF_EXPECTED
),
array(
'#368 - self in selector', <<<'END_OF_SCSS'
.test {
&:last-child:not(+ &:first-child) {
padding-left: 10px;
}
}
END_OF_SCSS
, <<<END_OF_EXPECTED
.test:last-child:not(+ .test:first-child) {
padding-left: 10px; }
END_OF_EXPECTED
),
array(
'#371 - nested self selector', <<<'END_OF_SCSS'
ul, ol {
& & {
display: block;
}
}
END_OF_SCSS
, <<<END_OF_EXPECTED
ul ul, ol ul, ul ol, ol ol {
display: block; }
END_OF_EXPECTED
),
/*************************************************************
array(
'', <<<'END_OF_SCSS'
END_OF_SCSS
, <<<END_OF_EXPECTED
END_OF_EXPECTED
),
*************************************************************/
);
// @codingStandardsIgnoreEnd
}
private function compile($str)
{
return trim($this->scss->compile($str));
}
}