Commit 4ce6dc67 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Mark auto-detected configs as private.

parent e70352b3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -245,6 +245,7 @@ module JsDuck
          docset[:code] = cfg
        else
          cfg[:inheritdoc] = {:no_warnings => true}
          cfg[:private] = true
          configs << cfg
        end
      end
+2 −1
Original line number Diff line number Diff line
@@ -135,8 +135,9 @@ module JsDuck
        :inheritdoc => extract(doc_map, :inheritdoc),
        :meta => detect_meta(doc_map),
      })

      # copy :private also to main hash
      hash[:private] = true if hash[:meta][:private]
      hash[:private] = hash[:meta][:private] ? true : nil

      return hash
    end
+3 −0
Original line number Diff line number Diff line
@@ -77,6 +77,9 @@ module JsDuck
      h[:name] = merge_name(docs, code)
      h[:id] = create_member_id(h)

      # Copy private to meta
      h[:meta][:private] = h[:private] if h[:private]

      h
    end

+12 −0
Original line number Diff line number Diff line
@@ -35,6 +35,14 @@ describe JsDuck::Aggregator do
    it "sets :inheritdoc flag on config" do
      cfg[0][:inheritdoc].should == {:no_warnings => true}
    end

    it "sets :private flag on config" do
      cfg[0][:private].should == true
    end

    it "sets meta :private flag on config" do
      cfg[0][:meta][:private].should == true
    end
  end

  describe "detecting Ext.define() with commented config" do
@@ -71,6 +79,10 @@ describe JsDuck::Aggregator do
    it "detects owner of the config" do
      docs[0][:members][:cfg][0][:owner].should == "MyClass"
    end

    it "detects the config as public" do
      docs[0][:members][:cfg][0][:private].should_not == true
    end
  end

end