Commit 0351cc52 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Don't parse (required) after subproperties.

Only read the (required) flag for the config itself, but for the
subproperties leave it inside the text.

Fixes #406
parent deedf503
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -28,7 +28,12 @@ module JsDuck::Tag
          :default => true,
          :optional => true
        })

      # don't parse (required) after subproperties
      unless tag[:name] =~ /\./
        tag[:optional] = false if parse_required(p)
      end

      tag[:doc] = :multiline
      tag
    end
+23 −0
Original line number Diff line number Diff line
@@ -52,4 +52,27 @@ describe JsDuck::Aggregator do
    end
  end

  describe "a config subproperty labeled with (required)" do
    before do
      @doc = parse_member(<<-EOS)
        /**
         * @cfg foo Something
         * @cfg foo.bar (required) Subproperty
         */
      EOS
    end

    it "doesn't have the config marked as required" do
      @doc[:required].should_not == true
    end

    it "doesn't have the subproperty marked as required" do
      @doc[:properties][0][:required].should_not == true
    end

    it "contains the (required) inside subproperty description" do
      @doc[:properties][0][:doc].should == "(required) Subproperty"
    end
  end

end