Skip to content

Commit 39e89a4

Browse files
committed
add @page tests
1 parent ee68d4b commit 39e89a4

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
test:
33
@./node_modules/.bin/mocha \
44
--require should \
5-
--reporter spec
5+
--reporter spec \
6+
--bail
67

7-
.PHONY: test
8+
.PHONY: test

index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,12 @@ Compiler.prototype.keyframe = function(node){
167167
*/
168168

169169
Compiler.prototype.page = function(node){
170-
return '@page ' + node.selectors.join(', ')
171-
+ ' {\n'
170+
var sel = node.selectors.length
171+
? node.selectors.join(', ') + ' '
172+
: '';
173+
174+
return '@page ' + sel
175+
+ '{\n'
172176
+ this.indent(1)
173177
+ node.declarations.map(this.visit, this).join('\n')
174178
+ this.indent(-1)

test/cases/page.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@page {
2+
margin: 2.5cm;
3+
}
4+
5+
@page :left {
6+
margin-left: 5cm;
7+
}
8+
9+
@page :right {
10+
margin-right: 5cm;
11+
}
12+
13+
@page :first {
14+
margin-top: 8cm;
15+
}

0 commit comments

Comments
 (0)