neat 1.7.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.circleci/config.yml +34 -0
- data/.github/ISSUE_TEMPLATE.md +22 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +8 -0
- data/.gitignore +4 -2
- data/.hound.yml +5 -0
- data/.npmignore +20 -0
- data/.scss-lint.yml +239 -0
- data/.tool-versions +2 -0
- data/CHANGELOG.md +388 -0
- data/CODE_OF_CONDUCT.md +6 -0
- data/CONTRIBUTING.md +16 -1
- data/Gemfile +1 -2
- data/Gulpfile.js +42 -0
- data/{LICENSE → LICENSE.md} +8 -10
- data/README.md +138 -214
- data/RELEASING.md +27 -0
- data/Rakefile +3 -17
- data/bin/neat +2 -2
- data/contrib/base/_variables.scss +8 -0
- data/contrib/index.html +90 -0
- data/contrib/patterns/_box.scss +11 -0
- data/contrib/patterns/_global.scss +32 -0
- data/contrib/patterns/_grid-collapse.scss +3 -0
- data/contrib/patterns/_grid-media.scss +36 -0
- data/contrib/patterns/_grid-nested.scss +12 -0
- data/contrib/patterns/_grid-push.scss +7 -0
- data/contrib/patterns/_grid-shift.scss +7 -0
- data/contrib/patterns/_grid-visual.scss +3 -0
- data/contrib/patterns/_grid.scss +39 -0
- data/contrib/styles.scss +13 -0
- data/core/_neat.scss +26 -0
- data/core/neat/functions/_neat-append-grid-visual.scss +21 -0
- data/core/neat/functions/_neat-column-default.scss +23 -0
- data/core/neat/functions/_neat-column-ratio.scss +24 -0
- data/core/neat/functions/_neat-column-width.scss +25 -0
- data/core/neat/functions/_neat-float-direction.scss +22 -0
- data/core/neat/functions/_neat-merge-defaults.scss +23 -0
- data/core/neat/functions/_neat-opposite-direction.scss +22 -0
- data/core/neat/functions/_neat-parse-columns.scss +22 -0
- data/core/neat/functions/_neat-parse-media.scss +20 -0
- data/core/neat/functions/_retrieve-neat-settings.scss +19 -0
- data/core/neat/mixins/_grid-collapse.scss +35 -0
- data/core/neat/mixins/_grid-column.scss +39 -0
- data/core/neat/mixins/_grid-container.scss +31 -0
- data/core/neat/mixins/_grid-media.scss +88 -0
- data/core/neat/mixins/_grid-push.scss +37 -0
- data/core/neat/mixins/_grid-shift.scss +36 -0
- data/core/neat/mixins/_grid-visual.scss +41 -0
- data/core/neat/settings/_settings.scss +74 -0
- data/eyeglass-exports.js +7 -0
- data/index.js +7 -0
- data/lib/neat/generator.rb +43 -26
- data/lib/neat/version.rb +1 -1
- data/lib/neat.rb +6 -11
- data/neat.gemspec +26 -31
- data/package-lock.json +5960 -0
- data/package.json +47 -0
- data/spec/.keep +0 -0
- data/spec/fixtures/_setup.scss +1 -0
- data/spec/fixtures/functions/neat-column-default.scss +22 -0
- data/spec/fixtures/functions/neat-column-width.scss +30 -0
- data/spec/fixtures/functions/neat-float-direction.scss +17 -0
- data/spec/fixtures/functions/neat-opposite-direction.scss +17 -0
- data/spec/fixtures/functions/neat-parse-media.scss +9 -0
- data/spec/fixtures/functions/retrieve-neat-settings.scss +22 -0
- data/spec/fixtures/mixins/grid-collapse.scss +14 -0
- data/spec/fixtures/mixins/grid-column.scss +57 -0
- data/spec/fixtures/mixins/grid-container.scss +5 -0
- data/spec/fixtures/mixins/grid-media.scss +45 -0
- data/spec/fixtures/mixins/grid-push.scss +38 -0
- data/spec/fixtures/mixins/grid-shift.scss +38 -0
- data/spec/neat/functions/neat_column_default_spec.rb +35 -0
- data/spec/neat/functions/neat_column_width_spec.rb +47 -0
- data/spec/neat/functions/neat_float_direction_spec.rb +23 -0
- data/spec/neat/functions/neat_opposite_direction_spec.rb +23 -0
- data/spec/neat/functions/neat_parse_media_spec.rb +23 -0
- data/spec/neat/functions/retrieve_neat_settings_spec.rb +35 -0
- data/spec/neat/mixins/grid_collapse_spec.rb +26 -0
- data/spec/neat/mixins/grid_column_spec.rb +101 -0
- data/spec/neat/mixins/grid_container_spec.rb +17 -0
- data/spec/neat/mixins/grid_media_spec.rb +39 -0
- data/spec/neat/mixins/grid_push_spec.rb +59 -0
- data/spec/neat/mixins/grid_shift_spec.rb +59 -0
- data/spec/spec_helper.rb +5 -8
- data/spec/support/matchers/be_contained_in.rb +1 -1
- data/spec/support/matchers/have_rule.rb +8 -6
- data/spec/support/matchers/have_ruleset.rb +20 -0
- data/spec/support/matchers/have_value.rb +9 -7
- data/spec/support/parser_support.rb +8 -1
- data/spec/support/sass_support.rb +3 -3
- metadata +98 -148
- data/.rspec +0 -2
- data/.travis.yml +0 -5
- data/NEWS.md +0 -47
- data/app/assets/stylesheets/_neat-helpers.scss +0 -8
- data/app/assets/stylesheets/_neat.scss +0 -23
- data/app/assets/stylesheets/functions/_new-breakpoint.scss +0 -49
- data/app/assets/stylesheets/functions/_private.scss +0 -108
- data/app/assets/stylesheets/grid/_box-sizing.scss +0 -11
- data/app/assets/stylesheets/grid/_direction-context.scss +0 -31
- data/app/assets/stylesheets/grid/_display-context.scss +0 -26
- data/app/assets/stylesheets/grid/_fill-parent.scss +0 -22
- data/app/assets/stylesheets/grid/_media.scss +0 -92
- data/app/assets/stylesheets/grid/_omega.scss +0 -91
- data/app/assets/stylesheets/grid/_outer-container.scss +0 -36
- data/app/assets/stylesheets/grid/_pad.scss +0 -23
- data/app/assets/stylesheets/grid/_private.scss +0 -35
- data/app/assets/stylesheets/grid/_row.scss +0 -53
- data/app/assets/stylesheets/grid/_shift.scss +0 -48
- data/app/assets/stylesheets/grid/_span-columns.scss +0 -90
- data/app/assets/stylesheets/grid/_to-deprecate.scss +0 -105
- data/app/assets/stylesheets/grid/_visual-grid.scss +0 -40
- data/app/assets/stylesheets/settings/_disable-warnings.scss +0 -11
- data/app/assets/stylesheets/settings/_grid.scss +0 -53
- data/app/assets/stylesheets/settings/_visual-grid.scss +0 -25
- data/bower.json +0 -22
- data/lib/neat/engine.rb +0 -5
- data/lib/tasks/install.rake +0 -21
- data/sache.json +0 -5
- data/spec/neat/columns_spec.rb +0 -73
- data/spec/neat/container_spec.rb +0 -21
- data/spec/neat/default_spec.rb +0 -15
- data/spec/neat/direction_spec.rb +0 -19
- data/spec/neat/display_spec.rb +0 -19
- data/spec/neat/media_spec.rb +0 -55
- data/spec/neat/new_breakpoint_spec.rb +0 -17
- data/spec/neat/omega_spec.rb +0 -43
- data/spec/neat/pad_spec.rb +0 -32
- data/spec/neat/row_spec.rb +0 -39
- data/spec/neat/shift_spec.rb +0 -41
- data/spec/support/bourbon_support.rb +0 -9
- data/test/_setup.scss +0 -3
- data/test/default.scss +0 -1
- data/test/direction-context.scss +0 -13
- data/test/display-context.scss +0 -15
- data/test/media.scss +0 -39
- data/test/new-breakpoint.scss +0 -13
- data/test/omega.scss +0 -25
- data/test/outer-container.scss +0 -11
- data/test/pad.scss +0 -17
- data/test/row.scss +0 -26
- data/test/shift.scss +0 -36
- data/test/span-columns.scss +0 -21
@@ -0,0 +1,101 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "grid-column" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("mixins/grid-column")
|
6
|
+
end
|
7
|
+
|
8
|
+
context "called without a specified grid" do
|
9
|
+
it "applies one column in the default 12-column grid" do
|
10
|
+
ruleset = "width: calc(8.33333% - 21.66667px); " +
|
11
|
+
"float: left; " +
|
12
|
+
"margin-left: 20px;"
|
13
|
+
|
14
|
+
expect(".grid-column-1-of-default").to have_ruleset(ruleset)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "applies six columns in the default 12-column grid" do
|
18
|
+
ruleset = "width: calc(50% - 30px); " +
|
19
|
+
"float: left; " +
|
20
|
+
"margin-left: 20px;"
|
21
|
+
|
22
|
+
expect(".grid-column-6-of-default").to have_ruleset(ruleset)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "applies twelve columns in the default 12-column grid" do
|
26
|
+
ruleset = "width: calc(100% - 40px); " +
|
27
|
+
"float: left; " +
|
28
|
+
"margin-left: 20px;"
|
29
|
+
|
30
|
+
expect(".grid-column-12-of-default").to have_ruleset(ruleset)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "applies a three fifths column in shorthand with the default grid" do
|
34
|
+
ruleset = "width: calc(60% - 32px); " +
|
35
|
+
"float: left; " +
|
36
|
+
"margin-left: 20px;"
|
37
|
+
|
38
|
+
expect(".grid-column-3-of-5-shorthand").to have_ruleset(ruleset)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context "called with a custom grid" do
|
43
|
+
it "applies one column" do
|
44
|
+
ruleset = "width: calc(16.66667% - 1.16667em); " +
|
45
|
+
"float: left; " +
|
46
|
+
"margin-left: 1em;"
|
47
|
+
|
48
|
+
expect(".grid-column-1-of-6").to have_ruleset(ruleset)
|
49
|
+
end
|
50
|
+
|
51
|
+
it "applies four columns" do
|
52
|
+
ruleset = "width: calc(66.66667% - 1.66667em); " +
|
53
|
+
"float: left; " +
|
54
|
+
"margin-left: 1em;"
|
55
|
+
|
56
|
+
expect(".grid-column-4-of-6").to have_ruleset(ruleset)
|
57
|
+
end
|
58
|
+
|
59
|
+
it "applies six columns" do
|
60
|
+
ruleset = "width: calc(100% - 2em); " +
|
61
|
+
"float: left; " +
|
62
|
+
"margin-left: 1em;"
|
63
|
+
|
64
|
+
expect(".grid-column-6-of-6").to have_ruleset(ruleset)
|
65
|
+
end
|
66
|
+
|
67
|
+
it "applies a three fifths column in shorthand" do
|
68
|
+
ruleset = "width: calc(60% - 1.6em); " +
|
69
|
+
"float: left; " +
|
70
|
+
"margin-left: 1em;"
|
71
|
+
|
72
|
+
expect(".grid-column-3-of-5-shorthand-six-grid").to have_ruleset(ruleset)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
context "called with a weirder custom grid" do
|
77
|
+
it "applies five columns" do
|
78
|
+
ruleset = "width: calc(5.88235% - 10.58824px); " +
|
79
|
+
"float: left; " +
|
80
|
+
"margin-left: 10px;"
|
81
|
+
|
82
|
+
expect(".grid-column-5-of-17").to have_ruleset(ruleset)
|
83
|
+
end
|
84
|
+
|
85
|
+
it "applies eleven columns" do
|
86
|
+
ruleset = "width: calc(35.29412% - 13.52941px); " +
|
87
|
+
"float: left; " +
|
88
|
+
"margin-left: 10px;"
|
89
|
+
|
90
|
+
expect(".grid-column-11-of-17").to have_ruleset(ruleset)
|
91
|
+
end
|
92
|
+
|
93
|
+
it "applies thirteen columns" do
|
94
|
+
ruleset = "width: calc(70.58824% - 17.05882px); " +
|
95
|
+
"float: left; " +
|
96
|
+
"margin-left: 10px;"
|
97
|
+
|
98
|
+
expect(".grid-column-13-of-17").to have_ruleset(ruleset)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "grid-container" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("mixins/grid-container")
|
6
|
+
end
|
7
|
+
|
8
|
+
context "called with default settings" do
|
9
|
+
it "adds after element" do
|
10
|
+
ruleset = "clear: both; " +
|
11
|
+
"content: \"\"; " +
|
12
|
+
"display: block;"
|
13
|
+
|
14
|
+
expect(".grid-container::after").to have_ruleset(ruleset)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "@include grid-media() {...}" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("mixins/grid-media")
|
6
|
+
end
|
7
|
+
|
8
|
+
context "with argument ($custom-neat-grid)" do
|
9
|
+
it "outputs @media only screen and (min-width: 1000px)" do
|
10
|
+
expect(".grid-column-media-custom-neat-grid").to be_contained_in("only screen and (min-width: 1000px)")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context "with argument ($specific-neat-grid)" do
|
15
|
+
it "outputs @media only screen and (min-width: 1000px) and (max-width: 1100px)" do
|
16
|
+
expect(".grid-column-media-specific-neat-grid").to be_contained_in("only screen and (min-width: 1000px) and (max-width: 1100px)")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context "with argument ($print-neat-grid)" do
|
21
|
+
it "outputs @media print" do
|
22
|
+
expect(".grid-column-media-print-neat-grid").to be_contained_in("print")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context "with argument ($custom-neat-grid, $specific-neat-grid, $print-neat-grid)" do
|
27
|
+
it "outputs @media only screen and (min-width: 1000px)" do
|
28
|
+
expect(".grid-column-media-combined-grid").to be_contained_in("only screen and (min-width: 1000px)")
|
29
|
+
end
|
30
|
+
|
31
|
+
it "outputs @media only screen and (min-width: 1000px) and (max-width: 1100px)" do
|
32
|
+
expect(".grid-column-media-combined-grid").to be_contained_in("only screen and (min-width: 1000px) and (max-width: 1100px)")
|
33
|
+
end
|
34
|
+
|
35
|
+
it "outputs @media print" do
|
36
|
+
expect(".grid-column-media-combined-grid").to be_contained_in("print")
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "grid-push" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("mixins/grid-push")
|
6
|
+
end
|
7
|
+
|
8
|
+
context "called with default settings" do
|
9
|
+
it "adds margin for just the gutter with no specified column" do
|
10
|
+
rule = "margin-left: 20px"
|
11
|
+
|
12
|
+
expect(".grid-push-default").to have_rule(rule)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "adds margin for one column" do
|
16
|
+
rule = "margin-left: calc(8.33333% - 21.66667px + 40px)"
|
17
|
+
|
18
|
+
expect(".grid-push-1-default").to have_rule(rule)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "adds margin for six columns" do
|
22
|
+
rule = "margin-left: calc(50% - 30px + 40px)"
|
23
|
+
|
24
|
+
expect(".grid-push-6-default").to have_rule(rule)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "adds margin for negative six columns" do
|
28
|
+
rule = "margin-left: calc(-50% - 10px + 40px)"
|
29
|
+
|
30
|
+
expect(".grid-push-neg-6-default").to have_rule(rule)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context "called with custom settings" do
|
35
|
+
it "adds margin for just the gutter with no specified column" do
|
36
|
+
rule = "margin-left: 2rem"
|
37
|
+
|
38
|
+
expect(".grid-push-0-six").to have_rule(rule)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "adds margin for one column" do
|
42
|
+
rule = "margin-left: calc(16.66667% - 2.33333rem + 4rem)"
|
43
|
+
|
44
|
+
expect(".grid-push-1-six").to have_rule(rule)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "adds margin for three columns" do
|
48
|
+
rule = "margin-left: calc(50% - 3rem + 4rem)"
|
49
|
+
|
50
|
+
expect(".grid-push-3-six").to have_rule(rule)
|
51
|
+
end
|
52
|
+
|
53
|
+
it "adds margin for negative three columns" do
|
54
|
+
rule = "margin-left: calc(-50% - 1rem + 4rem)"
|
55
|
+
|
56
|
+
expect(".grid-push-neg-3-six").to have_rule(rule)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "grid-shift" do
|
4
|
+
before(:all) do
|
5
|
+
ParserSupport.parse_file("mixins/grid-shift")
|
6
|
+
end
|
7
|
+
|
8
|
+
context "called with default settings" do
|
9
|
+
it "adds relative positioning without moving the object" do
|
10
|
+
rule = "left: auto; position: relative;"
|
11
|
+
|
12
|
+
expect(".grid-shift-default").to have_ruleset(rule)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "moves the object one column to the right" do
|
16
|
+
rule = "left: calc(8.33333% - 21.66667px + 20px); position: relative;"
|
17
|
+
|
18
|
+
expect(".grid-shift-1-default").to have_ruleset(rule)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "moves the object six columns to the right" do
|
22
|
+
rule = "left: calc(50% - 30px + 20px); position: relative;"
|
23
|
+
|
24
|
+
expect(".grid-shift-6-default").to have_ruleset(rule)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "moves the object six columns to the left" do
|
28
|
+
rule = "left: calc(-50% - 10px + 20px); position: relative;"
|
29
|
+
|
30
|
+
expect(".grid-shift-neg-6-default").to have_ruleset(rule)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context "called with custom settings" do
|
35
|
+
it "adds relative positioning without moving the object" do
|
36
|
+
rule = "left: auto; position: relative;"
|
37
|
+
|
38
|
+
expect(".grid-shift-0-six").to have_ruleset(rule)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "moves the object one column to the right" do
|
42
|
+
rule = "left: calc(16.66667% - 2.33333rem + 2rem); position: relative;"
|
43
|
+
|
44
|
+
expect(".grid-shift-1-six").to have_ruleset(rule)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "moves the object three columns to the right" do
|
48
|
+
rule = "left: calc(50% - 3rem + 2rem); position: relative;"
|
49
|
+
|
50
|
+
expect(".grid-shift-3-six").to have_ruleset(rule)
|
51
|
+
end
|
52
|
+
|
53
|
+
it "moves the object three columns to the left" do
|
54
|
+
rule = "left: calc(-50% - 1rem + 2rem); position: relative;"
|
55
|
+
|
56
|
+
expect(".grid-shift-neg-3-six").to have_ruleset(rule)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,25 +1,22 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__),
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
2
2
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
3
|
+
require "rspec"
|
4
|
+
require "neat"
|
5
|
+
require "aruba/api"
|
6
|
+
require "css_parser"
|
7
7
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
8
8
|
|
9
9
|
RSpec.configure do |config|
|
10
|
-
config.include BourbonSupport
|
11
10
|
config.include SassSupport
|
12
11
|
config.include CssParser
|
13
12
|
config.include ParserSupport
|
14
13
|
config.include Aruba::Api
|
15
14
|
|
16
15
|
config.before(:all) do
|
17
|
-
install_bourbon_files
|
18
16
|
generate_css
|
19
17
|
end
|
20
18
|
|
21
19
|
config.after(:all) do
|
22
|
-
remove_bourbon_files
|
23
20
|
clean_up
|
24
21
|
end
|
25
22
|
end
|
@@ -1,14 +1,16 @@
|
|
1
1
|
RSpec::Matchers.define :have_rule do |expected|
|
2
|
-
match do |
|
3
|
-
@rules = rules_from_selector(
|
2
|
+
match do |selector|
|
3
|
+
@rules = rules_from_selector(selector)
|
4
4
|
@rules.include? expected
|
5
5
|
end
|
6
6
|
|
7
|
-
failure_message do |
|
7
|
+
failure_message do |selector|
|
8
8
|
if @rules.empty?
|
9
|
-
%{no CSS
|
9
|
+
%{no CSS for selector #{selector} were found}
|
10
10
|
else
|
11
|
-
|
11
|
+
rules = @rules.join("; ")
|
12
|
+
%{Expected selector #{selector} to have CSS rule "#{expected}".
|
13
|
+
Had "#{rules}".}
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
@@ -24,7 +26,7 @@ RSpec::Matchers.define :have_rule do |expected|
|
|
24
26
|
def rules(rulesets)
|
25
27
|
rules = []
|
26
28
|
rulesets.map do |ruleset|
|
27
|
-
ruleset.split(
|
29
|
+
ruleset.split(";").each do |rule|
|
28
30
|
rules << rule.strip
|
29
31
|
end
|
30
32
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
RSpec::Matchers.define :have_ruleset do |expected|
|
2
|
+
match do |selector|
|
3
|
+
@ruleset = rules_from_selector(selector)
|
4
|
+
@ruleset.join("; ") == expected
|
5
|
+
end
|
6
|
+
|
7
|
+
failure_message do |selector|
|
8
|
+
if @ruleset.empty?
|
9
|
+
%{no CSS for selector #{selector} were found}
|
10
|
+
else
|
11
|
+
ruleset = @ruleset.join("; ")
|
12
|
+
%{Expected selector #{selector} to have CSS rule "#{expected}".
|
13
|
+
Had "#{ruleset}".}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def rules_from_selector(selector)
|
18
|
+
ParserSupport.parser.find_by_selector(selector)
|
19
|
+
end
|
20
|
+
end
|
@@ -1,15 +1,17 @@
|
|
1
1
|
RSpec::Matchers.define :have_value do |expected|
|
2
|
-
match do |
|
3
|
-
|
4
|
-
value_attribute = ParserSupport.parser.find_by_selector(
|
2
|
+
match do |variable|
|
3
|
+
selector_class = variable.sub("$", ".")
|
4
|
+
@value_attribute = ParserSupport.parser.find_by_selector(selector_class)[0]
|
5
5
|
|
6
|
-
unless value_attribute.nil?
|
7
|
-
actual_value = value_attribute.split(
|
6
|
+
unless @value_attribute.nil?
|
7
|
+
actual_value = @value_attribute.split(":")[1].strip.sub(";", "")
|
8
8
|
actual_value == expected
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
failure_message do |
|
13
|
-
|
12
|
+
failure_message do |variable_name|
|
13
|
+
value_attribute = @value_attribute.to_s
|
14
|
+
%{Expected variable #{variable_name} to have value "#{expected}".
|
15
|
+
Had "#{value_attribute}".}
|
14
16
|
end
|
15
17
|
end
|
@@ -4,6 +4,13 @@ module ParserSupport
|
|
4
4
|
end
|
5
5
|
|
6
6
|
def self.parse_file(identifier)
|
7
|
-
|
7
|
+
parser.load_file!("tmp/#{identifier}.css")
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.show_contents(identifier)
|
11
|
+
css_file_contents = File.open("tmp/#{identifier}.css").read
|
12
|
+
css_file_contents.each_line do |line|
|
13
|
+
puts line
|
14
|
+
end
|
8
15
|
end
|
9
16
|
end
|