Loading lib/jsduck/doc_type.rb +2 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,8 @@ module JsDuck :cfg elsif doc_map[:constructor] :method elsif doc_map[:param] || doc_map[:return] :method else code[:tagname] end Loading spec/doc_type_spec.rb +16 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,14 @@ describe JsDuck::DocType do detect("/** @constructor */").should == :method end it "@param tag" do detect("/** @param {Number} x */").should == :method end it "@return tag" do detect("/** @return {Boolean} */").should == :method end it "function declaration" do detect("/** */ function foo() {}").should == :method end Loading @@ -54,6 +62,10 @@ describe JsDuck::DocType do it "@event tag" do detect("/** @event */").should == :event end it "@event and @param tags" do detect("/** @event @param {Number} x */").should == :event end end describe "detects as config" do Loading Loading @@ -86,6 +98,10 @@ describe JsDuck::DocType do it "@mixin in code" do detect("/** */ @mixin foo-bar {}", :css).should == :css_mixin end it "@param in doc and @mixin in code" do detect("/** @param {number} $foo */ @mixin foo-bar {}", :css).should == :css_mixin end end end Loading
lib/jsduck/doc_type.rb +2 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,8 @@ module JsDuck :cfg elsif doc_map[:constructor] :method elsif doc_map[:param] || doc_map[:return] :method else code[:tagname] end Loading
spec/doc_type_spec.rb +16 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,14 @@ describe JsDuck::DocType do detect("/** @constructor */").should == :method end it "@param tag" do detect("/** @param {Number} x */").should == :method end it "@return tag" do detect("/** @return {Boolean} */").should == :method end it "function declaration" do detect("/** */ function foo() {}").should == :method end Loading @@ -54,6 +62,10 @@ describe JsDuck::DocType do it "@event tag" do detect("/** @event */").should == :event end it "@event and @param tags" do detect("/** @event @param {Number} x */").should == :event end end describe "detects as config" do Loading Loading @@ -86,6 +98,10 @@ describe JsDuck::DocType do it "@mixin in code" do detect("/** */ @mixin foo-bar {}", :css).should == :css_mixin end it "@param in doc and @mixin in code" do detect("/** @param {number} $foo */ @mixin foo-bar {}", :css).should == :css_mixin end end end