Loading lib/jsduck/doc_parser.rb +1 −1 Original line number Diff line number Diff line Loading @@ -220,7 +220,7 @@ module JsDuck match(/@property/) add_tag(:property) maybe_type maybe_name maybe_ident_chain(:name) skip_white end Loading lib/jsduck/merger.rb +6 −4 Original line number Diff line number Diff line Loading @@ -164,7 +164,7 @@ module JsDuck :owner => detect_owner(doc_map) || owner, :type => detect_type(:cfg, doc_map, code), :doc => detect_doc(docs), :properties => detect_subproperties(docs), :properties => detect_subproperties(docs, :cfg), }, doc_map) end Loading @@ -176,6 +176,7 @@ module JsDuck :owner => detect_owner(doc_map), :type => detect_type(:property, doc_map, code), :doc => detect_doc(docs), :properties => detect_subproperties(docs, :property), }, doc_map) end Loading Loading @@ -339,8 +340,9 @@ module JsDuck combine_properties(docs.find_all {|tag| tag[:tagname] == :param}) end def detect_subproperties(docs) combine_properties(docs.find_all {|tag| tag[:tagname] == :cfg})[0][:properties] def detect_subproperties(docs, tagname) prop_docs = docs.find_all {|tag| tag[:tagname] == tagname} prop_docs.length > 0 ? combine_properties(prop_docs)[0][:properties] : [] end def combine_properties(raw_items) Loading Loading @@ -382,7 +384,7 @@ module JsDuck end def subproperty?(tag) tag[:tagname] == :cfg && tag[:name] =~ /\./ (tag[:tagname] == :cfg || tag[:tagname] == :property) && tag[:name] =~ /\./ end # Build map of at-tags for quick lookup Loading spec/aggregator_object_properties_spec.rb +26 −0 Original line number Diff line number Diff line Loading @@ -132,4 +132,30 @@ describe JsDuck::Aggregator do it_should_behave_like "object with properties" end end describe "property with properties" do before do @doc = parse(<<-EOS) /** * @property {Object} coord Geographical coordinates * @property {Object} coord.lat Latitude * @property {Number} coord.lat.numerator Numerator part of a fraction * @property {Number} coord.lat.denominator Denominator part of a fraction * @property {Number} coord.lng Longitude */ EOS end it "is interpreted as single property" do @doc.length.should == 1 end describe "the property" do before do @obj = @doc[0] end it_should_behave_like "object with properties" end end end Loading
lib/jsduck/doc_parser.rb +1 −1 Original line number Diff line number Diff line Loading @@ -220,7 +220,7 @@ module JsDuck match(/@property/) add_tag(:property) maybe_type maybe_name maybe_ident_chain(:name) skip_white end Loading
lib/jsduck/merger.rb +6 −4 Original line number Diff line number Diff line Loading @@ -164,7 +164,7 @@ module JsDuck :owner => detect_owner(doc_map) || owner, :type => detect_type(:cfg, doc_map, code), :doc => detect_doc(docs), :properties => detect_subproperties(docs), :properties => detect_subproperties(docs, :cfg), }, doc_map) end Loading @@ -176,6 +176,7 @@ module JsDuck :owner => detect_owner(doc_map), :type => detect_type(:property, doc_map, code), :doc => detect_doc(docs), :properties => detect_subproperties(docs, :property), }, doc_map) end Loading Loading @@ -339,8 +340,9 @@ module JsDuck combine_properties(docs.find_all {|tag| tag[:tagname] == :param}) end def detect_subproperties(docs) combine_properties(docs.find_all {|tag| tag[:tagname] == :cfg})[0][:properties] def detect_subproperties(docs, tagname) prop_docs = docs.find_all {|tag| tag[:tagname] == tagname} prop_docs.length > 0 ? combine_properties(prop_docs)[0][:properties] : [] end def combine_properties(raw_items) Loading Loading @@ -382,7 +384,7 @@ module JsDuck end def subproperty?(tag) tag[:tagname] == :cfg && tag[:name] =~ /\./ (tag[:tagname] == :cfg || tag[:tagname] == :property) && tag[:name] =~ /\./ end # Build map of at-tags for quick lookup Loading
spec/aggregator_object_properties_spec.rb +26 −0 Original line number Diff line number Diff line Loading @@ -132,4 +132,30 @@ describe JsDuck::Aggregator do it_should_behave_like "object with properties" end end describe "property with properties" do before do @doc = parse(<<-EOS) /** * @property {Object} coord Geographical coordinates * @property {Object} coord.lat Latitude * @property {Number} coord.lat.numerator Numerator part of a fraction * @property {Number} coord.lat.denominator Denominator part of a fraction * @property {Number} coord.lng Longitude */ EOS end it "is interpreted as single property" do @doc.length.should == 1 end describe "the property" do before do @obj = @doc[0] end it_should_behave_like "object with properties" end end end