Loading lib/jsduck/tag/css_mixin.rb +10 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,16 @@ module JsDuck::Tag } end def process_code(code) h = super(code) h[:params] = code[:params] h end def merge(h, docs, code) JsDuck::ParamsMerger.merge(h, docs, code) end def to_html(mixin, cls) member_link(mixin) + member_params(mixin[:params]) end Loading spec/aggregator_css_spec.rb +28 −0 Original line number Diff line number Diff line Loading @@ -123,4 +123,32 @@ describe JsDuck::Aggregator do end end describe "CSS doc-comment followed by @mixin with parameters" do before do @doc = parse_member(<<-EOCSS) /** * Creates an awesome button. */ @mixin my-button($foo, $bar: 2px) { } EOCSS end it "detects parameters" do @doc[:params].length.should == 2 end it "detects first param name" do @doc[:params][0][:name].should == "$foo" end it "detects second param name" do @doc[:params][1][:name].should == "$bar" end it "detects second param type" do @doc[:params][1][:type].should == "number" end it "detects second param default value" do @doc[:params][1][:default].should == "2px" end end end Loading
lib/jsduck/tag/css_mixin.rb +10 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,16 @@ module JsDuck::Tag } end def process_code(code) h = super(code) h[:params] = code[:params] h end def merge(h, docs, code) JsDuck::ParamsMerger.merge(h, docs, code) end def to_html(mixin, cls) member_link(mixin) + member_params(mixin[:params]) end Loading
spec/aggregator_css_spec.rb +28 −0 Original line number Diff line number Diff line Loading @@ -123,4 +123,32 @@ describe JsDuck::Aggregator do end end describe "CSS doc-comment followed by @mixin with parameters" do before do @doc = parse_member(<<-EOCSS) /** * Creates an awesome button. */ @mixin my-button($foo, $bar: 2px) { } EOCSS end it "detects parameters" do @doc[:params].length.should == 2 end it "detects first param name" do @doc[:params][0][:name].should == "$foo" end it "detects second param name" do @doc[:params][1][:name].should == "$bar" end it "detects second param type" do @doc[:params][1][:type].should == "number" end it "detects second param default value" do @doc[:params][1][:default].should == "2px" end end end