forked from zmoazeni/csscss
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreporter_test.rb
More file actions
38 lines (33 loc) · 1 KB
/
reporter_test.rb
File metadata and controls
38 lines (33 loc) · 1 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
require "test_helper"
module Csscss
describe Reporter do
include TypeHelpers
it "formats string result" do
reporter = Reporter.new({
[sel(".foo"), sel(".bar")] => [dec("width", "1px"), dec("border", "black")],
[sel("h1, h2"), sel(".foo"), sel(".baz")] => [dec("display", "none")],
[sel("h1, h2"), sel(".bar")] => [dec("position", "relative")]
})
expected =<<-EXPECTED
{.foo} AND {.bar} share 2 rules
{h1, h2}, {.foo} AND {.baz} share 1 rule
{h1, h2} AND {.bar} share 1 rule
EXPECTED
reporter.report(color:false).must_equal expected
expected =<<-EXPECTED
{.foo} AND {.bar} share 2 rules
- width: 1px
- border: black
{h1, h2}, {.foo} AND {.baz} share 1 rule
- display: none
{h1, h2} AND {.bar} share 1 rule
- position: relative
EXPECTED
reporter.report(verbose:true, color:false).must_equal expected
end
it "prints a new line if there is nothing" do
reporter = Reporter.new({})
reporter.report().must_equal ""
end
end
end