Loading lib/jsduck/inline/link.rb +1 −1 Original line number Diff line number Diff line Loading @@ -208,7 +208,7 @@ module JsDuck end def get_matching_member(cls, query) ms = find_members(cls, query).find_all {|m| !m[:private] } ms = find_members(cls, query) if ms.length > 1 instance_ms = ms.find_all {|m| !m[:meta][:static] } instance_ms.length > 0 ? instance_ms[0] : ms.find_all {|m| m[:meta][:static] }[0] Loading spec/doc_formatter_spec.rb +13 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ describe JsDuck::DocFormatter do {:tagname => :cfg, :name => "bar", :id => "cfg-bar"}, {:tagname => :method, :name => "id", :id => "static-method-id", :meta => {:static => true}}, {:tagname => :method, :name => "privMeth", :id => "method-privMeth", :private => true}, ], :alternateClassNames => ["FooBar"] }), Loading @@ -51,6 +52,11 @@ describe JsDuck::DocFormatter do 'Look at <a href="Foo#static-method-id">Foo.id</a>' end it "replaces {@link Foo#privMeth} with link to private class member" do @formatter.replace("Look at {@link Foo#privMeth}").should == 'Look at <a href="Foo#method-privMeth">Foo.privMeth</a>' end it "uses context to replace {@link #bar} with link to class member" do @formatter.replace("Look at {@link #bar}").should == 'Look at <a href="Context#method-bar">bar</a>' Loading Loading @@ -151,7 +157,8 @@ describe JsDuck::DocFormatter do JsDuck::Class.new({ :name => "Context", :members => [ {:tagname => :method, :name => "bar", :id => "method-bar"} {:tagname => :method, :name => "bar", :id => "method-bar"}, {:tagname => :method, :name => "privMeth", :id => "method-privMeth", :private => true}, ] }), ]) Loading Loading @@ -234,6 +241,11 @@ describe JsDuck::DocFormatter do 'Look at <a href="Context#method-bar">bar</a> method' end it "converts #privMeth to link to private method" do @formatter.replace("Look at #privMeth method").should == 'Look at <a href="Context#method-privMeth">privMeth</a> method' end it "Doesn't convert #unknown to link" do @formatter.replace("Ahh, an #unknown method").should == 'Ahh, an #unknown method' Loading Loading
lib/jsduck/inline/link.rb +1 −1 Original line number Diff line number Diff line Loading @@ -208,7 +208,7 @@ module JsDuck end def get_matching_member(cls, query) ms = find_members(cls, query).find_all {|m| !m[:private] } ms = find_members(cls, query) if ms.length > 1 instance_ms = ms.find_all {|m| !m[:meta][:static] } instance_ms.length > 0 ? instance_ms[0] : ms.find_all {|m| m[:meta][:static] }[0] Loading
spec/doc_formatter_spec.rb +13 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ describe JsDuck::DocFormatter do {:tagname => :cfg, :name => "bar", :id => "cfg-bar"}, {:tagname => :method, :name => "id", :id => "static-method-id", :meta => {:static => true}}, {:tagname => :method, :name => "privMeth", :id => "method-privMeth", :private => true}, ], :alternateClassNames => ["FooBar"] }), Loading @@ -51,6 +52,11 @@ describe JsDuck::DocFormatter do 'Look at <a href="Foo#static-method-id">Foo.id</a>' end it "replaces {@link Foo#privMeth} with link to private class member" do @formatter.replace("Look at {@link Foo#privMeth}").should == 'Look at <a href="Foo#method-privMeth">Foo.privMeth</a>' end it "uses context to replace {@link #bar} with link to class member" do @formatter.replace("Look at {@link #bar}").should == 'Look at <a href="Context#method-bar">bar</a>' Loading Loading @@ -151,7 +157,8 @@ describe JsDuck::DocFormatter do JsDuck::Class.new({ :name => "Context", :members => [ {:tagname => :method, :name => "bar", :id => "method-bar"} {:tagname => :method, :name => "bar", :id => "method-bar"}, {:tagname => :method, :name => "privMeth", :id => "method-privMeth", :private => true}, ] }), ]) Loading Loading @@ -234,6 +241,11 @@ describe JsDuck::DocFormatter do 'Look at <a href="Context#method-bar">bar</a> method' end it "converts #privMeth to link to private method" do @formatter.replace("Look at #privMeth method").should == 'Look at <a href="Context#method-privMeth">privMeth</a> method' end it "Doesn't convert #unknown to link" do @formatter.replace("Ahh, an #unknown method").should == 'Ahh, an #unknown method' Loading