Commit 31ba491f authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Fixed explicit property name and type detection.

parent 23f3479b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -148,8 +148,8 @@ module JsDuck
      doc_map = build_doc_map(docs)
      return {
        :tagname => :property,
        :name => detect_name(:prop, doc_map, code),
        :type => detect_type(:prop, doc_map, code),
        :name => detect_name(:property, doc_map, code),
        :type => detect_type(:property, doc_map, code),
        :doc => detect_doc(docs),
        :private => !!doc_map[:private],
        :static => !!doc_map[:static],
+13 −1
Original line number Diff line number Diff line
@@ -394,7 +394,19 @@ foo: true,
    assert_equal("Boolean", docs[0][:type])
  end

  def test_property
  def test_explicit_property
    docs = JsDuck.parse("
/**
 * @property {Integer} foo  My comment
 */
")
    assert_equal(:property, docs[0][:tagname])
    assert_equal("foo", docs[0][:name])
    assert_equal("Integer", docs[0][:type])
    assert_equal("My comment", docs[0][:doc])
  end

  def test_property_with_type
    docs = JsDuck.parse("
/**
 * @property