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

Param type defaults to "Object".

parent 347a9e21
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -16,12 +16,10 @@ module JsDuck
    end

    def render_single(param)
      type = param[:type] || "Object"
      name = param[:name] || ""
      doc = @links.replace(param[:doc] || "")
      doc = @links.replace(param[:doc])
      return [
        "<li>",
        "<code>#{name}</code> : #{type}",
        "<code>#{param[:name]}</code> : #{param[:type]}",
        "<div class='sub-desc'>#{doc}</div>",
        "</li>",
      ].join("")
+3 −3
Original line number Diff line number Diff line
@@ -213,9 +213,9 @@ module JsDuck
        im = implicit[i] || {}
        ex = explicit[i] || {}
        params << {
          :type => ex[:type] || im[:type],
          :name => ex[:name] || im[:name],
          :doc => ex[:doc] || im[:doc],
          :type => ex[:type] || im[:type] || "Object",
          :name => ex[:name] || im[:name] || "",
          :doc => ex[:doc] || im[:doc] || "",
        }
      end
      params
+1 −3
Original line number Diff line number Diff line
@@ -12,9 +12,7 @@ module JsDuck
    end

    def render_single(param)
      type = param[:type] || "Object"
      name = param[:name] || ""
      str = "<code>#{type} #{name}</code>"
      str = "<code>#{param[:type]} #{param[:name]}</code>"
      if optional?(param)
        "<span title='Optional' class='optional'>[" + str + "]</span>"
      else
+5 −6
Original line number Diff line number Diff line
@@ -199,15 +199,14 @@ function f(foo, bar){}
    assert_equal("blah", docs[0][:return][:doc])
  end

  def test_typeless_param
  def test_default_param_type_is_object
    docs = JsDuck.parse("/**
 * @method
 * @param x doc1
 * @param
 */")
    assert_equal("x", docs[0][:params][0][:name])
    assert_equal("doc1", docs[0][:params][0][:doc])

    assert_equal(nil, docs[0][:params][0][:type])
    assert_equal("Object", docs[0][:params][0][:type])
    assert_equal("", docs[0][:params][0][:name])
    assert_equal("", docs[0][:params][0][:doc])
  end

  def test_event