Commit f24b13d0 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Fix inheriting from other member types.

Only turn properties into configs when dealing with autodetected members.
parent 369b2458
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ module JsDuck
        end

        # remember properties that have changed to configs
        if m[:tagname] != parent[:tagname]
        if m[:autodetected] && m[:tagname] != parent[:tagname]
          new_cfgs << m
        end
      end
+27 −0
Original line number Diff line number Diff line
@@ -218,6 +218,33 @@ describe JsDuck::Aggregator do
    it_behaves_like "@inheritdoc"
  end

  describe "using @inheritdoc to inherit from another type of member" do
    before do
      @docs = parse(<<-EOF)
        /** @class Foo */
          /**
           * @method bar
           * Original comment.
           */

        /** @class Core */
          /**
           * @event foobar
           * New comment.
           * @inheritdoc Foo#method-bar
           */
      EOF
      @orig = @docs["Foo"][:members][0]
      @inheritdoc = @docs["Core"][:members][0]
    end

    it_behaves_like "@inheritdoc"

    it "keeps the type of the member" do
      @inheritdoc[:tagname].should == :event
    end
  end

  describe "@inheritdoc without type info uses the type of itself" do
    before do
      @docs = parse(<<-EOF)