Skip to content

Commit 0127183

Browse files
committed
Add unit tests for @namespace support
1 parent e74d5ab commit 0127183

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

tests/Sabberworm/CSS/ParserTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,13 @@ function testCreateShorthands() {
254254
$this->assertSame($sExpected, $oDoc->__toString());
255255
}
256256

257+
function testNamespaces() {
258+
$oDoc = $this->parsedStructureForFile('namespaces');
259+
$sExpected = '@namespace toto "http://toto.example.org";@namespace "http://example.com/foo";@namespace foo url("http://www.example.com/");@namespace foo url("http://www.example.com/");foo|test {gaga: 1;}
260+
|test {gaga: 2;}' . "\n";
261+
$this->assertSame($sExpected, $oDoc->__toString());
262+
}
263+
257264
function testPrefixedGradient() {
258265
$oDoc = $this->parsedStructureForFile('webkit');
259266
$sExpected = '.test {background: -webkit-linear-gradient(top right,white,black);}' . "\n";

tests/files/namespaces.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* From the spec at http://www.w3.org/TR/css3-namespace/ */
2+
3+
@namespace toto "http://toto.example.org";
4+
@namespace "http://example.com/foo";
5+
6+
7+
/* From an introduction at http://www.blooberry.com/indexdot/css/syntax/atrules/namespace.htm */
8+
@namespace foo url("http://www.example.com/");
9+
@namespace foo url('http://www.example.com/');
10+
11+
12+
foo|test {
13+
gaga: 1;
14+
}
15+
16+
|test {
17+
gaga: 2;
18+
}

0 commit comments

Comments
 (0)