Loading lib/jsduck/doc_parser.rb +1 −1 Original line number Diff line number Diff line Loading @@ -272,7 +272,7 @@ module JsDuck match(/@var/) add_tag(:css_var) maybe_type maybe_name maybe_name_with_default skip_white end Loading lib/jsduck/merger.rb +3 −0 Original line number Diff line number Diff line Loading @@ -211,6 +211,7 @@ module JsDuck :name => detect_name(:css_var, doc_map, code), :owner => detect_owner(doc_map), :type => detect_type(:css_var, doc_map, code), :default => detect_default(:css_var, doc_map, code), :doc => detect_doc(docs), }, doc_map) end Loading Loading @@ -315,6 +316,8 @@ module JsDuck main_tag[:default] elsif code_matches_doc?(tagname, doc_map, code) && code[:type] == :assignment && code[:right] code[:right][:value] elsif code_matches_doc?(tagname, doc_map, code) && code[:type] == :css_var && code[:value][:default] code[:value][:default] end end Loading spec/aggregator_css_spec.rb +20 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,20 @@ describe JsDuck::Aggregator do end end describe "CSS @var with explicit default value" do before do @doc = parse(<<-EOCSS)[0] /** * @var {measurement} [$button-height=25px] */ EOCSS end it "detects default value" do @doc[:default].should == "25px" end end describe "CSS doc-comment followed with $var-name:" do before do @doc = parse(<<-EOCSS)[0] Loading @@ -71,6 +85,9 @@ describe JsDuck::Aggregator do it "detects variable type" do @doc[:type].should == "measurement" end it "detects variable default value" do @doc[:default].should == "25px" end end describe "$var-name: value followed by !default" do Loading @@ -87,6 +104,9 @@ describe JsDuck::Aggregator do it "detects variable type" do @doc[:type].should == "measurement" end it "detects variable default value" do @doc[:default].should == "25px" end end def detect_type(value) Loading Loading
lib/jsduck/doc_parser.rb +1 −1 Original line number Diff line number Diff line Loading @@ -272,7 +272,7 @@ module JsDuck match(/@var/) add_tag(:css_var) maybe_type maybe_name maybe_name_with_default skip_white end Loading
lib/jsduck/merger.rb +3 −0 Original line number Diff line number Diff line Loading @@ -211,6 +211,7 @@ module JsDuck :name => detect_name(:css_var, doc_map, code), :owner => detect_owner(doc_map), :type => detect_type(:css_var, doc_map, code), :default => detect_default(:css_var, doc_map, code), :doc => detect_doc(docs), }, doc_map) end Loading Loading @@ -315,6 +316,8 @@ module JsDuck main_tag[:default] elsif code_matches_doc?(tagname, doc_map, code) && code[:type] == :assignment && code[:right] code[:right][:value] elsif code_matches_doc?(tagname, doc_map, code) && code[:type] == :css_var && code[:value][:default] code[:value][:default] end end Loading
spec/aggregator_css_spec.rb +20 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,20 @@ describe JsDuck::Aggregator do end end describe "CSS @var with explicit default value" do before do @doc = parse(<<-EOCSS)[0] /** * @var {measurement} [$button-height=25px] */ EOCSS end it "detects default value" do @doc[:default].should == "25px" end end describe "CSS doc-comment followed with $var-name:" do before do @doc = parse(<<-EOCSS)[0] Loading @@ -71,6 +85,9 @@ describe JsDuck::Aggregator do it "detects variable type" do @doc[:type].should == "measurement" end it "detects variable default value" do @doc[:default].should == "25px" end end describe "$var-name: value followed by !default" do Loading @@ -87,6 +104,9 @@ describe JsDuck::Aggregator do it "detects variable type" do @doc[:type].should == "measurement" end it "detects variable default value" do @doc[:default].should == "25px" end end def detect_type(value) Loading